From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 906CF1FCC6 for ; Sun, 29 May 2016 02:11:32 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] txt2pre: remove CGI.pm dependency Date: Sun, 29 May 2016 02:11:32 +0000 Message-Id: <20160529021132.12189-1-e@80x24.org> List-Id: 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 = ( + '"' => '"', + '&' => '&', + "'" => ''', + '<' => '<', + '>' => '>', +); +$str =~ s/([<>&'"])/$xhtml_map{$1}/ge; $str = encode('us-ascii', $str, Encode::HTMLCREF); my ($title) = ($str =~ /\A([^\n]+)/);