summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-29 11:50:25 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-29 11:50:25 +0000
commit87617a3dc9056ec9a79c060fe46f6e301598c8ae (patch)
treec8a4f20e3849a95d64c12173a7d4b5d65ecb2a61
parent2dee685a1f8fb954fbeb9fd9a9d0dbb57b34b8ee (diff)
downloadobnam-87617a3dc9056ec9a79c060fe46f6e301598c8ae.tar.gz
Move formatting code to a shell script
-rw-r--r--manual/Makefile7
-rwxr-xr-xmanual/format-pdf21
2 files changed, 24 insertions, 4 deletions
diff --git a/manual/Makefile b/manual/Makefile
index f3804f9f..6b97f691 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -1,15 +1,14 @@
-TITLE = Backups with Obnam
+TITLE_EN = Backups with Obnam
AUTHOR = Lars Wirzenius (liw@liw.fi)
VERSION = Version $(shell git describe)
-en_sources = en/000.mdwn $(shell ls en/*.mdwn | grep -vFx en/000.mdwn)
+en_sources = $(shell ls en/*.mdwn)
outputs = obnam-manual.en.pdf obnam-manual.en.html
all: $(outputs)
obnam-manual.en.pdf: Makefile $(en_sources)
- pandoc --smart --toc --chapters --number-sections \
- -o $@ $(en_sources)
+ ./format-pdf $@ "$(TITLE_EN)" "$(AUTHOR)" "$(VERSION)" $(en_sources)
obnam-manual.en.html: Makefile $(en_sources) ../obnam.css
pandoc -H ../obnam.css --smart --toc --chapters --number-sections \
diff --git a/manual/format-pdf b/manual/format-pdf
new file mode 100755
index 00000000..137ecf9e
--- /dev/null
+++ b/manual/format-pdf
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -eu
+
+OUTPUT="$1"
+TITLE="$2"
+AUTHOR="$3"
+VERSION="$4"
+shift 4
+
+cat > 000.mdwn <<EOF
+% $TITLE
+% $AUTHOR
+% $VERSION
+EOF
+
+cat 000.mdwn
+
+pandoc --smart --toc --chapters --number-sections -o "$OUTPUT" 000.mdwn "$@"
+
+rm -f 000.mdwn