chiark / gitweb /
image previews on web page
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Nov 2021 20:38:05 +0000 (20:38 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Nov 2021 20:38:05 +0000 (20:38 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
.gitignore
Makefile
README.html
gen-index [new file with mode: 0755]

index 6ebd0e8adc679fab5ea16fddf270f4b03d686eec..7e8105b8bd6e215933811c8b07fb3fbc2d05a846 100644 (file)
@@ -4,6 +4,7 @@ bag.pgm
 pot.pgm
 droplet.ppm
 book-*
+index.html
 *.tmp
 *.tmp.*
 *.md.txt
index d799b9946f614de113fddc8a32436aa34ac7e579..b0b637c1a1933b7ac31b367ac5b393d39b3bbc69 100644 (file)
--- 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
 
index f6524d39fdea841ac675be37942fa693bf3d3605..da3211f1d4d3840288ff8886b21b070b7d9c5ce7 100644 (file)
@@ -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.
 
+<!-- book-* [delete]
+<h2>Pumpkin book images</h2>
+<a href="BOOK.pdf"><img src="BOOK.png"></a>
+  [delete] -->
+
 <hr>
 <address>
 <p>
diff --git a/gen-index b/gen-index
new file mode 100755 (executable)
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;
+}