6 if test ! -d "$1" || test $# -lt 2; then
8 $0: HTML documentation generator for Open vSwitch
9 usage: $0 srcdir docfile...
11 The VERSION environment variable should be set to the Open vSwitch version.
12 Must be invoked from an Open vSwitch build directory.
13 Most conveniently invoked via "make dist-docs".
22 # Check for programs we'll need.
28 if test -x "$dir/$1"; then
33 echo >&2 "$0: $1 not found in \$PATH, please install and try again"
40 # Create dist-docs directory.
42 abs_distdir=`pwd`/dist-docs
47 ${MAKE-make} install-man mandir="$abs_distdir"/man
48 (cd $distdir && mv `find man -type f` . && rm -rf man)
49 manpages=`cd $distdir && echo *`
51 # Start writing index.html.
52 exec 3>$distdir/index.html
55 <meta charset="UTF-8"></head>
56 <link rel="stylesheet" type="text/css" href="style.css">
57 <title>Open vSwitch $VERSION Documentation</title>
59 <h1>Open vSwitch $VERSION Documentation</h1>
64 # Add top-level documentation to index.html, giving it .txt extensions so
65 # that the webserver doesn't serve it as Markdown and make your web browser
66 # try to invoke some kind of external helper you don't have installed.
68 # Also translate documentation to HTML.
71 title=`head -1 "$srcdir/$file"`
72 dir=$distdir/`dirname $file`; test -d "$dir" || mkdir "$dir"
75 cp "$srcdir/$file" "$distdir/$file.txt"
76 ln -s $(basename "$file.txt") "$distdir/$file"
79 <meta charset="UTF-8"></head>
80 <link rel="stylesheet" type="text/css" href="style.css">
81 <title>$file (Open vSwitch $VERSION)</title>
84 markdown "$distdir/$file.txt"
85 echo "</body></html>") > "$distdir/$file.html"
90 <td><a href="$file.html">HTML</a>, <a href="$file.txt">plain text</a></td>
96 cp "$srcdir/$file" "$distdir/$file"
101 <td><a href="$file">plain text</a></td>
108 # Add header for manpages to index.html.
115 # Add manpages to index.html, translating them into PDF, HTML, and plain text.
116 # The HTML is just slightly marked up from the plain text version; although
117 # groff supports better HTML output, on my system some of the OVS manpages
118 # cause the groff HTML output engine to segfault (!).
120 for manpage in $manpages; do
121 man -l -Tps $manpage | ps2pdf - > $manpage.pdf
122 GROFF_NO_SGR=1 man -l -Tutf8 $manpage | sed 's/.
\b//g' > $manpage.txt
123 (echo '<html><head><meta charset="UTF-8"></head><body><pre>'
124 GROFF_NO_SGR=1 man -l -Tutf8 $manpage | sed '
128 s,\(.\)
\b\1,<b>\1</b>,g
129 s,_
\b\(.\),<u>\1</u>,g'
130 echo '</pre></body></html>'
133 name=`echo $manpage | sed 's/\.\([0-9]\)$/(\1)/'`
134 echo " <tr><td>$name</td><td><a href=\"$manpage.pdf\">PDF</a>, <a href=\"$manpage.html\">HTML</a>, <a href=\"$manpage.txt\">plain text</a></td></tr>"
142 # Create CSS style file.
143 cat >$distdir/style.css <<'EOF'
144 div { vertical-align:top; }
146 vertical-align:baseline;
149 text-decoration: none;
163 font-family: Arial,Helvetica,sans-serif;
167 background-color:#f5f5f5;