Skip to content

Commit

Permalink
[Tool] introduce variable for Pandoc args in Makefile (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
cagix committed Aug 2, 2023
1 parent e1a1397 commit b011159
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
READINGS = data/readings.yaml
BIBTEX = cb.bib

## Metadata (for Pandoc)
METADATA = metadata.yaml

## local.yaml allows to override settings in hugo_conf.yaml
HUGO_LOCAL = $(wildcard local.yaml)

Expand Down Expand Up @@ -71,13 +74,16 @@ PANDOC_DIRS = --resource-path=".:$(XDG_DATA_HOME)/pandoc/:$(XDG_DATA_HOME)/pando
HUGO_DIRS = --themesDir "$(XDG_DATA_HOME)/pandoc/hugo"

## Define options for generating images from ".tex" files
LATEX_ARGS = -shell-escape
LATEX_ARGS = -shell-escape

## Define options for generating images from ".dot" files
DOT_ARGS = -Tpng
DOT_ARGS = -Tpng

## Define options to be used by Pandoc
PANDOC_ARGS = --metadata-file=$(METADATA) $(PANDOC_DIRS)

## Define options to be used by Hugo
HUGO_ARGS = --config hugo_conf.yaml,$(HUGO_LOCAL) $(HUGO_DIRS)
HUGO_ARGS = --config hugo_conf.yaml,$(HUGO_LOCAL) $(HUGO_DIRS)

#--------------------------------------------------------------------------------
# I/O Directories
Expand Down Expand Up @@ -275,7 +281,7 @@ $(WEB_IMAGE_TARGETS): $(WEB_INTERMEDIATE_DIR)/%: $(IMAGES_OUTPUT_DIR)/%
## Process markdown with pandoc (preprocessing for hugo)
$(WEB_MARKDOWN_TARGETS): $(WEB_INTERMEDIATE_DIR)/%: $(SRC_DIR)/%
$(create-folder)
$(PANDOC) $(PANDOC_DIRS) -d hugo $< -o $@
$(PANDOC) $(PANDOC_ARGS) -d hugo $< -o $@

## Copy static files to $(WEB_INTERMEDIATE_DIR)
$(WEB_STATIC_TARGETS): $(WEB_INTERMEDIATE_DIR)/%: $(SRC_DIR)/%
Expand All @@ -297,10 +303,10 @@ $(SLIDES_MARKDOWN_TARGETS): $(SLIDES_INTERMEDIATE_DIR)/%: $(SRC_DIR)/%
## Page-Bundles: path/name/index.md, path/name/images/, path_name.pdf
$(SLIDES_BUNDLE_PDF_TARGETS): $$(patsubst $(SLIDES_OUTPUT_DIR)/%.pdf,$(SLIDES_INTERMEDIATE_DIR)/%/index.md, $$(subst _,/,$$@))
$(create-folder)
$(PANDOC) $(PANDOC_DIRS) -d slides $< -o $@
$(PANDOC) $(PANDOC_ARGS) -d slides $< -o $@
$(SLIDES_BUNDLE_PDF_TARGETS): $$(filter $$(patsubst $(SLIDES_OUTPUT_DIR)/%.pdf,$(SLIDES_INTERMEDIATE_DIR)/%, $$(subst _,/,$$@))%, $(SLIDES_IMAGE_TARGETS))
## Single Markdown Files: path/name.md, path/<images>/, path_name.pdf
$(SLIDES_SINGLE_PDF_TARGETS): $$(patsubst $(SLIDES_OUTPUT_DIR)/%.pdf,$(SLIDES_INTERMEDIATE_DIR)/%.md, $$(subst _,/,$$@))
$(create-folder)
$(PANDOC) $(PANDOC_DIRS) -d slides $< -o $@
$(PANDOC) $(PANDOC_ARGS) -d slides $< -o $@
$(SLIDES_SINGLE_PDF_TARGETS): $$(filter $$(dir $$(patsubst $(SLIDES_OUTPUT_DIR)/%.pdf,$(SLIDES_INTERMEDIATE_DIR)/%, $$(subst _,/,$$@)))%, $(SLIDES_IMAGE_TARGETS))
2 changes: 0 additions & 2 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
lang: de-DE
institute: "Unless otherwise noted, this work is licensed under CC BY-SA 4.0."
bibliography: cb.bib
link-citations: true
---

0 comments on commit b011159

Please sign in to comment.