chiark / gitweb /
html and pdf titles
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Nov 2021 19:07:58 +0000 (19:07 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Nov 2021 19:07:58 +0000 (19:07 +0000)
.gitignore
Makefile
house-rules.md
massage-html [new file with mode: 0755]
pumpkin-books.md

index 41964d59ad17589d66c14346977022950061dbd8..6cb2956d75e5a1600e9d88b4318d4a9838290c5e 100644 (file)
@@ -3,6 +3,7 @@ pumpkin-books.pdf
 bag.pgm
 pot.pgm
 droplet.ppm
+*.tmp
 *.tmp.*
 *.md.txt
 *.md.html
index acce17c933101a8e1c5c0b02d4889281dfc48cdc..0f1ec4db7931e349a632aae227973bf4755b9267 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -52,13 +52,13 @@ PUBLISH_FILES= \
 %.md.txt: %.md
        cat $< $o
 
-title=-Mtitle='$(shell head -1 $<)'
-
-%.md.html: %.md Makefile
-       pandoc $(title) -s $< $o
+%.md.html: %.md Makefile massage-html
+       pandoc -s -Mtitle='Fm4YNbKyBNiS7TNu' $< >$@.tmp
+       ./massage-html $< $@.tmp $o
 
 %.md.pdf: %.md Makefile
-       pandoc --pdf-engine=wkhtmltopdf -o $@ $<
+       perl -pe '$$_ = uc if $$.==1' <$< >$@.tmp
+       pandoc --pdf-engine=wkhtmltopdf -o $@ $@.tmp
 
 pubssh=c
 pubpath=games-rules/quacks
index 1f3b9bfa527894935b3a1844e69700f3360cd619..fc508a2211fe23eb0ed941b7b1244048d171dfd8 100644 (file)
@@ -1,5 +1,4 @@
-House rules
-===========
+% House rules
 
 Turn taking
 -----------
diff --git a/massage-html b/massage-html
new file mode 100755 (executable)
index 0000000..f3f149e
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl -wp
+use strict;
+our $ttitle;
+our $utitle;
+BEGIN {
+  my $md = shift @ARGV // die;
+  open M, '<', $md or die "$md: $!";
+  $ttitle = <M>;
+  chomp $ttitle;
+  $ttitle =~ s{^\%\s+}{} or die;
+  $utitle = "$ttitle - Quacks Books of Pumpkins";
+}
+s{Fm4YNbKyBNiS7TNu}{
+  my $r = $utitle;
+  $utitle = uc $ttitle;
+  $r =~ s{\&}{&amp;};
+  $r =~ s{\<}{&lt;};
+  $r =~ s{\>}{&gt;};
+  $r
+}ge;
index 93ed790187b2df83dd2f375fd3e37b5065a8e2e8..7deacd82d3fc9d4cb10c02fe0d8143d104879b51 100644 (file)
@@ -1,5 +1,5 @@
-Books involving pumpkins
-========================
+Books involving pumpkins
+
 
 *** NB see pumpkin-books.pdf to see which ones have been playtested ***