3 # Extract table of contents from index.html and delete preface link.
12 # Older AsciiDoc versions put newlines in their output.
13 # To get them to work with the following, first minify the HTML output.
14 cat $BOOKDIR/index.html \
15 |
grep -o '<div class="toc">.*' \
16 |
sed 's!</div>.*!</div>!' \
17 |
sed 's!<pr01.html\>!index.html!g' \
18 |
sed 's!<li>!<li><b>'"$TITLE"'</b></li>&!' \
21 # For every file except the index...
22 for FILE
in $BOOKDIR/*.html
24 sed '/<title>/a <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">' -i $FILE
25 if [ $FILE != "$BOOKDIR/index.html" ]
27 # Prepend "Git Magic - " to titles of all pages.
28 sed '/<title>/ s/<title>/&'"$TITLE"' - /' -i $FILE
29 sed 's/pr01\.html/index.html/g' -i $FILE
30 # Insert newline after `body` tag.
31 sed 's/<body[^>]*>/&\n/' -i $FILE
32 # Paste ToC into beginning and add div section with class content for CSS.
33 sed '/<body/{r toc.tmp
34 a <div class="content">
36 sed 's!</body>!</div>&!' -i $FILE
40 # Originally this link was "My Homepage". Since it appears on translations of
41 # the guide, I changed it to my name so it doesn't have to be translated.
42 sed '/^<\/body/i </div><div class="footer"><a href="/~blynn/">Ben Lynn</a></div>' -i $BOOKDIR/*.html
44 cp $BOOKDIR/pr01.html
$BOOKDIR/index.html