Forgot to commit the untranslated files in "es".
[gitmagic/gitmagic.git] / makeover
blob85b36ee1fa85152c356a02eb8d18101611cc24be
1 #!/bin/bash
3 # Extract table of contents from index.html and delete preface link.
4 BOOKDIR=book
5 TITLE="Git Magic"
6 gawk '
7 /<div class="toc">/ {
8 print $0
9 getline
10 print $0
11 print "<li><b>'"$TITLE"'</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 # Prepend "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 and add div section with class content for CSS.
32 sed '/<body/{n; r toc.tmp
33 a <div class="content">
34 } ' -i $FILE
35 sed '/^<\/body/i </div>' -i $FILE
37 done
39 sed '/^<\/body/i </div><div class="footer"><a href="/~blynn/">My Homepage</a></div>' -i $BOOKDIR/*.html
41 cp $BOOKDIR/pr01.html $BOOKDIR/index.html
42 rm toc.tmp