summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2016-08-28 14:23:37 +0200
committerJonas Smedegaard <dr@jones.dk>2016-08-28 14:23:37 +0200
commitd38ae6faad47480334bef34bde47dfa41c03a11f (patch)
treee7a19a08d55fb917fbdda5f281e97b79f5496e37 /lib
Initial draft.
Diffstat (limited to 'lib')
-rw-r--r--lib/content.mk35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/content.mk b/lib/content.mk
new file mode 100644
index 0000000..8157569
--- /dev/null
+++ b/lib/content.mk
@@ -0,0 +1,35 @@
+# Transform content into layout formats for Scribus
+
+# content
+#texts = front chapter1 chapter2 chapter3 caption1 caption2
+
+# filenames in specific format
+docbookdraftfiles ?= $(addsuffix .xml,$(texts))
+markdowndraftfiles ?= $(addsuffix .mdn,$(texts))
+htmlfiles ?= $(addsuffix .html,$(texts))
+
+# bundle targets
+importfiles: $(htmlfiles)
+draftfiles: $(markdowndraftfiles)
+
+# transformations into well-formed source
+# * target extension slightly off to not auto-overwrite manual edits
+
+$(docbookdraftfiles): %.xml: %.doc Makefile
+ unoconv --format docbook $<
+
+$(markdowndraftfiles): %.mdn: %.xml Makefile
+ pandoc --from docbook --to markdown -o $@ $<
+
+# transformations from well-formed source to import-ready format
+
+$(htmlfiles): %.html: %.md Makefile
+ pandoc --from markdown --to html --standalone --smart -o $@ $<
+
+# housekeeping
+
+clean::
+ rm -f $(docbookdraftfiles) $(markdowndraftfiles)
+
+.PHONY: draftfiles importfiles clean
+.DELETE_ON_ERROR: