Created
January 1, 2022 09:45
-
-
Save gernotstarke/8deff51f87f1fe0270c88e21fe9fa74b to your computer and use it in GitHub Desktop.
Makefile for authoring markdown with a (BibTeX-based) citation manager like Zotero
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For a description of this file, please see: | |
# https://www.innoq.com/en/blog/markdown-with-zotero-workflow | |
#------------------------------------------------------------ | |
# what's the name of the generated output file(s) | |
OUTPUT=out | |
# what's the name of the markdown source file | |
SOURCE=principles-content.md | |
CITATIONSTYLE=ieee.csl | |
BIBLIO=~/Dropbox/zotero-export/zorg-biblio.bib | |
TARGET=$(OUTPUT).docx $(OUTPUT).md | |
PANDOC=pandoc \ | |
--from=markdown \ | |
-s --bibliography $(BIBLIO) \ | |
--citeproc \ | |
--csl=$(CITATIONSTYLE) \ | |
--metadata link-citations=true \ | |
$(SOURCE) | |
# create docx | |
$(OUTPUT).docx: $(SOURCE) $(METADATA) | |
$(PANDOC) --output=$(OUTPUT).docx | |
# create github flavored markdown | |
$(OUTPUT).md: $(SOURCE) $(METADATA) | |
rm -rf $(OUTPUT).md | |
$(PANDOC) --to=gfm --output=$(OUTPUT).md | |
all: $(TARGET) | |
clean: | |
rm -rf $(OUTPUT).docx $(OUTPUT).md | |
.PHONY: all clean $(TARGET) | |
.DEFAULT_GOAL := all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment