X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=Documentation%2Ftxt2pre;h=cb6a76138131a8d0abd3593d013860d523b1f1fa;hb=7c5ac90b309bbe76468055e8a9289664ef2dfe37;hp=4c4b2ca2f77b6189b6a72f5f27623a89d5558ef4;hpb=3d41aa23f35501ca92aab8aa42980fa73f7fa74f;p=public-inbox.git diff --git a/Documentation/txt2pre b/Documentation/txt2pre index 4c4b2ca2..cb6a7613 100755 --- a/Documentation/txt2pre +++ b/Documentation/txt2pre @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# Copyright (C) 2014-2018 all contributors +# Copyright (C) 2014-2019 all contributors # License: AGPL-3.0+ # # Stupid script to make HTML from preformatted, utf-8 text versions, @@ -11,8 +11,7 @@ use PublicInbox::Linkify; use PublicInbox::Hval qw(ascii_html); my $str = eval { local $/; <> }; -my $title = $ENV{TITLE}; -($title) = ($str =~ /\A([^\n]+)/) unless $title; +my ($title) = ($str =~ /\A([^\n]+)/); $title = ascii_html($title); my $l = PublicInbox::Linkify->new; $str = $l->linkify_1($str); @@ -23,3 +22,10 @@ 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); +}