summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/willora.mk19
1 files changed, 19 insertions, 0 deletions
diff --git a/mk/willora.mk b/mk/willora.mk
index d434b82..ee091dc 100644
--- a/mk/willora.mk
+++ b/mk/willora.mk
@@ -10,6 +10,7 @@ PAPERBACK_OUT?= ${NAME}-paperback.pdf
HARDCOVER_OUT?= ${NAME}-hardcover.pdf
EPUB_OUT?= ${NAME}.epub
DOCBOOK_OUT?= ${NAME}.xml
+DOCX_OUT?= ${NAME}.docx
PAPERBACK_ADOC_TOTAL= ${PAPERBACK_OUT}.adoc
HARDCOVER_ADOC_TOTAL= ${HARDCOVER_OUT}.adoc
EPUB_ADOC_TOTAL= ${EPUB_OUT}.adoc
@@ -17,6 +18,7 @@ DOCBOOK_ADOC_TOTAL= ${DOCBOOK_OUT}.adoc
BUNDLE?= bundle
RUBY?= ruby
+PANDOC?= pandoc
THEME?= poppy
THEMEDIR?= ${WILLORABASE}/themes
FONTDIR?= ${WILLORABASE}/fonts
@@ -58,6 +60,9 @@ epub: ${EPUB_OUT}
.PHONY: docbook
docbook: ${DOCBOOK_OUT}
+.PHONY: docx
+docx: ${DOCX_OUT}
+
########## ########## ##########
# ===== PAPERBACK =====
@@ -201,6 +206,20 @@ ${DOCBOOK_ADOC_TOTAL}: ${CHAPTERS} ${UNICODE_TABLE}
########## ########## ##########
+# ===== DOCX =====
+
+# Thematic breaks are 'visible' in the Docbook source but they are ignored
+# in the conversion to docx. So we have to make them look the way we want
+# ("# # #") right now.
+CLEANFILES+= ${DOCX_OUT}
+${DOCX_OUT}: ${DOCBOOK_OUT}
+ sed -E -e 's,<\?asciidoc-hr\?>,\&\#35; \&\#35; \&\#35;,' ${DOCBOOK_OUT} | \
+ ${PANDOC} --from docbook --to docx \
+ -o ${.TARGET} \
+ -
+
+########## ########## ##########
+
# ===== COMMON =====
CLEANFILES+= ${DEDICATION_OUT}