commit 9ec6c8480fc307f744f98f832f478fe8d8a27387 from: Omar Polo date: Sat Aug 27 07:20:21 2022 UTC move index header to separate file and behind a function commit - 4ad24540ab5194cdb4b7bd90d56d14c258629faa commit + 9ec6c8480fc307f744f98f832f478fe8d8a27387 blob - badf5fee6fc3764161b6bda537b33b0b2726b108 blob + 861608741a19e6e3055c976205c2f56c225c6cc2 --- GotMArc.pm +++ GotMArc.pm @@ -5,7 +5,7 @@ use v5.32; use Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(san parse small_logo initpage endpage); +our @EXPORT_OK = qw(san parse small_logo initpage endpage index_header); sub san { my $str = shift; @@ -59,6 +59,7 @@ sub readall { my $small_logo = readall "logo-small.html"; my $hdr = readall "head.html"; my $foot = readall "foot.html"; +my $idxhdr = readall "index-header.html"; sub small_logo { my $fh = shift; @@ -75,4 +76,11 @@ sub endpage { say $fh $foot; } +sub index_header { + my ($fh, $page, $subtitle) = @_; + my $html = $idxhdr =~ s/PAGE/$page/r; + $html =~ s/SUBTITLE/$subtitle/; + print $fh $html; +} + 1; blob - /dev/null blob + 89cdb2b7cb2933dac1ee6aeacd61c2bbccb49a9d (mode 644) --- /dev/null +++ index-header.html @@ -0,0 +1,10 @@ +
+ + "GOT" where the "O" is a cute smiling sun. + +

Game of Trees Mail Archive

+

Page PAGE

+

SUBTITLE

+
blob - b97eae00c4b3d12047fd9c18de9b0c2fc12feef9 blob + 4f4bbeffe75dac51401f2d3b3c13921d052bd060 --- mkindex +++ mkindex @@ -10,7 +10,7 @@ use OpenBSD::Pledge; use OpenBSD::Unveil; use lib "."; -use GotMArc qw(parse san small_logo initpage endpage); +use GotMArc qw(parse san small_logo initpage endpage index_header); my $outdir = $ENV{'OUTDIR'}; die 'Set $OUTDIR' unless defined $outdir; @@ -91,34 +91,20 @@ sub renderpages { or die "can't open $dest for writing: $!"; my $title = "Game of Trees Mail Archive | page $i"; - initpage($pfh, $title); - my $subtitle = $pages[$i-1]; - my $hdr = < - - "GOT" where the "O" is a cute smiling sun. - -

Game of Trees Mail Archive

-

Page $i

-

$subtitle

- -
-EOF - say $pfh $hdr; + initpage($pfh, $title); + index_header $pfh, $i, $subtitle; + say $pfh "
"; nav $pfh, $i if $page > 1; copyfrom($path, $pfh); nav $pfh, $i if $page > 1; say $pfh "
"; - endpage($pfh); - close($pfh); + close($pfh); unlink $path; } }