Moved Personal Experience section to chapter on history.
[gitmagic/gitmagic.git] / makeover
blobe2995d018d50cc53a43fff6488b45c974a57693f
1 #!/bin/bash
3 # extract table of contents from index.html
4 # and delete preface link
5 BOOKDIR=book
6 gawk '
7 /<div class="toc">/ {
8 print $0
9 getline
10 print $0
11 print "<li><b>Git Magic</b></li>"
12 getline
13 while (!match($0, "</div>")) {
14 gsub("pr01.html", "index.html")
15 print $0
16 getline
18 print $0
19 exit
21 ' < $BOOKDIR/index.html > toc.tmp
23 # for every file except the index...
24 for FILE in $BOOKDIR/*.html
26 if [ $FILE != "$BOOKDIR/index.html" ]
27 then
28 # add "Git Magic - " to titles of all pages
29 sed '/<title>/ s/<title>/&Git Magic - /' -i $FILE
30 sed 's/pr01\.html/index.html/g' -i $FILE
31 # paste ToC into beginning
32 # and add div section with class content for CSS
33 sed '/<body/{n; r toc.tmp
34 a <div class="content">
35 } ' -i $FILE
36 sed '/^<\/body/i </div>' -i $FILE
38 done
40 sed '/^<\/body/i </div><div class="footer"><a href="/~blynn/">My Homepage</a></div>' -i $BOOKDIR/*.html
42 cp $BOOKDIR/pr01.html $BOOKDIR/index.html
43 rm toc.tmp