-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmd2all.bat
More file actions
60 lines (46 loc) · 2.89 KB
/
md2all.bat
File metadata and controls
60 lines (46 loc) · 2.89 KB
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
@REM Go to source foder as links in markdown files are relative from that folder:
pushd source
@REM To define only in one place, define some variables:
set front=front-matter.md
set content=chapter1.md chapter2.md chapter3.md chapter4.md chapter5.md chapter6.md chapter7.md chapter8.md bonus-chapter.md back-matter.md
@REM Create folders:
if not exist ..\output mkdir ..\output
if not exist ..\output\web mkdir ..\output\web
@REM Build HTML:
pandoc --split-level 1 -t chunkedhtml -s %front% %content% -o ../output/web/ebh --toc --section-divs --lua-filter ../styling/pagebreak.lua --lua-filter ../styling/html-open-links-in-new-tab.lua --lua-filter ../styling/html-lazy-images.lua --template ../styling/html-template.html
@REM Replacing index.html with licence.html:
del ..\output\web\ebh\index.html
rename ..\output\web\ebh\1-license.html index.html
sed -i 's/1-license.html/index.html/g' ../output/web/ebh/*.html
@REM Include styling and images in the output folder:
cp -r ../styling ../output/web
cp -r ../images ../output/web
@REM Remove unnecessary files from WEB output folder:
rm ../output/web/styling/*.sty
rm ../output/web/styling/*.tex
rm ../output/web/styling/*.lua
rm ../output/web/styling/html-template.html
@REM Build EPUB:
pandoc -s %front% %content% -o ../output/ebh.epub --toc -c ../styling/epub-styling.css --lua-filter ../styling/pagebreak.lua
@REM Copy EPUB to web folder:
cp ../output/ebh.epub ../output/web/ebh/ebh.epub
@REM Build print PDF:
pandoc -s %front% -o ../output/ebh-print-front.pdf --columns 55 -H ../styling/pdf-print-latex-options.sty --lua-filter ../styling/pdf-center-images.lua --template ../styling/pdf-print-front-template.tex
pandoc -s %content% -o ../output/ebh-print-content.pdf --columns 55 -H ../styling/pdf-print-latex-options.sty --lua-filter ../styling/pdf-center-images.lua --lua-filter ../styling/pdf-table-size.lua --toc
pdflatex -job-name=ebh-print -output-directory=../output/ ../styling/pdf-print-merge.tex
del ..\output\ebh-print-front.pdf
del ..\output\ebh-print-content.pdf
del ..\output\ebh-print.aux
del ..\output\ebh-print.log
@REM Build standalone PDF:
pandoc -s %front% -o ../output/ebh-standalone-front.pdf --columns 55 -H ../styling/pdf-standalone-latex-options.sty --lua-filter ../styling/pdf-center-images.lua --template ../styling/pdf-standalone-front-template.tex
pandoc -s %content% -o ../output/ebh-standalone-content.pdf --columns 55 -H ../styling/pdf-standalone-latex-options.sty --lua-filter ../styling/pdf-center-images.lua --lua-filter ../styling/pdf-table-size.lua --toc
pdflatex -job-name=ebh-standalone -output-directory=../output/ ../styling/pdf-standalone-merge.tex
del ..\output\ebh-standalone-front.pdf
del ..\output\ebh-standalone-content.pdf
del ..\output\ebh-standalone.aux
del ..\output\ebh-standalone.log
@REM Copy standalone PDF to web folder:
cp ../output/ebh-standalone.pdf ../output/web/ebh/ebh-standalone.pdf
@REM Go back to the original folder:
popd