Fix the help tests
[tig.git] / tools / update-release-docs.sh
blobdf163773df33199e655b6029317e16432bc0c0ab
1 #!/bin/sh
3 # Prepare documentation for http://jonas.nitro.dk/tig/
5 # Copyright (c) 2009-2014 Jonas Fonseca <jonas.fonseca@gmail.com>
7 LATEST="$(git describe | sed 's/-[0-9]*-g[0-9a-f]*//')"
8 DOCDIR="doc/release-docs/"
10 TRACKER="
11 <script type=\"text/javascript\">
12 var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");
13 document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));
14 </script>
15 <script type=\"text/javascript\">
16 try {
17 var pageTracker = _gat._getTracker(\"UA-7492166-1\");
18 pageTracker._trackPageview();
19 } catch(err) {}</script>
22 mkdir -p "$DOCDIR/releases"
24 for file in doc/tig.1.html doc/tigrc.5.html doc/manual.html README.html NEWS.html INSTALL.html; do
26 git cat-file blob release:$file > tmp
27 grep -v '</body>' < tmp | grep -v '</html>'
28 echo "$TRACKER"
29 if grep -q '</body>' tmp; then
30 echo "</body></html>"
32 } > "$DOCDIR/$(basename "$file")"
33 done
35 mv "$DOCDIR/README.html" tmp
38 head -n 1 < tmp
39 cat <<EOF
40 <h1>Tig Releases</h1>
41 <p>Latest version of tig is <b>
42 <a href="$LATEST.tar.gz">$LATEST</a>
43 <a href="$LATEST.tar.gz.md5">(md5)</a></b>.</p>
44 <p>See <a href="../NEWS.html">the release notes</a>
45 for information about each release.</p>
46 </div>
47 $TRACKER
48 EOF
49 } > "$DOCDIR/releases/HEADER.html"
51 head -n 2 < tmp > "$DOCDIR/HEADER.html"
52 sed -n '3,$p' < tmp > "$DOCDIR/README.html"
53 rm tmp