1#!/bin/sh
2# filter to convert Tk and Tcl man pages to html equivalents
3# does not do any linking !!!!
4
5TOP=`pwd`
6if [ $# -eq 0 ] ; then
7    echo "Usage $0 filename"
8    exit
9fi
10
11cat  $1 | 
12    sed  -e 's/\\-/-/g' \
13         -e 's/\\[0&]/  /g' \
14         -e 's/&/\&/g' \
15         -e 's/</\&lt;/g' \
16         -e 's/>/\&gt;/g' \
17         -e 's/\\|//g' \
18         -e 's/\\e/\\/g'     |
19    /usr/bin/nawk -f ${TOP}/tk2html.awk | 
20     sed -e 's^\\fB\([^\\]*\)\\fR^<B>\1</B>^g' \
21        -e 's^\\fI\(.[^\\]*\)\\fR^<I>\1</I>^g' \
22        -e 's^\\fB^<B>^g' \
23        -e 's^\\fI^<I>^g' \
24        -e 's^\\f[RP]^</B></I>^g' \
25        -e 's/^.[LP]P/<P>/' \
26        -e 's/^.br/<BR>/' \
27        -e 's/^\.DS.*/<pre>/' \
28        -e 's$^\.DE.*$</pre>$' \
29        -e 's/^\.nf */<table>/' \
30        -e 's$^\.fi *$</table>$' \
31        -e 's$^\.BE *$</pre><HR>$' \
32        -e 's/^\.RS.*/<UL>/' \
33        -e 's$^\.RE.*$</UL>$' \
34        -e 's^\.SH *"*\([^"]*\)"*^</pre><H2>\1</H2>^' \
35        -e 's/^\.[a-zA-Z]*.*//' \
36        -e 's/^`\\\".*//' |
37    /usr/bin/nawk -f ${TOP}/tk2html2.awk 
38
39# The above handling for font mapping to html works correctly in about 95% of 
40# the cases, the others turn out stacking the font setting so you get the 
41# font bleeding since it isn't being turned # off in the correct places. 
42# To correct we would have to record the current ( non-default) font and 
43# explicitly turn it off when another font change is detected.
44# Which would make multiple styles impossible concurrently which seems to
45# be the case anyway....
46
47