This will allow reasonable titles to be generated for
manpages.
---
 Documentation/include.mk | 2 +-
 Documentation/txt2pre    | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/include.mk b/Documentation/include.mk
index 51a914b..4583f95 100644
--- a/Documentation/include.mk
+++ b/Documentation/include.mk
@@ -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)
 
diff --git a/Documentation/txt2pre b/Documentation/txt2pre
index 72de0b7..2f1799f 100755
--- a/Documentation/txt2pre
+++ b/Documentation/txt2pre
@@ -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);
-- 
EW


Reply via email to