From 144c77e95d9c0dc0b368aaccec0cd85ce481cf73 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 6 Nov 2021 20:38:05 +0000 Subject: [PATCH] image previews on web page Signed-off-by: Ian Jackson --- .gitignore | 1 + Makefile | 9 ++++++++- README.html | 5 +++++ gen-index | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 gen-index diff --git a/.gitignore b/.gitignore index 6ebd0e8..7e8105b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ bag.pgm pot.pgm droplet.ppm book-* +index.html *.tmp *.tmp.* *.md.txt diff --git a/Makefile b/Makefile index d799b99..b0b637c 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # Copyright 2020-2021 Ian Jackson PUBLISH_MD += pumpkin-books house-rules -PUBLISH += pumpkin-books.pdf README.html +PUBLISH += pumpkin-books.pdf index.html PUBLISH += LICENCE.txt GPL-3.txt CC-BY-SA-4.0.txt PUBLISH += $(addsuffix .md.txt, $(PUBLISH_MD)) PUBLISH += $(addsuffix .md.html, $(PUBLISH_MD)) @@ -21,6 +21,7 @@ BOOKS+= black-pair/black-more BOOK_STEMS := $(addprefix book-,$(subst /, ,$(BOOKS))) PUBLISH += $(addsuffix .pdf, $(BOOK_STEMS)) +PUBLISH += $(addsuffix .png, $(BOOK_STEMS)) all: $(PUBLISH) @@ -68,12 +69,18 @@ book-%.pdf: book-%.eps book-%.eps: book-%.ps rm -f $@; ps2eps $< +book-%.png: book-%.eps Makefile + gm convert -density 150x150 $< $@ + .PRECIOUS: book-%.eps PUBLISH_FILES= \ $(patsubst %.md,%.md.txt, $(PUBLISH)) \ $(patsubst %.md,%.md.html, $(filter $(PUBLISH)) \ +index.html: gen-index README.html + ./$^ $(BOOK_STEMS) $o + %.md.txt: %.md cat $< $o diff --git a/README.html b/README.html index f6524d3..da3211f 100644 --- a/README.html +++ b/README.html @@ -40,6 +40,11 @@ FTR, we no longer play on the test tube side of the boards. In our experience this significantly overpowers blacks. We have not yet found a good way to debuff them by about the right amount. + +

diff --git a/gen-index b/gen-index new file mode 100755 index 0000000..058171f --- /dev/null +++ b/gen-index @@ -0,0 +1,22 @@ +#!/usr/bin/perl -w +use strict; +our $input = shift @ARGV; +our @books = @ARGV; +@ARGV=($input); + +while (<>) { + if (m{^\<\!-- book-\*\s} .. m{\s--\>\s*$}) { + if (m{\[delete\]}) { + next; + } elsif (m{BOOK}) { + my $orig = $_; + foreach my $book (@books) { + $_ = $orig; + s{\bBOOK\b}{$book}g; + print; + } + next; + } + } + print; +} -- 2.30.2