summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--USE.md17
-rw-r--r--lib/content.mk35
-rw-r--r--sample/.gitignore3
-rw-r--r--sample/Makefile6
4 files changed, 61 insertions, 0 deletions
diff --git a/USE.md b/USE.md
new file mode 100644
index 0000000..30c9e22
--- /dev/null
+++ b/USE.md
@@ -0,0 +1,17 @@
+# Structured layout
+
+## Text content from external source
+
+Text content from external source -
+e.g. Word document -
+Cannot be trusted to contain well-structured styling.
+Better to flatten and re-apply styling locally.
+
+1) Track external source in git
+2) Transform external source to markdown
+ make draftfiles
+3) Track local markdown source in git
+4) Transform markdown source to html
+ make importfiles
+5) Import html into Scribus
+6) Adapt styles in Scribus (preserving style names)
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:
diff --git a/sample/.gitignore b/sample/.gitignore
new file mode 100644
index 0000000..9053879
--- /dev/null
+++ b/sample/.gitignore
@@ -0,0 +1,3 @@
+# ignore auto-generated intermediate and draft files
+*.mdn
+*.xml
diff --git a/sample/Makefile b/sample/Makefile
new file mode 100644
index 0000000..35f4be9
--- /dev/null
+++ b/sample/Makefile
@@ -0,0 +1,6 @@
+# Transform content into layout formats
+
+include /usr
+
+# content
+texts =