3 .\" A simple set of macros to provide HTML documents with basic
4 .\" www functionality. It should work with any macro set.
10 .if '\*[.T]'html' .nr www-html 1
13 . \" remove the title command when we are generating images for html
14 . \" (stops a title accidentally appearing inside an image)
22 .\" the main auxiliary macro for the HTML interface
25 . if \\n[www-html] \{\
26 . \" the following line makes the vertical mode leave, so to say
39 .\" BODYCOLOR - $1 is foreground color
40 .\" $2 is background color
41 .\" $3 is the color of an active hypertext link
42 .\" $4 is the color of a hypertext link not yet visited
43 .\" $5 is the color of a visited hypertext link
46 . HTML <body text=\\$1 bgcolor=\\$2 link=\\$3 alink=\\$4 vlink=\\$5>
49 .\" BACKGROUND - $1 is the background image file
52 . HTML <body background=\\$1>
55 .\" URL - $1 is the classical underlined blue text
57 .\" $3 is optional stuff printed immediately after $3
61 . HTML <a href="\\$2">\\$1</a>\\$3
63 . nop \m[blue]\\$1\mP \%\[la]\fC\\$2\fP\[ra]\\$3
66 .\" FTP - $1 is the classical underlined blue text
68 .\" $3 is optional stuff printed immediately after $2
72 . HTML <a href=\\$2>\\$1</a>\\$3
74 . nop \m[blue]\\$1\mP \%\[la]\fC\\$2\fP\[ra]\\$3
77 .\" MAILTO - generate html email reference
78 .\" $1 is the email address (without the `mailto:' prefix)
79 .\" $2 is the optional name
80 .\" $3 is optional stuff printed immediately after $2 (resp. $1)
84 .\" Foobar has been written by
85 .\" .MAILTO fred@foo.bar "Fredrick Bloggs" .
89 .\" force reset after a potential heading by performing some motion..
90 .\" how do we do this --fixme--
91 .\" \h'\w' ''\h'-\w' '' doesn't work..
92 . ie \\n[www-html] \{\
94 . HTML "<a href=mailto:\\$1>\\$1</a>\\$3"
96 . HTML "<a href=mailto:\\$1>\\$2</a>\\$3"
100 . nop \m[blue]\fC\\$1\fP\mP\\$3
102 . nop \m[blue]\\$2\mP \%\[la]\fC\\$1\fP\[ra]\\$3
106 .\" TAG - generate an html name $1
109 . HTML <a name="\\$1"></a>
112 .\" IMAGE - reference an image
113 .\" $1 is the image file
114 .\" $2 is the alignment r, l or c (centered by default)
115 .\" $3 is the x width (default if absent is 400 pixels)
116 .\" $4 is the y width (default if absent is the x value)
119 . ie \\n[www-html] \{\
121 . HTML-TAG ".right-image"
124 . HTML-TAG ".left-image"
126 . HTML-TAG ".centered-image"
131 . nr www-height \\n[www-width]
134 . HTML <img src="\\$1" width=\\n[www-width] height=\\n[www-height]>
138 . nop \[la]\fC\\$1\fP\[ra]
143 .\" HTML-TAG - emit a tag for the grohtml
146 . if \\n[www-html] \{\
147 . \" the following line makes the vertical mode leave, so to say
149 . nop \X^html-tag:\\$*^
153 .\" LINKS - emit the automatically collected links derived from
154 .\" section/numbered headings at this position.
160 .\" LINE - produce a horizontal line
167 .\" NO-AUTO-RULE - suppresses the generation of the top and bottom rules
168 .\" which grohtml emits by default.
171 . HTML-TAG ".no-auto-rule"
174 .\" www-end-nowhere - end of input trap called to finish diversion.
180 .\" HTML-TL - generate a HTML title only
181 .\" which differs from the -ms .TL which generates
182 .\" both a HTML title and a H1 heading.
183 .\" This is useful when an author wishes to use a HTML title
184 .\" as search engine fodder but use a graphic in the document.
187 . HTML-TAG ".html-tl"
188 . if !\\n[www-html] \{\
190 . it 2 www-end-nowhere
194 .ds www-level1 \[bu]\ \ \"
195 .ds www-level2 \[sq]\ \ \"
196 .ds www-level3 \[ci]\ \ \"
200 .\" auxiliary macro for UL-BEGIN
204 . if (\\n[www-level] > 3) \
205 . @error "too many levels of indentation (\\n[www-level])"
208 .\" auxiliary macro for UL-END
211 . if !\\n[www-level] \
212 . @error "trying to terminate a list which does not exist"
217 .\" start an unordered list
225 . in +\w'\\*[www-level\\n[www-level]]'
229 .\" end an unordered list
236 . in -\w'\\*[www-level\\n[www-level]]'
241 .\" insert a list item
248 . ti -\w'\\*[www-level\\n[www-level]]'
249 . nop \\*[www-level\\n[www-level]]\c
253 .\" supplementary macros used by other macro sets
255 .\" here are some tags specially for -Tps or -Thtml when invoked by pre-html
256 .\" to generate png images from postscript.
258 .\" www-do-image - tells troff to issue an image marker which can be
259 .\" read back by pre-html
263 . nop \O[3]\O[5\\$2\\$1.png]\O[0]\O[1]
265 . nop \O[3]\O[5\\$2\\$1.png]\O[0]
268 .\" HTML-IMAGE-END - terminates an image for html
272 . nop \O[2]\O[1]\O[4]
274 . nop \O[2]\O[1]\O[4]
280 .\" www-make-unique-name - generates another unique name in string
281 .\" `www-unique-name'
283 .de www-make-unique-name
285 . ds www-unique-name \\n[.F]-auto-\\n[www-png-no]\"
288 .\" HTML-IMAGE - is the same name as a tag generated from eqn/tbl/pic.
289 .\" Although the tags generated via the preprocessor
290 .\" are given image names by pre-html and troff.
291 .\" The macros below can only be invoked by *other macro sets*
292 .\" not user troff input since the contents of macro sets are
293 .\" not seen by pre-html.
296 . \" generates a centered image
297 . www-make-unique-name
298 . www-do-image \\*[www-unique-name] c
302 . www-make-unique-name
303 . www-do-image \\*[www-unique-name] r
307 . www-make-unique-name
308 . www-do-image \\*[www-unique-name] l
311 .de HTML-IMAGE-INLINE
312 . www-make-unique-name
313 . www-do-image \\*[www-unique-name] i