summaryrefslogtreecommitdiff
path: root/lib/content.mk
diff options
context:
space:
mode:
Diffstat (limited to 'lib/content.mk')
-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: