## Put this Makefile in your project directory---i.e., the directory
## containing the paper you are writing. Assuming you are using the
## rest of the toolchain here, you can use it to create .html, .tex,
## and .pdf output files (complete with bibliography, if present) from
## your markdown file. 
## -	Change the paths at the top of the file as needed.
## -	Using `make` without arguments will generate html, tex, and pdf 
## 	output files from all of the files with the designated markdown
##	extension. The default is `.md` but you can change this. 
## -	You can specify an output format with `make tex`, `make pdf` or 
## - 	`make html`. 
## -	Doing `make clean` will remove all the .tex, .html, and .pdf files 
## 	in your working directory. Make sure you do not have files in these
##	formats that you want to keep!

## Markdown extension (e.g. md, markdown, mdown).
MEXT = md

## All markdown files in the working directory
SRC = $(wildcard *.$(MEXT))

PDFS=$(SRC:.md=.pdf)
HTML=$(SRC:.md=.html)
DOCX=$(SRC:.md=.docx)


all:	$(HTML) $(PDFS) $(DOCX)

pdf:	clean $(PDFS)

html:	clean $(HTML)

docx:	clean $(DOCX)


%.html:	%.md
	pandoc \
	--standalone \
	--email-obfuscation=references \
	-c ../../../../../../../web/style/style.css \
	--columns=10000 \
	--section-divs \
	--toc \
	--toc-depth=1 \
	-t html5 \
	-M date="`(LANG=en_us_88591 date "+%B %e, %Y")`" \
	-H ../../templates/head.html \
	-f markdown+yaml_metadata_block \
	-M title="PCP − Lecture $(basename $<)" -o $@ ../../templates/preamble.yaml  $<

# \

# 	
# Available styles:
# pandoc --list-highlight-styles
# tango
# haddock
# pygments
# espresso
# zenburn
# kate
# monochrome
# breezedark
#--highlight-style ../VisualCS.theme \

%.docx: %.md
	pandoc -M date="`(LANG=en_us_88591 date "+%B %e, %Y")`" -M title="PCP − Lecture $(basename $<)" -o $@ ../../templates/preamble.yaml  $<
	

%.pdf:	%.md
	pandoc --pdf-engine=xelatex -M date="`(LANG=en_us_88591 date "+%B %e, %Y")`"  --include-in-header ../../templates/head_notes.tex -M title="PCP − Lecture $(basename $<)" -o $@ ../../templates/preamble.yaml  $<

clean:
	rm -f *.html *.pdf *.docx

# pandoc --pdf-engine=xelatex --default-image-extension=pdf --toc -M date="$$(LANG=en_us_88591 date '+%B  %e, %Y (%r)')" -M title="PCP − Lecture $(basename $<)" -o $@ ../../templates/preamble.yaml $<
