From 16333a5612e9e79500e391757f5d8a8b1cc23b8e Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Mon, 29 May 2017 23:07:35 -0400 Subject: added pandoc -> docx conversion --- pandoc.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 -- cgit v1.2.3