]> Sergey Matveev's repositories - public-inbox.git/commitdiff
doc: txt2pre: linkify "lei COMMAND" form
authorEric Wong <e@80x24.org>
Thu, 3 Nov 2022 00:48:35 +0000 (00:48 +0000)
committerEric Wong <e@80x24.org>
Thu, 3 Nov 2022 18:42:14 +0000 (18:42 +0000)
While manpages are named `L<lei-COMMAND(1)>', `lei COMMAND'
can be worth linkifying for ease-of-navigation, too.

Documentation/txt2pre

index c8dbd2ba551ab3130728f8f4e4a876a48bdfea88..82573a308e7bb9397a23ea1f46d67c9ab937478f 100755 (executable)
@@ -9,7 +9,7 @@ use strict;
 use warnings;
 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)
@@ -77,6 +77,7 @@ for (qw[lei(1)
        my ($n) = (/([\w\-\.]+)/);
        $xurls{$_} = "$n.html";
        $xurls{$n} = "$n.html";
+       /\Alei-(.+?)\(1\)\z/ and $xurls{"lei $1"} = "$n.html";
 }
 
 for (qw[make(1) flock(2) setrlimit(2) vfork(2) tmpfs(5) inotify(7) unix(7)
@@ -161,6 +162,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;