public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob 9a81a24a007a5e861bbd59d33a46876476e76384 833 bytes (raw)
$ git show ci-WIP:Documentation/txt2pre	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
#!/usr/bin/env perl
# Copyright (C) 2014-2018 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
# Stupid script to make HTML from preformatted, utf-8 text versions,
# only generating links for http(s).  Markdown does too much
# and requires indentation to output preformatted text.
use strict;
use warnings;
use PublicInbox::Linkify;
use PublicInbox::Hval qw(ascii_html);

my $str = eval { local $/; <> };
my ($title) = ($str =~ /\A([^\n]+)/);
$title = ascii_html($title);
my $l = PublicInbox::Linkify->new;
$str = $l->linkify_1($str);
$str = ascii_html($str);
$str = $l->linkify_2($str);

print '<html><head>',
  qq(<meta\nhttp-equiv="Content-Type"\ncontent="text/html; charset=utf-8"\n/>),
  "<title>$title</title>",
  "</head><body><pre>",  $str , '</pre></body></html>';

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git