diff options
author | Eric Wong <e@80x24.org> | 2016-05-29 12:31:06 +0100 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-29 11:33:42 +0000 |
commit | c6b7757b241baf82be9aec9b937478881ab0d282 (patch) | |
tree | 33fd50e14fe297eeb5d38e82c20db8c950ad9df1 | |
parent | a6ba02f02e4319c0bf5b8aa000ef6851905185b4 (diff) | |
download | cmogstored-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-x | build-aux/txt2pre | 11 |
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 = ( + '"' => '"', + '&' => '&', + "'" => ''', + '<' => '<', + '>' => '>', +); +$str =~ s/([<>&'"])/$xhtml_map{$1}/ge; $str = encode('us-ascii', $str, Encode::HTMLCREF); my ($title) = ($str =~ /\A([^\n]+)\n[^a-zA-Z]*\n/s); |