Blame


1 37052ddc 2006-03-19 devnull .TH HTMLROFF 7
2 37052ddc 2006-03-19 devnull .SH NAME
3 37052ddc 2006-03-19 devnull htmlroff \- HTML formatting and typesetting
4 37052ddc 2006-03-19 devnull .SH DESCRIPTION
5 d32deab1 2020-08-16 rsc .MR Htmlroff (1)
6 37052ddc 2006-03-19 devnull accepts
7 37052ddc 2006-03-19 devnull .I troff
8 37052ddc 2006-03-19 devnull input with a few extensions and changes.
9 37052ddc 2006-03-19 devnull This manual describes the changes to the input language,
10 37052ddc 2006-03-19 devnull assuming a working knowledge of
11 37052ddc 2006-03-19 devnull .I troff
12 37052ddc 2006-03-19 devnull itself.
13 37052ddc 2006-03-19 devnull .SS Name lengths
14 37052ddc 2006-03-19 devnull .PP
15 37052ddc 2006-03-19 devnull Request, macro, string, and number names can be longer
16 37052ddc 2006-03-19 devnull than two letters, as in:
17 37052ddc 2006-03-19 devnull .IP
18 37052ddc 2006-03-19 devnull .EX
19 37052ddc 2006-03-19 devnull \&.html c <center>
20 37052ddc 2006-03-19 devnull \&.de footnote
21 37052ddc 2006-03-19 devnull Footnote here.
22 37052ddc 2006-03-19 devnull \&..
23 37052ddc 2006-03-19 devnull \&.footnote
24 37052ddc 2006-03-19 devnull \&.ds string "hello
25 37052ddc 2006-03-19 devnull \&\e*[string]
26 37052ddc 2006-03-19 devnull \&.nr number 1
27 37052ddc 2006-03-19 devnull \&\en[number]
28 37052ddc 2006-03-19 devnull .EE
29 37052ddc 2006-03-19 devnull .SS HTML output
30 37052ddc 2006-03-19 devnull .PP
31 37052ddc 2006-03-19 devnull Two new requests:
32 37052ddc 2006-03-19 devnull .IP
33 37052ddc 2006-03-19 devnull .EX
34 37052ddc 2006-03-19 devnull \&.html \fIid\fP \fR[ \fI<html>\fP ]\fL
35 37052ddc 2006-03-19 devnull \&.ihtml \fIid\fP \fR[ \fI<ihtml>\fP ]\fL
36 37052ddc 2006-03-19 devnull .EE
37 37052ddc 2006-03-19 devnull .LP
38 37052ddc 2006-03-19 devnull .B .html
39 37052ddc 2006-03-19 devnull and
40 37052ddc 2006-03-19 devnull .B .ihtml
41 37052ddc 2006-03-19 devnull insert HTML into the output.
42 37052ddc 2006-03-19 devnull The requests are only for opening new HTML tags.
43 37052ddc 2006-03-19 devnull To close previously-opened tags, repeat the request
44 37052ddc 2006-03-19 devnull with the same
45 37052ddc 2006-03-19 devnull .IR id .
46 37052ddc 2006-03-19 devnull For example, the input:
47 37052ddc 2006-03-19 devnull .IP
48 37052ddc 2006-03-19 devnull .EX
49 37052ddc 2006-03-19 devnull \&.html t <table><tr>
50 37052ddc 2006-03-19 devnull \&.html td <td>Cell 1
51 37052ddc 2006-03-19 devnull \&.html td <td>Cell 2
52 37052ddc 2006-03-19 devnull \&.html td
53 37052ddc 2006-03-19 devnull \&.html t
54 b546bd6e 2017-07-16 rsc .EE
55 37052ddc 2006-03-19 devnull .LP
56 37052ddc 2006-03-19 devnull produces this output:
57 37052ddc 2006-03-19 devnull .IP
58 37052ddc 2006-03-19 devnull .EX
59 37052ddc 2006-03-19 devnull <table><tr><td>Cell 1</td><td>Cell 2</td></tr></table>
60 37052ddc 2006-03-19 devnull .EE
61 37052ddc 2006-03-19 devnull .LP
62 37052ddc 2006-03-19 devnull The
63 37052ddc 2006-03-19 devnull .B .html
64 37052ddc 2006-03-19 devnull request is intended for block-level HTML constructs (those that can contain
65 37052ddc 2006-03-19 devnull .BR <p> )
66 37052ddc 2006-03-19 devnull and maintains the HTML tag stack automatically.
67 37052ddc 2006-03-19 devnull Intermediate tags need not be explicitly closed:
68 37052ddc 2006-03-19 devnull removing the final
69 37052ddc 2006-03-19 devnull .B \&.html t
70 37052ddc 2006-03-19 devnull line in the example above would produce the same output.
71 37052ddc 2006-03-19 devnull The special
72 37052ddc 2006-03-19 devnull .I id
73 37052ddc 2006-03-19 devnull .L -
74 37052ddc 2006-03-19 devnull closes the HTML tags immediately after printing them.
75 37052ddc 2006-03-19 devnull .PP
76 37052ddc 2006-03-19 devnull The
77 37052ddc 2006-03-19 devnull .B .ihtml
78 37052ddc 2006-03-19 devnull request is similar to
79 37052ddc 2006-03-19 devnull .B .html
80 37052ddc 2006-03-19 devnull but is intended for inline HTML constructs such as
81 37052ddc 2006-03-19 devnull .B <b>
82 37052ddc 2006-03-19 devnull or
83 37052ddc 2006-03-19 devnull .B <i>
84 37052ddc 2006-03-19 devnull (those that can be contained
85 37052ddc 2006-03-19 devnull within
86 37052ddc 2006-03-19 devnull .BR <p> ).
87 37052ddc 2006-03-19 devnull Unlike
88 37052ddc 2006-03-19 devnull .BR .html ,
89 37052ddc 2006-03-19 devnull .B .ihtml
90 37052ddc 2006-03-19 devnull treats the open HTML tags as a set rather than a stack:
91 37052ddc 2006-03-19 devnull each must be explicitly closed.
92 37052ddc 2006-03-19 devnull Although it treats the tags as a set,
93 37052ddc 2006-03-19 devnull .B .ihtml
94 37052ddc 2006-03-19 devnull treats nesting properly in the output,
95 37052ddc 2006-03-19 devnull closing and reopening tags as necessary.
96 37052ddc 2006-03-19 devnull For example, the input:
97 37052ddc 2006-03-19 devnull .IP
98 37052ddc 2006-03-19 devnull .EX
99 37052ddc 2006-03-19 devnull \&.ihtml style <b>
100 37052ddc 2006-03-19 devnull \&.ihtml link <a href="link.html">
101 37052ddc 2006-03-19 devnull Bold
102 37052ddc 2006-03-19 devnull \&.ihtml style <i>
103 37052ddc 2006-03-19 devnull and italic, still linked.
104 37052ddc 2006-03-19 devnull \&.ihtml link <a>
105 37052ddc 2006-03-19 devnull Unlinked.
106 37052ddc 2006-03-19 devnull \&.ihtml style
107 37052ddc 2006-03-19 devnull .EE
108 37052ddc 2006-03-19 devnull .LP
109 37052ddc 2006-03-19 devnull produces this output:
110 37052ddc 2006-03-19 devnull .IP
111 37052ddc 2006-03-19 devnull .EX
112 37052ddc 2006-03-19 devnull <b><a href="link.html">Bold</a></b>
113 37052ddc 2006-03-19 devnull <i><a href="link.html">and italic, still linked.</i></a>
114 37052ddc 2006-03-19 devnull <i>Unlinked.</i>
115 37052ddc 2006-03-19 devnull .EE
116 37052ddc 2006-03-19 devnull .PP
117 37052ddc 2006-03-19 devnull Outside of
118 37052ddc 2006-03-19 devnull .B .html
119 37052ddc 2006-03-19 devnull and
120 37052ddc 2006-03-19 devnull .B .ihtml
121 37052ddc 2006-03-19 devnull requests, the characters
122 37052ddc 2006-03-19 devnull .L < ,
123 37052ddc 2006-03-19 devnull .L > ,
124 37052ddc 2006-03-19 devnull and
125 37052ddc 2006-03-19 devnull .L &
126 37052ddc 2006-03-19 devnull are treated as normal characters, not HTML markers,
127 37052ddc 2006-03-19 devnull and are translated to
128 37052ddc 2006-03-19 devnull .L &lt; ,
129 37052ddc 2006-03-19 devnull .L &gt; ,
130 37052ddc 2006-03-19 devnull and
131 37052ddc 2006-03-19 devnull .L &amp;
132 37052ddc 2006-03-19 devnull on output.
133 37052ddc 2006-03-19 devnull To embed the raw HTML markers, use
134 37052ddc 2006-03-19 devnull .L \e< ,
135 37052ddc 2006-03-19 devnull .L \e> ,
136 37052ddc 2006-03-19 devnull and
137 37052ddc 2006-03-19 devnull .L \e@
138 37052ddc 2006-03-19 devnull .RI [ sic ].
139 37052ddc 2006-03-19 devnull .SS Font changes
140 37052ddc 2006-03-19 devnull .PP
141 37052ddc 2006-03-19 devnull .I Htmlroff
142 37052ddc 2006-03-19 devnull interprets the usual
143 37052ddc 2006-03-19 devnull .BR \ef ,
144 37052ddc 2006-03-19 devnull .BR .ft ,
145 37052ddc 2006-03-19 devnull .BR \es ,
146 37052ddc 2006-03-19 devnull and
147 37052ddc 2006-03-19 devnull .B .ps
148 37052ddc 2006-03-19 devnull requests to change the font and point size.
149 37052ddc 2006-03-19 devnull After applying each such change to its internal registers,
150 37052ddc 2006-03-19 devnull .I htmlroff
151 37052ddc 2006-03-19 devnull invokes the
152 37052ddc 2006-03-19 devnull .B .font
153 37052ddc 2006-03-19 devnull macro to emit corresponding HTML.
154 37052ddc 2006-03-19 devnull The default definition of
155 37052ddc 2006-03-19 devnull .B .font
156 37052ddc 2006-03-19 devnull is:
157 37052ddc 2006-03-19 devnull .IP
158 37052ddc 2006-03-19 devnull .EX
159 37052ddc 2006-03-19 devnull \&.de font
160 37052ddc 2006-03-19 devnull \&.ihtml f1
161 37052ddc 2006-03-19 devnull \&.ihtml f
162 37052ddc 2006-03-19 devnull \&.ihtml f <span style=\"font-size=\\n(.spt\">
163 37052ddc 2006-03-19 devnull \&.if \\n(.f==2 .ihtml f1 <i>
164 37052ddc 2006-03-19 devnull \&.if \\n(.f==3 .ihtml f1 <b>
165 37052ddc 2006-03-19 devnull \&.if \\n(.f==4 .ihtml f1 <b><i>
166 37052ddc 2006-03-19 devnull \&.if \\n(.f==5 .ihtml f1 <tt>
167 37052ddc 2006-03-19 devnull \&.if \\n(.f==6 .ihtml f1 <tt><i>
168 37052ddc 2006-03-19 devnull \&..
169 37052ddc 2006-03-19 devnull .EE
170 37052ddc 2006-03-19 devnull .LP
171 37052ddc 2006-03-19 devnull Input files can redefine
172 37052ddc 2006-03-19 devnull .B .font
173 37052ddc 2006-03-19 devnull like any other request or macro.
174 37052ddc 2006-03-19 devnull .SS Paragraphs
175 37052ddc 2006-03-19 devnull .I Htmlroff
176 37052ddc 2006-03-19 devnull implements line height, text adjustment, and margins by
177 37052ddc 2006-03-19 devnull wrapping all output text in
178 37052ddc 2006-03-19 devnull .B <p style="...">
179 37052ddc 2006-03-19 devnull tags.
180 37052ddc 2006-03-19 devnull This behavior can be disabled by setting the
181 37052ddc 2006-03-19 devnull .B .paragraph
182 37052ddc 2006-03-19 devnull number register to zero.
183 37052ddc 2006-03-19 devnull Setting the
184 37052ddc 2006-03-19 devnull .B .margin
185 37052ddc 2006-03-19 devnull register to zero
186 37052ddc 2006-03-19 devnull eliminates only the margin annotations.
187 37052ddc 2006-03-19 devnull .SS Subscripts and superscripts
188 37052ddc 2006-03-19 devnull .PP
189 37052ddc 2006-03-19 devnull .I Htmlroff
190 37052ddc 2006-03-19 devnull interprets the
191 37052ddc 2006-03-19 devnull .BR \eu ,
192 37052ddc 2006-03-19 devnull .BR \ed ,
193 37052ddc 2006-03-19 devnull and
194 37052ddc 2006-03-19 devnull .BR \ev
195 37052ddc 2006-03-19 devnull requests to move vertically during output.
196 37052ddc 2006-03-19 devnull It emits output vertically offset up the page inside
197 37052ddc 2006-03-19 devnull .B <sup>
198 37052ddc 2006-03-19 devnull tags and output vertically offset down the page
199 37052ddc 2006-03-19 devnull inside
200 37052ddc 2006-03-19 devnull .B <sub>
201 37052ddc 2006-03-19 devnull tags.
202 37052ddc 2006-03-19 devnull This heuristic handles simple equations formatted by
203 d32deab1 2020-08-16 rsc .MR eqn (1) .
204 37052ddc 2006-03-19 devnull .SS Conditional input
205 37052ddc 2006-03-19 devnull .PP
206 37052ddc 2006-03-19 devnull To make it easier to write input files that can be formatted by both
207 37052ddc 2006-03-19 devnull .I troff
208 37052ddc 2006-03-19 devnull and
209 37052ddc 2006-03-19 devnull .IR htmlroff ,
210 37052ddc 2006-03-19 devnull .I htmlroff
211 37052ddc 2006-03-19 devnull adds a new condition
212 37052ddc 2006-03-19 devnull .B h
213 37052ddc 2006-03-19 devnull which evaluates true in
214 37052ddc 2006-03-19 devnull .B .if
215 37052ddc 2006-03-19 devnull and
216 37052ddc 2006-03-19 devnull .B .ie
217 37052ddc 2006-03-19 devnull requests.
218 37052ddc 2006-03-19 devnull The
219 37052ddc 2006-03-19 devnull .B t
220 37052ddc 2006-03-19 devnull condition continues to evaluate true, to accomodate
221 37052ddc 2006-03-19 devnull input files trying to distinguish between
222 37052ddc 2006-03-19 devnull .I troff
223 37052ddc 2006-03-19 devnull and
224 37052ddc 2006-03-19 devnull .IR nroff .
225 37052ddc 2006-03-19 devnull To write a conditional matching
226 37052ddc 2006-03-19 devnull .I troff
227 37052ddc 2006-03-19 devnull alone, use
228 37052ddc 2006-03-19 devnull .RB ` ".if !h .if t" '.
229 37052ddc 2006-03-19 devnull .PP
230 37052ddc 2006-03-19 devnull .I Htmlroff 's
231 37052ddc 2006-03-19 devnull handling of conditional input does not match
232 37052ddc 2006-03-19 devnull .IR troff 's
233 37052ddc 2006-03-19 devnull exactly.
234 37052ddc 2006-03-19 devnull For example,
235 37052ddc 2006-03-19 devnull .IP
236 37052ddc 2006-03-19 devnull .EX
237 37052ddc 2006-03-19 devnull \&.if 0 \e{\e
238 37052ddc 2006-03-19 devnull \&.de xx
239 37052ddc 2006-03-19 devnull \&..
240 37052ddc 2006-03-19 devnull \&.\e}
241 37052ddc 2006-03-19 devnull .EE
242 37052ddc 2006-03-19 devnull .LP
243 37052ddc 2006-03-19 devnull redefines the
244 37052ddc 2006-03-19 devnull .B xx
245 37052ddc 2006-03-19 devnull macro in
246 37052ddc 2006-03-19 devnull .I troff
247 37052ddc 2006-03-19 devnull but not in
248 37052ddc 2006-03-19 devnull .IR htmlroff .
249 37052ddc 2006-03-19 devnull Do not write files depending on this behavior, as this bug may be fixed
250 37052ddc 2006-03-19 devnull in the future.
251 37052ddc 2006-03-19 devnull .I Htmlroff
252 37052ddc 2006-03-19 devnull also mishandles
253 37052ddc 2006-03-19 devnull .B \e}
254 37052ddc 2006-03-19 devnull in some cases. To work around them, use
255 37052ddc 2006-03-19 devnull .B .\e}
256 37052ddc 2006-03-19 devnull on a line by itself, as in the last example.
257 37052ddc 2006-03-19 devnull .SS Diversions
258 37052ddc 2006-03-19 devnull .PP
259 37052ddc 2006-03-19 devnull Diversions in
260 37052ddc 2006-03-19 devnull .I htmlroff
261 37052ddc 2006-03-19 devnull use the alignment in effect at the time of the
262 37052ddc 2006-03-19 devnull diversion
263 37052ddc 2006-03-19 devnull when output.
264 37052ddc 2006-03-19 devnull In particular,
265 37052ddc 2006-03-19 devnull .IP
266 37052ddc 2006-03-19 devnull .EX
267 37052ddc 2006-03-19 devnull \&.di xx
268 37052ddc 2006-03-19 devnull Line here.
269 37052ddc 2006-03-19 devnull \&.di
270 37052ddc 2006-03-19 devnull \&.nf
271 37052ddc 2006-03-19 devnull \&.ce
272 37052ddc 2006-03-19 devnull \&.xx
273 37052ddc 2006-03-19 devnull .EE
274 37052ddc 2006-03-19 devnull .LP
275 37052ddc 2006-03-19 devnull produces a centered line in
276 37052ddc 2006-03-19 devnull .I troff
277 37052ddc 2006-03-19 devnull but not in
278 37052ddc 2006-03-19 devnull .IR htmlroff .
279 37052ddc 2006-03-19 devnull The solution is to center inside the diversion, as in
280 37052ddc 2006-03-19 devnull .IP
281 37052ddc 2006-03-19 devnull .EX
282 37052ddc 2006-03-19 devnull \&.di xx
283 37052ddc 2006-03-19 devnull \&.if h .ce 999
284 37052ddc 2006-03-19 devnull Line here
285 37052ddc 2006-03-19 devnull \&.di
286 37052ddc 2006-03-19 devnull .EE
287 37052ddc 2006-03-19 devnull .SS Input pipes
288 37052ddc 2006-03-19 devnull .PP
289 37052ddc 2006-03-19 devnull .I Htmlroff
290 37052ddc 2006-03-19 devnull adds a new request
291 37052ddc 2006-03-19 devnull .B .inputpipe
292 37052ddc 2006-03-19 devnull .I stop
293 37052ddc 2006-03-19 devnull .I cmd
294 37052ddc 2006-03-19 devnull that redirects
295 37052ddc 2006-03-19 devnull .I htmlroff 's
296 37052ddc 2006-03-19 devnull input into a pipe to the
297 37052ddc 2006-03-19 devnull given
298 37052ddc 2006-03-19 devnull .I cmd .
299 37052ddc 2006-03-19 devnull The redirection stops on encountering the line
300 37052ddc 2006-03-19 devnull .IR stop ,
301 37052ddc 2006-03-19 devnull optionally followed by white space and extra text.
302 37052ddc 2006-03-19 devnull This is a dangerous and clusmy request, as
303 37052ddc 2006-03-19 devnull .I htmlroff
304 37052ddc 2006-03-19 devnull stops interpreting its input during the redirection, so
305 37052ddc 2006-03-19 devnull .I stop
306 37052ddc 2006-03-19 devnull must be found in the input itself, not in a macro that
307 37052ddc 2006-03-19 devnull the input might appear to call.
308 37052ddc 2006-03-19 devnull Although clusmy,
309 37052ddc 2006-03-19 devnull .B .inputpipe
310 37052ddc 2006-03-19 devnull allows input files to invoke
311 37052ddc 2006-03-19 devnull .I troff
312 37052ddc 2006-03-19 devnull to handle complicated input.
313 37052ddc 2006-03-19 devnull For example,
314 37052ddc 2006-03-19 devnull .B tmac.html
315 37052ddc 2006-03-19 devnull redefines the
316 37052ddc 2006-03-19 devnull .B PS
317 37052ddc 2006-03-19 devnull macro that marks the beginning of a
318 d32deab1 2020-08-16 rsc .MR pic (1)
319 37052ddc 2006-03-19 devnull picture:
320 37052ddc 2006-03-19 devnull .IP
321 37052ddc 2006-03-19 devnull .EX
322 37052ddc 2006-03-19 devnull \&.nr png -1 1
323 37052ddc 2006-03-19 devnull \&.de PS
324 37052ddc 2006-03-19 devnull \&.ds pngbase "\e\e*[basename]
325 37052ddc 2006-03-19 devnull \&.if '\e\e*[pngbase]'' .ds pngbase \e\en(.B
326 37052ddc 2006-03-19 devnull \&.ds pngfile \e\e*[pngbase]\e\en+[png].png
327 37052ddc 2006-03-19 devnull \&.html - <center><img src="\e\e*[pngfile]"></center>
328 37052ddc 2006-03-19 devnull \&.inputpipe .PE troff2png >\e\e*[pngfile]
329 37052ddc 2006-03-19 devnull \&..
330 37052ddc 2006-03-19 devnull .EE
331 37052ddc 2006-03-19 devnull .LP
332 37052ddc 2006-03-19 devnull This macro invokes the shell script
333 37052ddc 2006-03-19 devnull .I troff2png
334 37052ddc 2006-03-19 devnull to run troff and convert the Postscript
335 37052ddc 2006-03-19 devnull output to a PNG image file.
336 37052ddc 2006-03-19 devnull Before starting the program, the macro creates
337 37052ddc 2006-03-19 devnull a new file name for the image and prints
338 37052ddc 2006-03-19 devnull HTML referring to it.
339 37052ddc 2006-03-19 devnull The new
340 37052ddc 2006-03-19 devnull .B .B
341 37052ddc 2006-03-19 devnull register holds the final path element
342 37052ddc 2006-03-19 devnull (the base name) of the current input file.