2 # Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
5 # Stupid script to make HTML from preformatted, utf-8 text versions,
6 # only generating links for http(s). Markdown does too much
7 # and requires indentation to output preformatted text.
10 use PublicInbox::Linkify;
11 use PublicInbox::Hval qw(ascii_html);
13 my $str = eval { local $/; <> };
14 my ($title) = ($str =~ /\A([^\n]+)/);
15 $title = ascii_html($title);
16 my $l = PublicInbox::Linkify->new;
17 $str = $l->linkify_1($str);
18 $str = ascii_html($str);
19 $str = $l->linkify_2($str);
22 qq(<meta\nhttp-equiv="Content-Type"\ncontent="text/html; charset=utf-8"\n/>),
23 "<title>$title</title>",
24 "</head><body><pre>", $str , '</pre></body></html>';