From b479a7d9cfad3fa6cf2b3adac02aeec63381a297 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 6 Nov 2021 19:07:58 +0000 Subject: [PATCH] html and pdf titles --- .gitignore | 1 + Makefile | 10 +++++----- house-rules.md | 3 +-- massage-html | 20 ++++++++++++++++++++ pumpkin-books.md | 4 ++-- 5 files changed, 29 insertions(+), 9 deletions(-) create mode 100755 massage-html diff --git a/.gitignore b/.gitignore index 41964d5..6cb2956 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ pumpkin-books.pdf bag.pgm pot.pgm droplet.ppm +*.tmp *.tmp.* *.md.txt *.md.html diff --git a/Makefile b/Makefile index acce17c..0f1ec4d 100644 --- 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 diff --git a/house-rules.md b/house-rules.md index 1f3b9bf..fc508a2 100644 --- a/house-rules.md +++ b/house-rules.md @@ -1,5 +1,4 @@ -House rules -=========== +% House rules Turn taking ----------- diff --git a/massage-html b/massage-html new file mode 100755 index 0000000..f3f149e --- /dev/null +++ b/massage-html @@ -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 = ; + chomp $ttitle; + $ttitle =~ s{^\%\s+}{} or die; + $utitle = "$ttitle - Quacks Books of Pumpkins"; +} +s{Fm4YNbKyBNiS7TNu}{ + my $r = $utitle; + $utitle = uc $ttitle; + $r =~ s{\&}{&}; + $r =~ s{\<}{<}; + $r =~ s{\>}{>}; + $r +}ge; diff --git a/pumpkin-books.md b/pumpkin-books.md index 93ed790..7deacd8 100644 --- a/pumpkin-books.md +++ b/pumpkin-books.md @@ -1,5 +1,5 @@ -Books involving pumpkins -======================== +% Books involving pumpkins + *** NB see pumpkin-books.pdf to see which ones have been playtested *** -- 2.30.2