about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-29 12:31:06 +0100
committerEric Wong <e@80x24.org>2016-05-29 11:33:42 +0000
commitc6b7757b241baf82be9aec9b937478881ab0d282 (patch)
tree33fd50e14fe297eeb5d38e82c20db8c950ad9df1
parenta6ba02f02e4319c0bf5b8aa000ef6851905185b4 (diff)
downloadcmogstored-c6b7757b241baf82be9aec9b937478881ab0d282.tar.gz
CGI.pm is no longer in the main Perl distro, so depending
on it is not worth the effort for a few lines.
-rwxr-xr-xbuild-aux/txt2pre11
1 files changed, 8 insertions, 3 deletions
diff --git a/build-aux/txt2pre b/build-aux/txt2pre
index d1eadc6..276728f 100755
--- a/build-aux/txt2pre
+++ b/build-aux/txt2pre
@@ -7,7 +7,6 @@
 # and requires indentation to output preformatted text.
 use strict;
 use warnings;
-use CGI qw/escapeHTML/;
 use Encode qw/encode/;
 my $file = shift;
 my $str;
@@ -18,8 +17,14 @@ if (defined $file) {
 } else {
         $str = eval { local $/; <> };
 }
-
-$str = escapeHTML($str);
+my %xhtml_map = (
+        '"' => '&#34;',
+        '&' => '&#38;',
+        "'" => '&#39;',
+        '<' => '&lt;',
+        '>' => '&gt;',
+);
+$str =~ s/([<>&'"])/$xhtml_map{$1}/ge;
 $str = encode('us-ascii', $str, Encode::HTMLCREF);
 my ($title) = ($str =~ /\A([^\n]+)\n[^a-zA-Z]*\n/s);