From 02808570709fd7684e0e943a046625fde7e2fe42 Mon Sep 17 00:00:00 2001 From: Charlotte Koch Date: Tue, 19 Sep 2023 12:44:36 -0700 Subject: Initial Asciidoc -> docx converter It is missing the "reference document" such that the resultant docx has the expected styling -- that will be next. --- mk/willora.mk | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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} -- cgit v1.2.3