This repository has been archived by the owner on Feb 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
122 lines (104 loc) · 4.7 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
SHELL := /usr/bin/env bash
# configure engine
## LaTeX engine
### LaTeX workflow: pdf; xelatex; lualatex
latexmkEngine := pdf
### pandoc workflow: pdflatex; xelatex; lualatex
pandocEngine := pdflatex
## HTML
HTMLVersion := html5
## ePub
# ePubVersion := epub
# filter :=
CSSURL:=https://cdn.jsdelivr.net/gh/ickc/markdown-latex-css
# command line arguments
pandocArgCommon := -f markdown+autolink_bare_uris-fancy_lists --toc -V linkcolorblue -V citecolor=blue -V urlcolor=blue -V toccolor=blue --pdf-engine=$(pandocEngine) -M date="`date "+%B %e, %Y"`"
# Workbooks
## MD
pandocArgMD := -f markdown+abbreviations+autolink_bare_uris+markdown_attribute+mmd_header_identifiers+mmd_link_attributes+mmd_title_block+tex_math_double_backslash-latex_macros-auto_identifiers -t markdown+raw_tex-native_spans-simple_tables-multiline_tables-grid_tables-latex_macros -s --wrap=none --column=999 --atx-headers --reference-location=block --file-scope
## TeX/PDF
### LaTeX workflow
latexmkArg := -$(latexmkEngine)
pandocArgFragment := $(pandocArgCommon) # --filter=$(filter)
### pandoc workflow
pandocArgStandalone := $(pandocArgFragment) --toc-depth=1 -s -N
## HTML/ePub
pandocArgHTML := $(pandocArgFragment) -t $(HTMLVersion) --toc-depth=2 -s -N -c $(CSSURL)/css/common.min.css -c $(CSSURL)/fonts/fonts.min.css
pandocArgePub := $(pandocArgHTML) -t $(ePubVersion) --epub-chapter-level=2
# GitHub README
pandocArgReadmeGitHub := $(pandocArgFragment) --toc-depth=2 -s -t markdown_github --reference-location=block
pandocArgReadmePypi := $(pandocArgFragment) -s -t rst --reference-location=block -f markdown+autolink_bare_uris-fancy_lists-implicit_header_references
# test := $(wildcard tests/*.md)
# testNative := $(patsubst %.md,%.native,$(test))
# testPdf := $(patsubst %.md,%.pdf,$(test))
# testAll := $(testNative) $(testPdf)
docs := $(wildcard docs/*.md)
# docsHtml := $(patsubst %.md,%.html,$(docs))
# docsPdf := $(patsubst %.md,%.pdf,$(docs))
docsAll := docs/index.html README.md README.rst README.html # $(docsHtml) $(docsPdf)
# Main Targets ########################################################################################################################################################################################
# all: $(testAll) $(docsAll)
docs: $(docsAll)
readme: docs
test: pep8 pylint # pytest
# coverage html
clean:
rm -f .coverage README.html # $(testAll)
rm -rf htmlcov pandocpm.egg-info build dist
find . -type f -name "*.py[co]" -delete -or -type d -name "__pycache__" -delete
Clean:
rm -f .coverage README.html $(docsAll) # $(testAll)
rm -rf htmlcov pandocpm.egg-info build dist
find . -type f -name "*.py[co]" -delete -or -type d -name "__pycache__" -delete
# Making dependancies #################################################################################################################################################################################
# %.native: %.md # $(filter)
# pandoc -t native -o $@ $< # -F $(filter)
# %.pdf: %.md # $(filter)
# pandoc $(pandocArgStandalone) -o $@ $<
%.html: %.md # $(filter)
pandoc $(pandocArgHTML) $< -o $@
# readme
## index.html
docs/index.html: docs/badges.markdown docs/README.md
pandoc $(pandocArgHTML) $^ -o $@
## GitHub README
README.md: docs/badges.markdown docs/README.md
printf "%s\n\n" "<!--This README is auto-generated from \`docs/README.md\`. Do not edit this file directly.-->" > $@
pandoc $(pandocArgReadmeGitHub) $^ >> $@
## PyPI README
README.rst: docs/badges.markdown docs/README.md
printf "%s\n\n" ".. This README is auto-generated from \`docs/README.md\`. Do not edit this file directly." > $@
pandoc $(pandocArgReadmePypi) $^ >> $@
README.html: README.rst
rst2html.py $< > $@
# maintenance #########################################################################################################################################################################################
# Deploy to PyPI
## by Travis, properly git tagged
pypi:
git tag -a v$$(python setup.py --version) -m 'Deploy to PyPI' && git push origin v$$(python setup.py --version)
## Manually
pypiManual:
python setup.py register -r pypitest && python setup.py sdist upload -r pypitest && python setup.py register -r pypi && python setup.py sdist upload -r pypi
# init:
# pip install -r requirements.txt
# pip install -r tests/requirements.txt
pytest: # $(testNative)
python3 -m pytest -vv --cov=pandocpm tests
pytestLite:
python3 -m pytest -vv --cov=pandocpm tests
# check python styles
pep8:
pep8 . --ignore=E402,E501,E731
pep8Strict:
pep8 .
pyflakes:
pyflakes .
flake8:
flake8 .
pylint:
pylint pandocpm/__main__.py
# cleanup python
autopep8:
autopep8 . --recursive --in-place --pep8-passes 2000 --verbose
autopep8Aggressive:
autopep8 . --recursive --in-place --pep8-passes 2000 --verbose --aggressive --aggressive