summaryrefslogtreecommitdiff
path: root/markdown-to-pdf
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-07-17 15:04:23 +0100
committerLars Wirzenius <liw@liw.fi>2011-07-17 15:04:23 +0100
commitb276de40496780fbfde73d104b811493e39eb673 (patch)
tree2a31370668a79a215eaa3c2c301bb30b8c8e57f8 /markdown-to-pdf
parent247ae9abf621085db297345a839d084f5d8db534 (diff)
downloadgtdfh.liw.fi-b276de40496780fbfde73d104b811493e39eb673.tar.gz
Add a script plus css file for making a PDF of the book.
Diffstat (limited to 'markdown-to-pdf')
-rwxr-xr-xmarkdown-to-pdf44
1 files changed, 44 insertions, 0 deletions
diff --git a/markdown-to-pdf b/markdown-to-pdf
new file mode 100755
index 0000000..732a456
--- /dev/null
+++ b/markdown-to-pdf
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+set -e
+
+book_prelude()
+{
+ cat <<eof
+<html>
+<head>
+<title>Book</title>
+<link rel="stylesheet" href="book.css" type="text/css" />
+</head>
+<body>
+eof
+}
+
+book_end()
+{
+ cat <<eof
+</body>
+</html>
+eof
+}
+
+chapter()
+{
+ cat <<eof
+<div class="chapter">
+eof
+
+ markdown "$1"
+
+ cat <<eof
+</div>
+eof
+}
+
+(book_prelude
+for f in "$@"
+do
+ chapter "$f"
+done
+book_end) > book.html
+wkhtmltopdf book.html book.pdf