#!/usr/bin/env perl
# Copyright (C) 2014-2019 all contributors
# License: AGPL-3.0+
#
# 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 '',
qq(),
"$title",
"", $str , '
';
STDOUT->flush;
# keep mtime on website consistent so clients can cache
if (-f STDIN && -f STDOUT) {
my @st = stat(STDIN);
utime($st[8], $st[9], \*STDOUT);
}