summaryrefslogtreecommitdiff
path: root/pandoc.mk
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2017-05-29 23:07:35 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2017-05-29 23:07:35 -0400
commit16333a5612e9e79500e391757f5d8a8b1cc23b8e (patch)
tree6e9df272796a4d6cf36062e147d78d48b7a4c7df /pandoc.mk
parent4cf65aba2e476a827948df85dc84c0fec834358b (diff)
downloadmakefile_templates-16333a5612e9e79500e391757f5d8a8b1cc23b8e.tar.gz
makefile_templates-16333a5612e9e79500e391757f5d8a8b1cc23b8e.zip
added pandoc -> docx conversion
Diffstat (limited to 'pandoc.mk')
-rw-r--r--pandoc.mk14
1 files changed, 14 insertions, 0 deletions
diff --git a/pandoc.mk b/pandoc.mk
index 173ee6e..c15d80a 100644
--- a/pandoc.mk
+++ b/pandoc.mk
@@ -12,12 +12,14 @@ md_files = $(wildcard *.md)
tex_from_md = $(md_files:%.md=%.tex)
pdf_from_md = $(md_files:%.md=%.pdf)
html_from_md = $(md_files:%.md=%.html)
+docx_from_md = $(md_files:%.md=%.docx)
md_src_dest_targets = $(md_files:%=$(dest_dir_md)/%)
md_fig_dest_targets = $(md_fig_files:%=$(dest_dir_md)/%)
tex_from_md_dest_targets = $(tex_from_md:%=$(dest_dir_md)/%)
pdf_from_md_dest_targets = $(pdf_from_md:%=$(dest_dir_md)/%)
html_from_md_dest_targets = $(html_from_md:%=$(dest_dir_md)/%)
+docx_from_md_dest_targets = $(docx_from_md:%=$(dest_dir_md)/%)
# to disable preprocessor use
#PANDOC_PREPROCESSOR_CMD ?= cat
@@ -63,10 +65,12 @@ endif
PANDOC_HTML_METADATA ?= cat -
PANDOC_TEX_METADATA ?= cat - $(PANDOC_META_DIR)/tex_metadata.yaml
PANDOC_PDF_METADATA ?= $(PANDOC_TEX_METADATA)
+PANDOC_DOCX_METADATA ?= cat -
PANDOC_HTML_OPTIONS ?= --section-divs --toc
PANDOC_TEX_OPTIONS ?= --latex-engine=pdflatex
PANDOC_PDF_OPTIONS ?= --latex-engine=pdflatex
+PANDOC_DOCX_OPTIONS ?= -t docx
ifneq ($(strip $(PANDOC_CSS)),)
PANDOC_HTML_OPTIONS += --css=$(PANDOC_CSS_DIR)/$(PANDOC_CSS)
@@ -80,6 +84,7 @@ pdf_md: $(pdf_from_md)
tex_md: $(tex_from_md)
+docx_md: $(docx_from_md)
$(html_from_md): %.html : %.md $(md_fig_files) $(md_configs) $(md_includes)
@@ -91,6 +96,9 @@ $(tex_from_md): %.tex : %.md $(md_fig_files) $(md_configs) $(md_includes)
$(pdf_from_md): %.pdf : %.md $(md_fig_files) $(md_configs) $(md_includes)
$(PANDOC_PREPROCESSOR) $< | $(PANDOC_PDF_METADATA) | $(PANDOC) $(PANDOC_PDF_OPTIONS) -o $@
+$(docx_from_md): %.docx : %.md $(md_fig_files) $(md_configs) $(md_includes)
+ $(PANDOC_PREPROCESSOR) $< | $(PANDOC_DOCX_METADATA) | $(PANDOC) $(PANDOC_DOCX_OPTIONS) -o $@
+
install_md_src: $(md_src_dest_targets) install_md_fig_files
$(md_src_dest_targets): $(dest_dir_md)/% : % | $(dest_dir_md)
@@ -116,6 +124,12 @@ ifneq ($(strip $(pdf_from_md)),)
$(INSTALL) -m 0644 '$<' '$@'
endif
+install_docx_md: $(docx_from_md_dest_targets)
+$(docx_from_md_dest_targets): $(dest_dir_md)/% : % | $(dest_dir_md)
+ifneq ($(strip $(docx_from_md)),)
+ $(INSTALL) -m 0644 '$<' '$@'
+endif
+
clean_md: clean_md_aux
real_clean_md: clean_md_tex clean_md_aux