diff --git a/html/book.css b/html/book.css new file mode 100644 index 0000000..e065b10 --- /dev/null +++ b/html/book.css @@ -0,0 +1,51 @@ +body { + font: large/1.556 "Libertine", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif; + margin: 5%; + word-spacing: 0.1em; +} + +code { + font: medium Consolas, "Andale Mono", Monaco, "Liberation Mono", "Bitstream Vera Sans Mono", "DejaVu Sans Mono", monospace; + white-space: pre; +} + +h1 { + font-size: 266.7%; + line-height: 1.1; + margin: 1.49em 0; + text-align: center; +} + +h2 { + font-size: 210%; + line-height: 1.3125; + margin: 1.167em 0; + text-align: center; + text-align: left; +} + +h3, h4, h5, h6 { + text-align: left; +} + +h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { + color: inherit; + text-decoration: none; +} + +pre, table { + overflow: scroll; + width: 100%; +} + +pre { + line-height: 1em; +} + +pre code { + font-size: small; +} + +nav#TOC > ul, nav#TOC > ul > li > ul { + list-style: decimal; +} diff --git a/html/template.html b/html/template.html new file mode 100644 index 0000000..53b01f7 --- /dev/null +++ b/html/template.html @@ -0,0 +1,64 @@ + + + + + + +$for(author-meta)$ + +$endfor$ +$if(date-meta)$ + +$endif$ + $if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ + + +$if(quotes)$ + +$endif$ +$if(highlighting-css)$ + +$endif$ +$for(css)$ + +$endfor$ +$if(math)$ + $math$ +$endif$ +$for(header-includes)$ + $header-includes$ +$endfor$ + + +$for(include-before)$ +$include-before$ +$endfor$ +$if(title)$ +
+

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +

$author$

+$endfor$ +$if(date)$ +

$date$

+$endif$ +
+$endif$ +$if(toc)$ + +$endif$ +$body$ +$for(include-after)$ +$include-after$ +$endfor$ + + diff --git a/images/cover.jpg b/images/cover.jpg new file mode 100644 index 0000000..b6fbfd7 Binary files /dev/null and b/images/cover.jpg differ diff --git a/make-epub.sh b/make.sh similarity index 58% rename from make-epub.sh rename to make.sh index 23ad7fa..2545149 100755 --- a/make-epub.sh +++ b/make.sh @@ -1,19 +1,36 @@ #!/usr/bin/env bash -pandoc -S -o black-book.epub --toc --epub-chapter-level=2 \ - intro.md about.md about_author.md \ - chapter-01.md chapter-02.md chapter-03.md chapter-04.md chapter-05.md \ - chapter-06.md chapter-07.md chapter-08.md chapter-09.md chapter-10.md \ - chapter-11.md chapter-12.md chapter-13.md chapter-14.md chapter-15.md \ - chapter-16.md chapter-17.md chapter-18.md chapter-19.md chapter-20.md \ - chapter-21.md chapter-22.md chapter-23.md chapter-24.md chapter-25.md \ - chapter-26.md chapter-27.md chapter-28.md chapter-29.md chapter-30.md \ - chapter-31.md chapter-32.md chapter-33.md chapter-34.md chapter-35.md \ - chapter-36.md chapter-37.md chapter-38.md chapter-39.md chapter-40.md \ - chapter-41.md chapter-42.md chapter-43.md chapter-44.md chapter-45.md \ - chapter-46.md chapter-47.md chapter-48.md chapter-49.md chapter-50.md \ - chapter-51.md chapter-52.md chapter-53.md chapter-54.md chapter-55.md \ - chapter-56.md chapter-57.md chapter-58.md chapter-59.md chapter-60.md \ - chapter-61.md chapter-62.md chapter-63.md chapter-64.md chapter-65.md \ - chapter-66.md chapter-67.md chapter-68.md chapter-69.md chapter-70.md \ - appendix-a.md +set -e + +TYPE=$1 +FILES='intro.md about.md about_author.md + chapter-01.md chapter-02.md chapter-03.md chapter-04.md chapter-05.md + chapter-06.md chapter-07.md chapter-08.md chapter-09.md chapter-10.md + chapter-11.md chapter-12.md chapter-13.md chapter-14.md chapter-15.md + chapter-16.md chapter-17.md chapter-18.md chapter-19.md chapter-20.md + chapter-21.md chapter-22.md chapter-23.md chapter-24.md chapter-25.md + chapter-26.md chapter-27.md chapter-28.md chapter-29.md chapter-30.md + chapter-31.md chapter-32.md chapter-33.md chapter-34.md chapter-35.md + chapter-36.md chapter-37.md chapter-38.md chapter-39.md chapter-40.md + chapter-41.md chapter-42.md chapter-43.md chapter-44.md chapter-45.md + chapter-46.md chapter-47.md chapter-48.md chapter-49.md chapter-50.md + chapter-51.md chapter-52.md chapter-53.md chapter-54.md chapter-55.md + chapter-56.md chapter-57.md chapter-58.md chapter-59.md chapter-60.md + chapter-61.md chapter-62.md chapter-63.md chapter-64.md chapter-65.md + chapter-66.md chapter-67.md chapter-68.md chapter-69.md chapter-70.md + appendix-a.md' + +[ -d "out" ] || mkdir out + +if [[ "$TYPE" == "epub" || "$TYPE" == "" ]]; then + pandoc -S --to epub3 -o out/black-book.epub --toc --epub-chapter-level=2 --epub-cover-image=images/cover.jpg $FILES +elif [[ "$TYPE" == "html" ]]; then + rm -rf out/html + mkdir out/html + cp -r images out/html/ + cp html/book.css out/html/ + pandoc -S --to html5 -o out/html/black-book.html --section-divs --toc --standalone --template=html/template.html $FILES +else + echo 'Unknown type' + exit 1 +fi