user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] txt2pre: remove CGI.pm dependency
@ 2016-05-29  2:11  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-05-29  2:11 UTC (permalink / raw)
  To: meta

It's no longer a part of the stock Perl distribution,
and we don't need a whole module for just one function.
---
 Documentation/txt2pre | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/txt2pre b/Documentation/txt2pre
index ef6a4f3..8752260 100755
--- a/Documentation/txt2pre
+++ b/Documentation/txt2pre
@@ -7,10 +7,16 @@
 # and requires indentation to output preformatted text.
 use strict;
 use warnings;
-use CGI qw/escapeHTML/;
 use Encode qw/encode/;
 my $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]+)/);
 

^ permalink raw reply	[relevance 7%]

Results 1-1 of 1 | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2016-05-29  2:11  7% [PATCH] txt2pre: remove CGI.pm dependency Eric Wong

Code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).