3 # Extract table of contents from index.html and delete preface link.
17 print "<li><b>'"$TITLE"'</b></li>"
19 while (!match($0, "</div>")) {
20 gsub("pr01.html", "index.html")
27 ' < $BOOKDIR/index.html
> toc.tmp
29 # For every file except the index...
30 for FILE
in $BOOKDIR/*.html
32 sed '/<title>/a <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">' -i $FILE
33 if [ $FILE != "$BOOKDIR/index.html" ]
35 # Prepend "Git Magic - " to titles of all pages.
36 sed '/<title>/ s/<title>/&'"$TITLE"' - /' -i $FILE
37 sed 's/pr01\.html/index.html/g' -i $FILE
38 # Paste ToC into beginning and add div section with class content for CSS.
39 sed '/<body/{n; r toc.tmp
40 a <div class="content">
42 sed '/^<\/body/i </div>' -i $FILE
46 # Originally this link was "My Homepage". Since it appears on translations of
47 # the guide, I changed it to my name so it doesn't have to be translated.
48 sed '/^<\/body/i </div><div class="footer"><a href="/~blynn/">Ben Lynn</a></div>' -i $BOOKDIR/*.html
50 cp $BOOKDIR/pr01.html
$BOOKDIR/index.html