]> Sergey Matveev's repositories - public-inbox.git/blobdiff - Documentation/txt2pre
No ext_urls
[public-inbox.git] / Documentation / txt2pre
index 04bc3b0e3921e77e440f97f7b2a2b92c71bb1f8d..62175f3438bd26f266343b26c6350a90af15fa9e 100755 (executable)
@@ -1,15 +1,15 @@
-#!/usr/bin/env perl
-# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
+#!perl -w
+# n.b. this is invoked via $(PERL) in makefiles
+# Copyright (C) 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 v5.12;
 use PublicInbox::Linkify;
 use PublicInbox::Hval qw(ascii_html);
-my %xurls;
+my (%xurls, %lei);
 for (qw[lei(1)
        lei-add-external(1)
        lei-add-watch(1)
@@ -42,6 +42,7 @@ for (qw[lei(1)
        lei-q(1)
        lei-rediff(1)
        lei-refresh-mail-sync(1)
+       lei-reindex(1)
        lei-rm(1)
        lei-rm-watch(1)
        lei-security(7)
@@ -63,8 +64,10 @@ for (qw[lei(1)
        public-inbox-init(1)
        public-inbox-learn(1)
        public-inbox-mda(1)
+       public-inbox-netd(1)
        public-inbox-nntpd(1)
        public-inbox-overview(7)
+       public-inbox-pop3d(1)
        public-inbox-purge(1)
        public-inbox-v1-format(5)
        public-inbox-v2-format(5)
@@ -74,8 +77,11 @@ for (qw[lei(1)
        my ($n) = (/([\w\-\.]+)/);
        $xurls{$_} = "$n.html";
        $xurls{$n} = "$n.html";
+       /\Alei-(.+?)\(1\)\z/ and $xurls{"lei $1"} = "$n.html";
 }
 
+$xurls{'lei/store'} = 'lei-store-format.html';
+
 for (qw[make(1) flock(2) setrlimit(2) vfork(2) tmpfs(5) inotify(7) unix(7)
                syslog(3)]) {
        my ($n, $s) = (/([\w\-]+)\((\d)\)/);
@@ -158,6 +164,9 @@ if ($str =~ /^NAME\n\s+([^\n]+)/sm) {
        if ($title =~ /([\w\.\-]+)/) {
                delete $xurls{$1};
        }
+       if ($title =~ /\blei-([\w\-]+)\b/) {
+               delete $xurls{"lei $1"};
+       }
 }
 $title = ascii_html($title);
 my $l = PublicInbox::Linkify->new;
@@ -177,9 +186,3 @@ print '<html><head>',
   "<title>$title</title>",
   "</head><body><pre>",  $str , '</pre></body></html>';
 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);
-}