Better make script and started building the html templates

This commit is contained in:
James Gregory 2014-01-07 14:53:05 +11:00
commit d403553e28
4 changed files with 149 additions and 17 deletions

51
html/book.css Normal file
View file

@ -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;
}

64
html/template.html Normal file
View file

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html$if(lang)$ lang="$lang$"$endif$>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
$for(author-meta)$
<meta name="author" content="$author-meta$">
$endfor$
$if(date-meta)$
<meta name="dcterms.date" content="$date-meta$">
$endif$
<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
<link type="text/css" rel="stylesheet" href="book.css" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
$if(quotes)$
<style type="text/css">q { quotes: "“" "”" "" ""; }</style>
$endif$
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
$for(css)$
<link rel="stylesheet" href="$css$">
$endfor$
$if(math)$
$math$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
$for(include-before)$
$include-before$
$endfor$
$if(title)$
<header>
<h1 class="title">$title$</h1>
$if(subtitle)$
<h1 class="subtitle">$subtitle$</h1>
$endif$
$for(author)$
<h2 class="author">$author$</h2>
$endfor$
$if(date)$
<h3 class="date">$date$</h3>
$endif$
</header>
$endif$
$if(toc)$
<nav id="$idprefix$TOC">
$toc$
</nav>
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
</body>
</html>

BIN
images/cover.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -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