]> Sergey Matveev's repositories - public-inbox.git/commitdiff
txt2pre: allow overriding title via env
authorEric Wong <e@80x24.org>
Wed, 31 Aug 2016 19:32:12 +0000 (19:32 +0000)
committerEric Wong <e@80x24.org>
Wed, 31 Aug 2016 19:32:12 +0000 (19:32 +0000)
This will allow reasonable titles to be generated for
manpages.

Documentation/include.mk
Documentation/txt2pre

index 51a914b3e75588522d254764bc4aa363347c4b2c..4583f9517a3dc7fd795e9a75c26b0b31d3f4590c 100644 (file)
@@ -59,7 +59,7 @@ dtxt := design_notes.txt design_www.txt dc-dlvr-spam-flow.txt
 dtxt := $(addprefix Documentation/, $(dtxt)) $(mantxt)
 
 %.html: %.txt
-       $(txt2pre)
+       TITLE="$(basename $(<F))" $(txt2pre)
 %.html: %
        $(txt2pre)
 
index 72de0b795567343bde80febc9e5bc90911ef61b9..2f1799fc15e70d42f416a16500a80b5f9d14a457 100755 (executable)
@@ -11,7 +11,8 @@ use PublicInbox::Linkify;
 use PublicInbox::Hval qw(ascii_html);
 
 my $str = eval { local $/; <> };
-my ($title) = ($str =~ /\A([^\n]+)/);
+my $title = $ENV{TITLE};
+($title) = ($str =~ /\A([^\n]+)/) unless $title;
 $title = ascii_html($title);
 my $l = PublicInbox::Linkify->new;
 $str = $l->linkify_1($str);