tg.sh: make "tg help st" work
[topgit/pro.git] / create-html.sh
blobaf3088f8233fe77c5541462da699d7790aaded0b
1 #!/bin/sh
3 # Create the tg-foo.html files which contain a relocation to topgit.html#tg-foo
5 # Some command line "helpers" that open html files refuse to pass along an
6 # anchor attached to a file:///... URL or bare /file... name. Since all our
7 # HTML help is in one file with anchors, we create small helper .html files
8 # that redirect to the main file and the proper anchor.
10 if [ $# -ne 1 ] ; then
11 echo "Usage: $0 <tgcommand>" 1>&2
12 exit 1
15 anchor=
16 [ "$1" = "tg" ] || anchor="#tg-$1"
17 cat <<EOT > tg-"$1".html
18 <?xml version="1.0" encoding="utf-8" ?>
19 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
20 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
21 <head>
22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
23 <meta http-equiv="Refresh" content="0;URL='topgit.html$anchor'" />
24 <title>tg help $1</title>
25 </head>
26 <body>
27 <p>Click <a href="topgit.html$anchor">here</a> if your browser does not automatically redirect you.</p>
28 </body>
29 </html>
30 EOT
32 # vim:noet