groff: update vendor branch to v1.20.1
[dragonfly.git] / contrib / groff / tmac / www.tmac
CommitLineData
92d0a6a6
JR
1.ig
2www.tmac - macro package for adding HTML elements to roff documents.
3
4File position: <groff_source_top>/tmac/www.tmac
5Installed position: groff's main macro directory.
6
7------------------------------------------------------------------------
8 Legalize
9------------------------------------------------------------------------
10
11This file is part of groff, the GNU roff type-setting system.
12
4d3e9548
JL
13Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
14 Free Software Foundation, Inc.
92d0a6a6
JR
15written by Gaius Mulley <gaius@glam.ac.uk>, with additions by
16Werner Lemberg <wl@gnu.org> and Bernd Warken <bwarken@mayn.de>.
17
18groff is free software; you can redistribute it and/or modify it under
19the terms of the GNU General Public License as published by the Free
4d3e9548
JL
20Software Foundation, either version 3 of the License, or
21(at your option) any later version.
92d0a6a6
JR
22
23groff is distributed in the hope that it will be useful, but WITHOUT
24ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26for more details.
27
28You should have received a copy of the GNU General Public License
4d3e9548 29along with this program. If not, see <http://www.gnu.org/licenses/>.
92d0a6a6
JR
30
31
32------------------------------------------------------------------------
33 Description
34------------------------------------------------------------------------
35
4d3e9548
JL
36A simple set of macros to provide HTML (or XHTML) documents with basic
37www functionality. It should work with any macro set. In the following,
38HTML always denotes XHTML also.
92d0a6a6
JR
39..
40.
4d3e9548 41.
92d0a6a6
JR
42.\" --------------------------------------------------------------------
43.\" Setup
44.\" --------------------------------------------------------------------
45.
465b256c
JR
46.do if d www:lenstr .nx
47.
48.do mso devtag.tmac
49.
92d0a6a6
JR
50.nr _C \n(.C
51.cp 0
52.
465b256c 53.
4d3e9548
JL
54.ie r xhtml \
55. ds www-> />\"
56.el \
57. ds www-> >\"
58.
92d0a6a6 59.nr www-html 0
4d3e9548
JL
60.if '\*[.T]'html' \
61. nr www-html 1
92d0a6a6
JR
62.
63.\" set up www-image-template
64.
65.if !d www-image-template \
66. ds www-image-template
67.
68.if r ps4html \{\
4d3e9548 69. \" remove the title command when we are generating images for HTML
92d0a6a6
JR
70. \" (stops a title accidentally appearing inside an image)
71. di www-notitle
72. tl ''''
73. di
74. rm tl
75. de tl
76. .
77.\}
78.
79.
80.\" --------------------------------------------------------------------
81.\" Test for `.substring'; result in register `www.substring_ok'.
82.\" The automated break points in .URL addresses are only added if
83.\" this register is non-zero.
84.\"
85.nr www:substring_ok 0
86.de www:@test_substring
87. if !d substring \
88. return
89. ds \\$0:s abcdefg\"
90. substring \\$0:s 1 1
91. if !'\\*[\\$0:s]'b' \{\
92. rm \\$0:s
93. return
94. \}
95. ds \\$0:s abcdefg\"
96. substring \\$0:s 0 0
97. if !'\\*[\\$0:s]'a' \{\
98. rm \\$0:s
99. return
100. \}
101. ds \\$0:s abcdefg\"
102. substring \\$0:s 1 -1
103. if !'\\*[\\$0:s]'bcdefg' \{\
104. rm \\$0:s
105. return
106. \}
107. nr www:substring_ok 1
108. rm \\$0:s
109..
110.www:@test_substring
111.rm www:@test_substring
112.
113.
114.\" --------------------------------------------------------------------
115.\" Local Macros
116.\" --------------------------------------------------------------------
117.
118.\" --------------------------------------------------------------------
465b256c
JR
119.\" www:paraspace
120.\"
121.\" Space before paragraph. Use \n[PD] if it exists.
122.\"
123.nr www:pd 0.5v
4d3e9548 124.
465b256c 125.de www:paraspace
4d3e9548
JL
126. ie r PD \
127. sp \\n[PD]u
128. el \
129. sp \\n[www:pd]u
465b256c
JR
130..
131.
465b256c 132.\" --------------------------------------------------------------------
92d0a6a6
JR
133.\" www:error (<test>...)
134.\"
4d3e9548 135.\" Print error message.
92d0a6a6
JR
136.\"
137.de www-error
138. tm \\n[.F]:\\n[.c]: macro error: \\$*
139..
4d3e9548 140.
92d0a6a6
JR
141.als www:error www-error
142.
143.\" --------------------------------------------------------------------
144.\" www:lenstr (<register_name> <string_name>)
145.\"
146.\" Store length of string named <string_name> into register named
147.\" <register_name>.
148.\"
149.de www:lenstr
150. if !(\\n[.$] == 2) \{\
151. tm .\\$0 expects 2 arguments.
152. ab
153. \}
154. length \\$0:n x\\*[\\$2]
4d3e9548 155. nr \\$1 (\\n[\\$0:n] - 1)
92d0a6a6
JR
156. rr \\$0:n
157..
4d3e9548 158.
92d0a6a6
JR
159.\" --------------------------------------------------------------------
160.\" www:splitstr (<name>)
161.\"
162.\" Add a space character between any two adjacent characters in string
163.\" <name> and restore result into the string variable <name>; space
164.\" characters are first replaced by the word `space'.
165.\"
166.de www:splitstr
167. if !(\\n[.$] == 1) \
168. www:error .\\$0 expects 1 argument.
169. if '\\*[\\$1]'' \
170. return
4d3e9548
JL
171. ds \\$0:r "\\*[\\$1]\"
172. ds \\$0:s
92d0a6a6 173. while 1 \{\
4d3e9548
JL
174. ds \\$0:c "\\*[\\$0:r]\"
175. substring \\$0:c 0 0
92d0a6a6 176. ie '\\*[\\$0:c]' ' \
4d3e9548 177. as \\$0:s " space\"
92d0a6a6 178. el \
4d3e9548 179. as \\$0:s " \\*[\\$0:c]\"
92d0a6a6 180. www:lenstr \\$0:n \\$0:r
4d3e9548 181. if (\\n[\\$0:n] <= 1) \
92d0a6a6 182. break
4d3e9548 183. substring \\$0:r 1 -1
92d0a6a6
JR
184. \}
185. if !'\\*[\\$0:s]'' \
186. substring \\$0:s 1 -1
4d3e9548 187. ds \\$1 \\*[\\$0:s]\"
92d0a6a6
JR
188. rm \\$0:c
189. rr \\$0:n
190. rm \\$0:r
191. rm \\$0:s
192..
4d3e9548 193.
92d0a6a6
JR
194.\" --------------------------------------------------------------------
195.\" www:url_breaks (<string_name>)
196.\"
197.\" Add `\:' (possible break point) within URL strings after `/'.
198.\"
199.\" Smart about multiple `/', existing `\:', and space characters;
200.\" does not set a break point if less than 5 characters would go to
201.\" the next line.
202.\"
203.de www:url_breaks
204. if !(\\n[.$] == 1) \
205. www:error .\\$0 expects 1 argument.
206. if !\n[www:substring_ok] \
207. return
4d3e9548 208. ds \\$0:s "\\*[\\$1]\"
92d0a6a6 209. www:splitstr \\$0:s
4d3e9548
JL
210. www:url_breaks_split \\$0:s \\*[\\$0:s]
211. ds \\$1 "\\*[\\$0:s]\"
92d0a6a6
JR
212. rm \\$0:s
213..
4d3e9548 214.
92d0a6a6 215.\" --------------------------------------------------------------------
4d3e9548 216.\" www:url_breaks_split (<result> <char> [<char>...])
92d0a6a6 217.\"
4d3e9548 218.\" Add `\:' within URL strings, but arguments are a split string.
92d0a6a6
JR
219.\"
220.\" Arguments: >=2: <result> <char> [<char>...]
221.\"
4d3e9548 222.de www:url_breaks_split
92d0a6a6
JR
223. nr \\$0:min 5 \" minimal number of characters for next line
224. if (\\n[.$] < 2) \
225. www:error .\\$0 expects at least 2 arguments.
226. ds \\$0:res \\$1\"
227. shift
4d3e9548 228. ds \\$0:s
92d0a6a6
JR
229. nr \\$0:done 0
230. while !\\n[\\$0:done] \{\
4d3e9548 231. if (\\n[.$] <= 0) \
92d0a6a6 232. break
92d0a6a6 233. if '\\$1'space' \{\
4d3e9548 234. as \\$0:s " \"
92d0a6a6
JR
235. shift
236. continue
237. \}
238. if (\\n[.$] < \\n[\\$0:min]) \{\
4d3e9548 239. as \\$0:s "\\$1\"
92d0a6a6
JR
240. shift
241. continue
242. \}
243. if !'\\$1'/' \{\
4d3e9548 244. as \\$0:s "\\$1\"
92d0a6a6
JR
245. shift
246. continue
247. \}
248. \" we are at a `/' character
249. while '\\$1'/' \{\
250. as \\$0:s /\"
251. if (\\n[.$] == 0) \{\
252. nr \\$0:done 1
253. break
254. \}
255. shift
256. \}
257. if \\n[\\$0:done] \
258. break
259. if (\\n[.$] < \\n[\\$0:min]) \
260. continue
261. if '\\$1'\:' \
262. shift
263. as \\$0:s \:\"
264. \}
265. ds \\*[\\$0:res] \\*[\\$0:s]\"
266. rm \\$0:res
267. rm \\$0:s
268..
4d3e9548
JL
269.
270.
92d0a6a6
JR
271.\" --------------------------------------------------------------------
272.\" User Interface
273.\" --------------------------------------------------------------------
274.
275.\" --------------------------------------------------------------------
465b256c 276.\" HTML
92d0a6a6 277.\"
4d3e9548 278.\" The main auxiliary macro for the HTML interface.
92d0a6a6
JR
279.\"
280.de HTML
281. if \\n[www-html] \{\
465b256c
JR
282. \" was implemented via .nop \&\X^html:\\$*^ but
283. \" is now implemented using HTML-NS to utilize code factoring.
284. \"
285. \" the `\&' makes the vertical mode leave, so to say
286. \"
287. nop \&\c
288. HTML-NS \\$*
92d0a6a6 289. nop \&
92d0a6a6
JR
290. \}
291..
4d3e9548 292.
92d0a6a6 293.\"
4d3e9548 294.\" An auxiliary macro for HTML (without following space).
92d0a6a6
JR
295.\"
296.de HTML-NS
465b256c
JR
297. nop \X^html:\\$*^\c
298..
4d3e9548 299.
465b256c 300.\"
4d3e9548 301.\" Emit an HTML tag after shutting down a (possibly open) paragraph.
465b256c
JR
302.\"
303.de HTML</p>
4d3e9548 304. ie \\n[www-html] \{\
465b256c
JR
305. \" the `\&' makes the vertical mode leave, so to say
306. nop \&\X^html</p>:\\$*^
307. \}
4d3e9548
JL
308. el \
309. www:paraspace
310..
311.
312.\"
313.\" Emit an HTML tag. If text has been written in the paragraph
314.\" then do not shut the paragraph down.
315.\" If text was not written, remove the empty
316.\" paragraph tag and emit the desired HTML tag.
317.\"
318.de HTML<?p>
319. if \\n[www-html] \
320. nop \&\X^html<?p>:\\$*^
321..
322.
323.\"
324.\" Emit a MATH tag. If text has been written in the paragraph
325.\" then do not shut the paragraph down.
326.\" If text was not written, remove the empty
327.\" paragraph tag and emit the desired math tag.
328.\"
329.de MATH<?p>
330. if \\n[www-html] \
331. nop \&\X^math<?p>:\\$*^
92d0a6a6 332..
4d3e9548 333.
92d0a6a6
JR
334.\" --------------------------------------------------------------------
335.\" HX n
336.\"
337.\" Automatic heading level cut off.
338.\"
339.\" N is the depth limit of automatically linked headings. So a depth
340.\" of 2 would cause grohtml to generate a list of links for `.NH 1'
341.\" and `.NH 2' but not for `.NH 3'.
342.\"
343.de HX
344. if \\n[www-html] \
345. nop \X^index:\\$*^
346..
4d3e9548 347.
92d0a6a6
JR
348.\" --------------------------------------------------------------------
349.\" BCL foreground background active not-visited visited
350.\"
351.de BCL
4d3e9548
JL
352. HTML <body "text=""\\$1""" \
353 "bgcolor=""\\$2""" \
354 "link=""\\$3""" \
355 "alink=""\\$4""" \
356 "vlink=""\\$5"">"
92d0a6a6 357..
4d3e9548 358.
92d0a6a6
JR
359.\" --------------------------------------------------------------------
360.\" BGIMG imagefile
361.\"
362.de BGIMG
4d3e9548
JL
363. HTML <body "background=""\\$1"">"
364..
365.
366.\" www:url_check_tag str
367.\" If url named by \*[str] is internal (starts with #),
368.\" redefine \*[str] to be the value of the string TAG_url.
369.
370.de www:url_check_tag
371. ds \\$0:tmp \\*[\\$1]\"
372. substring \\$0:tmp 0 0
373. if '\\*[\\$0:tmp]'#' \{\
374. ds \\$0:tmp \\*[\\$1]\"
375. substring \\$0:tmp 1
376. ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
377.
378. ie d \\*[\\$0:tmp] \
379. ds \\$1 \\*[\\*[\\$0:tmp]]\"
380. el \
381. ds \\$1 see below\"
382. \}
383. rm \\$0:tmp
92d0a6a6 384..
4d3e9548 385.
92d0a6a6
JR
386.\" --------------------------------------------------------------------
387.\" URL url [description] [after]
4d3e9548
JL
388.\"
389.\" If description is absent then the url becomes the anchor text.
92d0a6a6
JR
390.\"
391.de URL
4d3e9548 392. if !'\\$1'' \{\
465b256c 393. ds \\$0:adr \\$1\"
4d3e9548
JL
394. www:url_check_tag \\$0:adr
395. if !\\n[www-html] \
396. www:url_breaks \\$0:adr
465b256c 397. \}
92d0a6a6 398. ie \\n[www-html] \{\
465b256c 399. ie '\\$3'' \
4d3e9548 400. ds \\$0:after \&\"
465b256c 401. el \
4d3e9548
JL
402. ds \\$0:after \&\\$3\"
403.
92d0a6a6 404. ie '\\$2'' \
4d3e9548 405. HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
92d0a6a6 406. el \
4d3e9548
JL
407. HTML-NS <a "href=""\\$1"">\\$2</a>"
408.
465b256c
JR
409. nop \\*[\\$0:after]
410. rm \\$0:after
92d0a6a6
JR
411. \}
412. el \{\
4d3e9548
JL
413. if !r ps4html \
414. ad l
415.
465b256c
JR
416. ie '\\$2'' \{\
417. ie '\\$1'' \{\
4d3e9548 418. if !'\\$3'' \
465b256c
JR
419. nop \\$3
420. \}
421. el \{\
422. ie \\n[.color] \
4d3e9548 423. nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
465b256c 424. el \
4d3e9548 425. nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
465b256c
JR
426. \}
427. \}
428. el \{\
429. ie '\\$1'' \{\
430. ie \\n[.color] \
4d3e9548 431. nop \m[\\*[www:color]]\\$2\m[]\\$3
465b256c 432. el \
4d3e9548 433. nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
465b256c
JR
434. \}
435. el \{\
4d3e9548
JL
436. ie \\n[.color] \{\
437. nop \m[\\*[www:color]]\\$2\m[]
438. nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
439. \}
440. el \{\
441. nop \f[\\*[www:fontstyle]]\\$2\f[]
442. nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
443. \}
465b256c
JR
444. \}
445. \}
4d3e9548
JL
446.
447. if !r ps4html \
448. ad
92d0a6a6
JR
449. \}
450. rm \\$0:adr
451..
4d3e9548 452.
92d0a6a6
JR
453.\" --------------------------------------------------------------------
454.\" FTP url description [after]
455.\"
456.\" Same as URL.
457.\"
458.als FTP URL
4d3e9548 459.
92d0a6a6
JR
460.\" --------------------------------------------------------------------
461.\" MTO address description [after]
462.\"
463.\" ADDRESS is the email address (without the `mailto:' prefix).
464.\"
465.\" DESCRIPTION is the optional name. If an empty argument is given,
466.\" ADDRESS is used instead.
467.\"
468.\" AFTER is optional stuff printed immediately after ADDRESS
469.\" (resp. DESCRIPTION).
470.\"
471.\" Example:
472.\"
473.\" Foobar has been written by
474.\" .MTO fred@foo.bar "Fredrick Bloggs" .
475.\"
476.de MTO
477. ie \\n[www-html] \{\
478. ie '\\$2'' \
479. URL mailto:\\$1 \\$1 "\\$3"
480. el \
481. URL mailto:\\$1 "\\$2" "\\$3"
482. \}
483. el \{\
465b256c
JR
484. ie '\\$2'' \{\
485. ie '\\$1'' \{\
486. ie !'\\$3'' \
487. nop \\$3
488. \}
489. el \{\
490. ie \\n[.color] \
4d3e9548 491. nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
465b256c 492. el \
4d3e9548 493. nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
465b256c
JR
494. \}
495. \}
496. el \{\
497. ie '\\$1'' \{\
498. ie \\n[.color] \
4d3e9548 499. nop \m[\\*[www:color]]\\$2\m[]\\$3
465b256c 500. el \
4d3e9548 501. nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
465b256c
JR
502. \}
503. el \{\
4d3e9548
JL
504. ie \\n[.color] \{\
505. nop \m[\\*[www:color]]\\$2\m[]
506. nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
507. \}
508. el \{\
509. nop \f[\\*[www:fontstyle]]\\$2\f[]
510. nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
511. \}
465b256c
JR
512. \}
513. \}
92d0a6a6
JR
514. \}
515..
4d3e9548 516.
92d0a6a6 517.\" --------------------------------------------------------------------
4d3e9548 518.\" TAG name [text]
92d0a6a6 519.\"
4d3e9548
JL
520.\" Generate an HTML name NAME.
521.\" Define string TAG_NAME to TEXT, if present, otherwise to \n[PN].
92d0a6a6
JR
522.\"
523.de TAG
4d3e9548
JL
524. HTML <a "name=""\\$1""></a>"
525. ie '\\$2'' \
526. ds TAG_\\$1 \\n[PN]\"
527. el \
528. ds TAG_\\$1 \\$2\"
92d0a6a6 529..
4d3e9548 530.
92d0a6a6
JR
531.\" --------------------------------------------------------------------
532.\" IMG [-R|-L|-C] filename [width] [height]
533.\"
4d3e9548 534.\" Include an image of any type (only works for -Thtml).
92d0a6a6
JR
535.\"
536.\" Alignment is centered by default (-C).
537.\" Default value for WIDTH is 1i.
538.\" If HEIGHT is not given, WIDTH is used as the height.
539.\"
540.de IMG
541. ie \\n[www-html] \{\
542. ie '\\$2'-R' \
4d3e9548 543. DEVTAG .right-image
92d0a6a6
JR
544. el \{\
545. ie '\\$2'-L' \
4d3e9548 546. DEVTAG .left-image
92d0a6a6 547. el \
4d3e9548 548. DEVTAG .centered-image
92d0a6a6
JR
549. \}
550. nr www-width 100
551. if !'\\$3'' \
552. nr www-width \\$3
553. nr www-height \\n[www-width]
554. if !'\\$4'' \
555. nr www-height \\$4
4d3e9548
JL
556. HTML <img "src=""\\$1""" \
557 "alt=""Image \\$1""" \
558 "width=""\\n[www-width]""" \
559 "height=""\\n[www-height]""\\*[www->]"
92d0a6a6
JR
560. \}
561. el \
4d3e9548 562. nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
92d0a6a6 563..
4d3e9548 564.
92d0a6a6 565.\" --------------------------------------------------------------------
92d0a6a6
JR
566.\" PIMG [-R|-L|-C] filename [width] [height]
567.\"
4d3e9548 568.\" Include a PNG image. It works for -Tps and -Thtml.
92d0a6a6
JR
569.\" The default value for WIDTH and HEIGHT is zero; the default
570.\" alignment is centering (-C).
571.\"
572.\" Note: This macro can only be used with the `-U' option of groff,
573.\" activating unsafe mode, if not used with -Thtml; the PNG image
574.\" is then converted to the EPS format using netpbm utilities.
575.\"
576.de PIMG
4d3e9548
JL
577. ds www-pic-align -C\"
578. ie '\\$1'-R' \{\
579. ds www-pic-align -R\"
580. shift
581. \}
582. el \{\
583. if '\\$1'-L' \{\
584. ds www-pic-align -L\"
585. shift
92d0a6a6 586. \}
4d3e9548
JL
587. \}
588. if '\\$1'-C' \
589. shift
590.
591. ie \\n[www-html] \{\
592. ds www-htmlalign align="center"\"
593. if '\\*[www-pic-align]'-R' \
594. ds www-htmlalign align="right"\"
595. if '\\*[www-pic-align]'-L' \
596. ds www-htmlalign align="left"\"
597.
92d0a6a6
JR
598. nr www-width 0
599. nr www-height 0
4d3e9548 600. if !'\\$2'' \
92d0a6a6 601. nr www-width (\\$3 * 100 / 240)
4d3e9548 602. if !'\\$3'' \
92d0a6a6
JR
603. nr www-height (\\$4 * 100 / 240)
604. ie (\\n[www-width] == 0) \{\
605. ie (\\n[www-height] == 0) \
4d3e9548
JL
606. HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
607 "alt=""Image \\$1""\\*[www->]</p>"
92d0a6a6 608. el \
4d3e9548
JL
609. HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
610 "alt=""Image \\$1""" \
611 "height=""\\n[www-height]""\\*[www->]</p>"
92d0a6a6
JR
612. \}
613. el \{\
614. ie (\\n[www-height] == 0) \
4d3e9548
JL
615. HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
616 "alt=""Image \\$1""" \
617 "width=""\\n[www-width]""\\*[www->]</p>"
92d0a6a6 618. el \
4d3e9548
JL
619. HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
620 "alt=""Image \\$1""" \
621 "width=""\\n[www-width]""" \
622 "height=""\\n[www-height]""\\*[www->]</p>"
92d0a6a6
JR
623. \}
624. \}
625. el \{\
626. if !r ps4html \{\
627. www-make-unique-name
4d3e9548
JL
628. sy pngtopnm \\$1 \
629 | pnmcrop -white \
630 | @PNMTOPS_NOSETPAGE@ -noturn \
631 > \\*[www-unique-name].eps
632. shift
633. PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
92d0a6a6
JR
634. \}
635. \}
636..
637.
638.\" --------------------------------------------------------------------
639.\" auxiliary definitions for MPIMG
640.\"
641.nr www-left-ll-trap 0
642.nr www-left-po-trap 0
643.nr www-right-ll-trap 0
644.
645.de www-finish-left-po
646. po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
647. wh \\n[www-left-po-trap]u
648. nr www-left-indent 0
649..
650.
651.\" called when the -R picture is finished
652.de www-finish-right-ll
653. ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
4d3e9548
JL
654.
655. \" now check whether we need to inline www-finish-left-ll
92d0a6a6
JR
656. if (\\n[www-left-ll-trap]u > 0) \
657. if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
658. mk www-left-po-trap
659. nr www-left-po-trap +1v
660. wh \\n[www-left-po-trap]u www-finish-left-po
661. ll +\\n[www-left-indent]u
662. wh \\n[www-left-ll-trap]u
663. nr www-left-ll-trap 0
664. \}
4d3e9548
JL
665.
666. \" and check whether we need to inline www-finish-left-po
92d0a6a6
JR
667. if (\\n[www-left-po-trap]u > 0) \
668. if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
669. po -\\n[www-left-indent]u
670. wh \\n[www-left-po-trap]u
671. nr www-left-indent 0
672. \}
4d3e9548 673.
92d0a6a6
JR
674. wh \\n[www-right-ll-trap]u
675. nr www-right-ll-trap 0
676..
677.
678.de www-finish-left-ll
679. if (\\n[www-right-ll-trap] > 0) \
680. if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
681. ll +\\n[www-right-indent]u
682. nr www-right-ll-trap 0
683. \}
4d3e9548 684.
92d0a6a6
JR
685. mk www-left-po-trap
686. nr www-left-po-trap +1v
687. wh \\n[www-left-po-trap]u www-finish-left-po
688. ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
689. wh \\n[www-left-ll-trap]u
690. nr www-left-ll-trap 0
691..
465b256c
JR
692.
693.\" www-handle-percent arg N1 N2 S1
694.\" arg - input string (number or number%)
695.\" output parameters:
696.\" N1 - name of number register 1=absolute 0=percentage
697.\" N2 - number register name for absolute value
698.\" S1 - string register name for percentage value
4d3e9548 699.\"
465b256c
JR
700.de www-handle-percent
701. ds www-percent \\$1\"
702. substring www-percent -1 -1
703.
704. ie '\\*[www-percent]'%' \{\
705. ds www-abs \\$1\"
706. substring www-abs 0 -2
707. nr \\$2 0
708. nr \\$3 \\*[www-abs]
709. ds \\$4 \\$1\"
710. \}
711. el \{\
712. nr \\$2 1
713. nr \\$3 \\$1
714. ds \\$4 none\"
715. \}
716..
717.
92d0a6a6
JR
718.\" --------------------------------------------------------------------
719.\" MPIMG [-R|-L] [-G gap] filename [width [height]]
720.\"
4d3e9548 721.\" Include a PNG image and wrap text around it. It works for
92d0a6a6
JR
722.\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
723.\" for HEIGHT is WIDTH; the default alignment is left (-L).
724.\" -G is used to insert a gap between the text and the image.
465b256c
JR
725.\" The height and width can also be given as a percentage.
726.\" The PostScript device converts the percentage width into an
727.\" absolute value by using \\n[.l], and the height by using \\n[.p].
728.\"
92d0a6a6
JR
729.\"
730.\" Note: This macro can only be used with the `-U' option of groff,
731.\" activating unsafe mode, if not used with -Thtml; the PNG image
732.\" is then converted to the EPS format using netpbm utilities.
733.\"
92d0a6a6
JR
734.nr www-htmlimage-gap 0
735.
736.de MPIMG
737. nr www-image-just 1
738. nr www-image-gap 0
739. while (\\n[.$] > 0) \{\
740. if '-L'\\$1' \{\
741. nr www-image-just 1
742. shift
743. continue
744. \}
745. if '-R'\\$1' \{\
746. nr www-image-just 0
747. shift
748. continue
749. \}
750. if '-G'\\$1' \{\
751. nr www-image-gap \\$2
752. nr www-htmlimage-gap (\\$2 * 100 / 240)
753. shift 2
754. continue
755. \}
756. break
757. \}
465b256c 758.
92d0a6a6 759. nr www-width 1i
465b256c 760. nr www-height 1i
4d3e9548 761. ds www-size-specs width="\\n[www-width]" height="\\n[www-height]"\"
465b256c
JR
762. ie !'\\$2'' \{\
763. nr www-is-absolute 0
764. nr www-absolute 0
765. ds www-percentage none\"
766. www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
767. ie !\\n[www-is-absolute] \{\
768. \" percentage of linelength requested
769. nr www-width (\\n[www-absolute] * \\n[.l] / 100)
770. if \\n[www-html] \
771. nr www-width (\\n[www-width] * 100 / 240)
4d3e9548 772. ds www-size-specs width="\\*[www-percentage]"\"
465b256c
JR
773. \}
774. el \{\
775. nr www-width \\n[www-absolute]
776. if \\n[www-html] \
777. nr www-width (\\n[www-width] * 100 / 240)
4d3e9548 778. ds www-size-specs width="\\n[www-width]"\"
465b256c
JR
779. \}
780.
781. nr www-height \\n[www-width]
782. ie !'\\$3'' \{\
783. nr www-is-absolute 0
784. nr www-absolute 0
785. ds www-percentage none\"
786. www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
787. ie !\\n[www-is-absolute] \{\
788. \" percentage of pagelength requested
789. nr www-height (\\n[www-absolute] * \\n[.p] / 100)
790. if \\n[www-html] \
791. nr www-height (\\n[www-height] * 100 / 240)
4d3e9548 792. ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
465b256c
JR
793. \}
794. el \{\
795. nr www-height \\n[www-absolute]
796. if \\n[www-html] \
797. nr www-height (\\n[www-height] * 100 / 240)
4d3e9548 798. ds www-size-specs "\\*[www-size-specs] height="\\*[www-height]"\"
465b256c
JR
799. \}
800. \}
801. \}
802. el \{\
803. \" height not specified; use width value
804. ie !\\n[www-is-absolute] \{\
805. \" percentage value
4d3e9548 806. ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
465b256c
JR
807. nr www-height \\n[www-width]
808. \}
809. el \{\
4d3e9548 810. ds www-size-specs "\\*[www-size-specs] height="\\*[www-width]"\"
465b256c
JR
811. nr www-height \\n[www-width]
812. \}
813. \}
92d0a6a6
JR
814.
815. ie \\n[www-html] \{\
816. ie !\\n[www-image-just] \
4d3e9548
JL
817. HTML <img "src=""\\$1""" \
818 "alt=""Image \\$1""" \
819 "hspace=""\\n[www-htmlimage-gap]""" \
820 "align=""right""" \
821 "\\*[www-size-specs]\\*[www->]"
92d0a6a6 822. el \
4d3e9548
JL
823. HTML <img "src=""\\$1""" \
824 "alt=""Image \\$1""" \
825 "hspace=""\\n[www-htmlimage-gap]""" \
826 "align=""left""" \
827 "\\*[www-size-specs]\\*[www->]"
92d0a6a6
JR
828. \}
829. el \{\
465b256c
JR
830. tm www-width is \\n[www-width]
831. tm www-height is \\n[www-height]
92d0a6a6
JR
832. if !r ps4html \{\
833. www-make-unique-name
4d3e9548
JL
834. sy pngtopnm \\$1 \
835 | pnmcrop -white \
836 | @PNMTOPS_NOSETPAGE@ -noturn \
837 > \\*[www-unique-name].eps
92d0a6a6
JR
838. ie !\\n[www-image-just] \{\
839. \" we must now disable a possible left image trap
840. sp -1
841. if (\\n[www-left-ll-trap] > 0) \
842. wh \\n[www-left-ll-trap]u
843. if (\\n[www-left-po-trap] > 0) \
844. wh \\n[www-left-po-trap]u
465b256c 845. PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
92d0a6a6 846. sp -\\n[ps-desht]u
4d3e9548 847.
92d0a6a6
JR
848. nr www-right-indent \\n[ps-deswid]u
849. \" we want to have some space between text and image,
850. \" so the line length must be shorter
851. ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
852. mk www-right-ll-trap
853. nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
854. wh \\n[www-right-ll-trap]u www-finish-right-ll
4d3e9548 855.
92d0a6a6
JR
856. \" now restore possible left trap
857. if (\\n[www-left-ll-trap] > 0) \
858. wh \\n[www-left-ll-trap]u www-finish-left-ll
859. if (\\n[www-left-po-trap] > 0) \
860. wh \\n[www-left-po-trap]u
861. \}
862. el \{\
863. \" we must now disable a possible right image trap
864. if (\\n[www-right-ll-trap] > 0) \
865. wh \\n[www-right-ll-trap]u
465b256c 866. PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
92d0a6a6 867. sp -\\n[ps-desht]u
4d3e9548 868.
92d0a6a6
JR
869. nr www-left-indent \\n[ps-deswid]u
870. \" increase offset by gap
871. po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
872. \" decrease line length by gap
873. ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
874. mk www-left-ll-trap
875. nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
876. wh \\n[www-left-ll-trap]u www-finish-left-ll
4d3e9548 877.
92d0a6a6
JR
878. \" now restore possible right trap
879. if (\\n[www-right-ll-trap] > 0) \
880. wh \\n[www-right-ll-trap]u www-finish-right-ll
881. \}
882. \}
883. \}
884..
4d3e9548 885.
92d0a6a6
JR
886.\" --------------------------------------------------------------------
887.\" HnS n
888.\"
889.\" Begin heading. Heading level is N.
890.\"
891.\" HnE
892.\"
893.\" End heading.
894.\"
895.\" If your heading contains URL, FTP, MTO macros you might wish to
896.\" disable automatic links to headings. This can be done via `-P-l'
897.\" from the command line or by using a cakk to `.HX 0'.
898.\"
899.nr www-heading-no -1
900.
901.de HnS
902. ie '\\$1'' \
903. nr www-heading-no 1
904. el \
905. nr www-heading-no \\$1
465b256c 906. DEVTAG-NH \\n[www-heading-no]
92d0a6a6
JR
907..
908.
909.de HnE
910. if (\\n[www-heading-no] == -1) \
4d3e9548 911. www-error HnE found without a corresponding HnS
465b256c 912. DEVTAG-EO-H
92d0a6a6 913..
4d3e9548 914.
92d0a6a6
JR
915.\" --------------------------------------------------------------------
916.\" LK
917.\"
918.\" Emit the automatically collected links derived from
919.\" section/numbered headings at this position.
920.\"
921.de LK
4d3e9548 922. DEVTAG .links
92d0a6a6 923..
4d3e9548 924.
92d0a6a6
JR
925.\" --------------------------------------------------------------------
926.\" HR
927.\"
465b256c 928.\" Produce a horizontal line.
92d0a6a6
JR
929.\"
930.de HR
4d3e9548 931. HTML</p> <hr\\*[www->]
92d0a6a6 932..
4d3e9548 933.
92d0a6a6
JR
934.\" --------------------------------------------------------------------
935.\" NHR
936.\"
4d3e9548 937.\" Suppress the generation of the top and bottom rules which grohtml
92d0a6a6
JR
938.\" emits by default.
939.\"
940.de NHR
4d3e9548 941. DEVTAG .no-auto-rule
92d0a6a6 942..
4d3e9548 943.
92d0a6a6
JR
944.\"
945.\" www-end-nowhere - end of input trap called to finish diversion.
946.\"
947.de www-end-nowhere
465b256c
JR
948. if !\\n[www-html] \
949. di
950. DEVTAG-EO-TL
92d0a6a6 951..
4d3e9548 952.
92d0a6a6
JR
953.\" --------------------------------------------------------------------
954.\" HTL
955.\"
956.\" Generate an HTML title only. This differs from the -ms .TL macro
465b256c 957.\" which generates both an HTML title and an H1 heading.
92d0a6a6 958.\"
4d3e9548 959.\" This is useful when an author wishes to use an HTML title as search
92d0a6a6
JR
960.\" engine fodder but a graphic title in the document.
961.\"
962.\" The macro terminates when a space or break is seen (.sp, .br).
963.\"
964.de HTL
4d3e9548 965. DEVTAG .html-tl
465b256c 966. if !\\n[www-html] \
92d0a6a6 967. di www-nowhere
465b256c 968. it 2 www-end-nowhere
92d0a6a6
JR
969..
970.
971.\" --------------------------------------------------------------------
465b256c
JR
972.\" auxiliary definitions for lists
973.\"
974.ds www-ul-level1 \[bu]\ \ \"
975.ds www-ul-level2 \[sq]\ \ \"
976.ds www-ul-level3 \[ci]\ \ \"
977.nr www-ul-level 0
978.
979.ds www-ol-level1 decimal\"
980.ds www-ol-level2 lower-alpha\"
981.ds www-ol-level3 lower-roman\"
982.ds www-ol-tmp 00\ \ \"
983.nr www-ol-ctr1 0 1
984.nr www-ol-ctr2 0 1
985.nr www-ol-ctr3 0 1
986.af www-ol-ctr2 a
987.af www-ol-ctr3 i
988.nr www-ol-level 0
989.
990.nr www-dl-level 0
991.nr www-dl-shift 5n
992.
993.\"
994.\" allow nested lists
92d0a6a6 995.\"
92d0a6a6 996.nr www-depth 0
465b256c
JR
997.nr www-li-indent \n[.i]
998.ds www-level0 nop\"
999.ds www-level1
1000.ds www-level2
1001.ds www-level3
1002.ds www-level4
1003.ds www-level5
1004.ds www-level6
1005.ds www-level7
1006.ds www-level8
1007.ds www-level9
1008.
1009.\" which macro to use for LI
1010.de www-push-li
1011. nr www-depth +1
1012. ds www-level\\n[www-depth] \\$1\"
4d3e9548 1013. ds www-ltag\\n[www-depth]
465b256c
JR
1014. als LI \\$1
1015..
1016.
1017.de www-pop-li
1018. nr www-depth -1
1019. als LI \\*[www-level\\n[www-depth]]
1020..
92d0a6a6 1021.
4d3e9548
JL
1022.\" www-emit-ltag - shut down a previous open list tag
1023.\" before issuing a new tag \\$1.
1024.\" It then records tag \\$1 is open.
1025.
1026.de www-emit-ltag
1027. if !'\\*[www-ltag\\n[www-depth]]'' \
1028. HTML-NS </\\*[www-ltag\\n[www-depth]]>
1029. if !'\\$1'' \
1030. HTML-NS <\\$1>
1031. ds www-ltag\\n[www-depth] \\$1\"
1032..
1033.
92d0a6a6
JR
1034.\"
1035.\" Auxiliary macro for ULS.
1036.\"
465b256c
JR
1037.de www-push-ul-level
1038. nr www-ul-level +1
1039. if (\\n[www-ul-level] > 3) \
4d3e9548 1040. www-error ULS: too many levels of indentation (\\n[www-ul-level])
92d0a6a6
JR
1041..
1042.\"
1043.\" Auxiliary macro for ULE.
1044.\"
465b256c
JR
1045.de www-pop-ul-level
1046. if !\\n[www-ul-level] \
4d3e9548 1047. www-error ULE: trying to terminate a list which does not exist
465b256c
JR
1048. nr www-ul-level -1
1049..
1050.
1051.\"
1052.\" Auxiliary macro for OLS.
1053.\"
1054.de www-push-ol-level
1055. nr www-ol-level +1
1056. if (\\n[www-ol-level] > 3) \
4d3e9548 1057. www-error OLS: too many levels of indentation (\\n[www-ol-level])
92d0a6a6 1058..
4d3e9548 1059.
465b256c
JR
1060.\"
1061.\" Auxiliary macro for OLE.
1062.\"
1063.de www-pop-ol-level
1064. if !\\n[www-ol-level] \
4d3e9548 1065. www-error OLE: trying to terminate a list which does not exist
465b256c
JR
1066. nr www-ol-level -1
1067..
1068.
92d0a6a6
JR
1069.\" --------------------------------------------------------------------
1070.\" ULS
1071.\"
1072.\" Start an unordered list.
1073.\"
1074.de ULS
465b256c
JR
1075. www-push-li www-li-ul
1076. www-push-ul-level
4d3e9548
JL
1077. ie \\n[www-html] \{\
1078. www-emit-ltag
1079. HTML</p> <ul>
92d0a6a6 1080. \}
4d3e9548
JL
1081. el \
1082. nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
92d0a6a6 1083..
4d3e9548 1084.
92d0a6a6
JR
1085.\" --------------------------------------------------------------------
1086.\" ULE
1087.\"
1088.\" End an unordered list.
1089.\"
1090.de ULE
4d3e9548
JL
1091. ie \\n[www-html] \{\
1092. www-emit-ltag
1093. HTML</p> </ul>
1094. \}
92d0a6a6 1095. el \{\
465b256c
JR
1096. nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1097. in \\n[www-li-indent]u
1098. \}
1099. www-pop-ul-level
1100. www-pop-li
1101..
4d3e9548 1102.
465b256c
JR
1103.\" --------------------------------------------------------------------
1104.\" OLS
1105.\"
1106.\" Start an ordered list.
1107.\"
1108.de OLS
1109. www-push-li www-li-ol
1110. www-push-ol-level
4d3e9548
JL
1111. ie \\n[www-html] \{\
1112. www-emit-ltag
1113. HTML</p> <ol "style=""list-style-type:" \
1114 "\\*[www-ol-level\\n[www-ol-level]]"">"
1115. \}
465b256c
JR
1116. el \
1117. nr www-li-indent +\w'\\*[www-ol-tmp]'u
1118..
4d3e9548 1119.
465b256c
JR
1120.\" --------------------------------------------------------------------
1121.\" OLE
1122.\"
1123.\" End an ordered list.
1124.\"
1125.de OLE
4d3e9548
JL
1126. ie \\n[www-html] \{\
1127. www-emit-ltag
1128. HTML </ol>
1129. \}
465b256c
JR
1130. el \{\
1131. nr www-li-indent -\w'\\*[www-ol-tmp]'u
1132. in \\n[www-li-indent]u
1133. nr www-ol-ctr\\n[www-ol-level] 0 1
1134. \}
1135. www-pop-ol-level
1136. www-pop-li
1137..
4d3e9548 1138.
465b256c 1139.\" --------------------------------------------------------------------
465b256c 1140.\" DLS
4d3e9548 1141.\"
465b256c
JR
1142.\" Start a definition list.
1143.\"
1144.de DLS
1145. www-push-li www-li-dl
1146. nr www-dl-level +1
4d3e9548
JL
1147. ie \\n[www-html] \{\
1148. www-emit-ltag
1149. HTML</p> <dl>
1150. \}
465b256c
JR
1151. el \{\
1152. nr www-li-indent +\\n[www-dl-shift]u
1153. in \\n[www-li-indent]u
92d0a6a6 1154. \}
465b256c 1155..
4d3e9548 1156.
465b256c 1157.\" --------------------------------------------------------------------
465b256c 1158.\" DLE
4d3e9548 1159.\"
465b256c
JR
1160.\" End a definition list.
1161.\"
1162.de DLE
4d3e9548
JL
1163. ie \\n[www-html] \{\
1164. www-emit-ltag
1165. HTML </dl>
1166. \}
465b256c
JR
1167. el \{\
1168. nr www-li-indent -\\n[www-dl-shift]u
1169. in \\n[www-li-indent]u
1170. \}
1171. nr www-dl-level -1
1172. www-pop-li
92d0a6a6 1173..
4d3e9548 1174.
92d0a6a6
JR
1175.\" --------------------------------------------------------------------
1176.\" LI
1177.\"
1178.\" Insert a list item.
1179.\"
4d3e9548 1180.
465b256c
JR
1181.\" ********
1182.\" www-li-ul - bulleted list item
1183.\"
1184.de www-li-ul
92d0a6a6 1185. ie \\n[www-html] \
4d3e9548 1186. www-emit-ltag li
92d0a6a6 1187. el \{\
465b256c
JR
1188. www:paraspace
1189. in \\n[www-li-indent]u
1190. ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1191. nop \\*[www-ul-level\\n[www-ul-level]]\c
1192. \}
1193..
4d3e9548 1194.
465b256c
JR
1195.\" ********
1196.\" www-li-ol - numbered list item
1197.\"
1198.de www-li-ol
1199. ie \\n[www-html] \
4d3e9548 1200. www-emit-ltag li
465b256c
JR
1201. el \{\
1202. www:paraspace
1203. in \\n[www-li-indent]u
1204. ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1205. nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
1206. \}
1207..
4d3e9548 1208.
465b256c
JR
1209.\" ********
1210.\" www-li-dl - definition list item
1211.\"
1212.de www-li-dl
1213. ie \\n[www-html] \{\
4d3e9548
JL
1214. HTML <dt>\\$1</dt>
1215. www-emit-ltag dd
465b256c
JR
1216. \}
1217. el \{\
1218. www:paraspace
1219. in \\n[www-li-indent]u
1220. ti -\\n[www-dl-shift]u
1221. nop \&\\$1
1222. br
92d0a6a6
JR
1223. \}
1224..
4d3e9548 1225.
92d0a6a6
JR
1226.\" --------------------------------------------------------------------
1227.\" DC l text [color]
1228.\"
1229.\" L is the letter to be dropped and enlarged.
1230.\"
1231.\" TEXT is the following text whose height the first letter should not
1232.\" exceed.
1233.\"
1234.\" COLOR is the optional color of the dropped letter (default black).
1235.\"
1236.de DC
4d3e9548 1237. ds www-dropcolor black\"
92d0a6a6 1238. if !'\\$3'' \
4d3e9548
JL
1239. ds www-dropcolor \\$3\"
1240. ie '\*[.T]'html' \{\
92d0a6a6 1241. www-make-unique-name
465b256c 1242. nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
4d3e9548 1243. MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
92d0a6a6
JR
1244. \}
1245. el \{\
1246. ie r ps4html \{\
1247. www-make-unique-name
1248. \" To avoid interferences with another DC macro call which is located
1249. \" very near to the current one, we draw the glyph on a separate page.
1250. \" Otherwise it could theoretically happen that the dropped capital
1251. \" glyphs overlap.
1252. bp
1253. ev www-DC
465b256c 1254. vs 320p
92d0a6a6 1255. nop \O[5i\\*[www-unique-name].png]\O[1]
465b256c 1256. nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
92d0a6a6
JR
1257. nop \O[2]\O[0]
1258. br
1259. ev
1260. bp
1261. \}
1262. el \{\
1263. ie n \
1264. nop \\$1\c
1265. el \{\
1266. nr dummy \w'\\$1'u
1267. nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1268. char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1269. nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1270' ti \w'\\[dcap]'u
1271. \}
1272. \}
1273. \}
1274. nop \\$2
1275..
4d3e9548 1276.
92d0a6a6
JR
1277.\"
1278.\" supplementary macros used by other macro sets
1279.\"
1280.\" here are some tags specially for -Tps or -Thtml when invoked by
4d3e9548 1281.\" pre-html to generate PNG images from postscript.
92d0a6a6
JR
1282.
1283.\" --------------------------------------------------------------------
4d3e9548 1284.\" HTML-DO-IMAGE - tell troff to issue an image marker which can be
92d0a6a6
JR
1285.\" read back by pre-html
1286.\"
1287.de HTML-DO-IMAGE
1288. if r ps4html \
1289. nop \O[5\\$2\\$1.png]\O[1]\O[3]
1290. if \\n[www-html] \
1291. nop \O[5\\$2\\$1.png]\O[0]\O[3]
1292..
4d3e9548 1293.
92d0a6a6 1294.\" --------------------------------------------------------------------
4d3e9548 1295.\" HTML-IMAGE-END - terminate an image for HTML
92d0a6a6
JR
1296.\"
1297.de HTML-IMAGE-END
1298. if r ps4html \
1299. nop \O[4]\O[2]\O[0]
1300. if \\n[www-html] \
1301. nop \O[4]\O[2]\O[1]
1302..
1303.
1304.nr www-png-no 0
1305.
1306.\" --------------------------------------------------------------------
4d3e9548 1307.\" www-make-unique-name - generate another unique name in string
92d0a6a6
JR
1308.\" `www-unique-name'
1309.\"
1310.de www-make-unique-name
1311. nr www-png-no +1
4d3e9548 1312. ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
92d0a6a6 1313..
4d3e9548 1314.
92d0a6a6
JR
1315.\" --------------------------------------------------------------------
1316.\" HTML-IMAGE and friends tell grohtml that this region of text needs
1317.\" to be rendered as an image.
1318.\"
1319.de HTML-IMAGE
1320. \" generates a centered image
1321. www-make-unique-name
1322. HTML-DO-IMAGE \\*[www-unique-name] c
1323..
1324.
1325.de HTML-IMAGE-RIGHT
1326. www-make-unique-name
1327. HTML-DO-IMAGE \\*[www-unique-name] r
1328..
1329.
1330.de HTML-IMAGE-LEFT
1331. www-make-unique-name
1332. HTML-DO-IMAGE \\*[www-unique-name] l
1333..
1334.
1335.de HTML-IMAGE-INLINE
1336. www-make-unique-name
1337. HTML-DO-IMAGE \\*[www-unique-name] i
1338..
1339.
4d3e9548
JL
1340.\" EQN-HTML-IMAGE and friends check to see whether the equation is
1341.\" not in an image, in which case it allows HTML
1342.\" (mathml) to be generated (if -Txhtml was specified).
1343.
1344.de EQN-HTML-IMAGE
1345. \" generates a centered image
1346. www-make-unique-name
1347. EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1348..
1349.
1350.de EQN-HTML-IMAGE-RIGHT
1351. www-make-unique-name
1352. EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1353..
1354.
1355.de EQN-HTML-IMAGE-LEFT
1356. www-make-unique-name
1357. EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1358..
1359.
1360.de EQN-HTML-IMAGE-INLINE
1361. www-make-unique-name
1362. EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1363..
1364.
1365.\" --------------------------------------------------------------------
1366.\" EQN-HTML-DO-IMAGE - tell troff to issue an image marker which can be
1367.\" read back by pre-html
1368.\"
1369.de EQN-HTML-DO-IMAGE
1370. ie r xhtml \{\
1371. if !(\\n[.O] == 0) \{\
1372. if r ps4html \
1373. nop \O[5\\$2\\$1.png]\O[1]\O[3]
1374. if \\n[www-html] \
1375. nop \O[5\\$2\\$1.png]\O[0]\O[3]
1376. \}
1377. \}
1378. el \
1379. HTML-DO-IMAGE \\$*
1380..
1381.
1382.\" --------------------------------------------------------------------
1383.\" EQN-HTML-IMAGE-END - terminate an image for HTML
1384.\"
1385.de EQN-HTML-IMAGE-END
1386. ie r xhtml \{\
1387. if !(\\n[.O] == 0) \{\
1388. if r ps4html \
1389. nop \O[4]\O[2]\O[0]
1390. if \\n[www-html] \
1391. nop \O[4]\O[2]\O[1]
1392. \}
1393. \}
1394. el \
1395. HTML-IMAGE-END
1396..
1397.
1398.\" --------------------------------------------------------------------
1399.\" Setup around HTML-IMAGE and friends
1400.\"
1401.\" now set up TS, TE, EQ, EN default macros
1402.\"
1403.\" we must not use `.als': the definition of .TE in s.tmac, for example,
1404.\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1405.\" causing an endless loop
1406.\"
1407.if !d TS \{\
1408. de TS
1409. HTML-IMAGE \\$@
1410. if \\n[www-html] \{\
1411. nr www-TS-ll \\n[.l]
1412. ll 1000n
1413. \}
1414. .
1415.\}
1416.if !d TE \{\
1417. de TE
1418. if \\n[www-html] \
1419. ll \\n[www-TS-ll]u
1420. HTML-IMAGE-END \\$@
1421. .
1422.\}
1423.if !d EQ \{\
1424. de EQ
1425. EQN-HTML-IMAGE \\$@
1426. if \\n[www-html] \{\
1427. nr www-EQ-ll \\n[.l]
1428. ll 1000n
1429. \}
1430. .
1431.\}
1432.if !d EN \{\
1433. de EN
1434. if \\n[www-html] \
1435. ll \\n[www-EQ-ll]u
1436. EQN-HTML-IMAGE-END \\$@
1437. .
1438.\}
1439.
92d0a6a6
JR
1440.\" --------------------------------------------------------------------
1441.\" JOBNAME
1442.\"
4d3e9548 1443.\" Generate multiple output files containing the HTML.
92d0a6a6
JR
1444.\" A file is split whenever a .SH or .NH 1 is encountered.
1445.\" The argument to JOBNAME is the file stem for future output files.
1446.\"
1447.de JOBNAME
465b256c
JR
1448. DEVTAG .job-name \\$1
1449..
4d3e9548 1450.
465b256c
JR
1451.\" --------------------------------------------------------------------
1452.\" HEAD
1453.\"
4d3e9548 1454.\" Add information to the <head> </head> section of the HTML
465b256c 1455.\" document
4d3e9548 1456.\"
465b256c
JR
1457.de HEAD
1458. DEVTAG .head "\\$*"
92d0a6a6 1459..
4d3e9548 1460.
92d0a6a6 1461.\" --------------------------------------------------------------------
4d3e9548
JL
1462.\" start of some code
1463.\"
1464.de CDS
1465. ft C
1466. nf
1467..
1468.
92d0a6a6 1469.\" --------------------------------------------------------------------
4d3e9548
JL
1470.\" end of some code
1471.\"
1472.de CDE
1473. fi
1474. ft P
1475..
92d0a6a6 1476.
4d3e9548
JL
1477.ds www-nav-colour #eeeeee\"
1478.nr www-nav-width-left 30
1479.nr www-nav-width-right 70
1480.
1481.\" --------------------------------------------------------------------
1482.\" LNS - left navigation start
1483.\"
1484.de LNS
1485. HTML</p> <table><tr><td "valign=""top""" \
1486 "width=""\\n[www-nav-width-left]%""" \
1487 "bgcolor=""\\*[www-nav-colour]"">"
1488. LK
1489. HTML</p> </td><td "valign=""top""" \
1490 "width=""\\n[www-nav-width-right]%"">"
1491. nr SH-open 1
1492..
92d0a6a6 1493.
4d3e9548
JL
1494.\" --------------------------------------------------------------------
1495.\" LNE - left navigation end
92d0a6a6 1496.\"
4d3e9548
JL
1497.de LNE
1498. HTML</p> </td></tr></table>
1499. HR
1500..
1501.
1502.nr SH-open 0
1503.nr needs-begin 0
1504.
1505.\"
1506.\" some auxiliary macros for left navigation lists
92d0a6a6 1507.\"
4d3e9548
JL
1508.de www-SH
1509. if (0\\$1 == 0) \{\
1510. if (\\n[SH-open] == 1) \
1511. LNE
1512. nr needs-begin 1
1513. @SH-old
1514. \}
1515..
92d0a6a6 1516.
4d3e9548
JL
1517.de www-NH
1518. if (0\\$1 <= 1) \{\
1519. if (\\n[SH-open] == 1) \
1520. LNE
1521. nr needs-begin 1
1522. @NH-old
1523. \}
1524..
1525.
1526.de www-LP
1527. @LP-old
1528. if (\\n[needs-begin] == 1) \{\
1529. HR
1530. LNS
1531. \}
1532. nr needs-begin 0
1533..
1534.
1535.\" --------------------------------------------------------------------
1536.\" ALN [colour] [left width percentage]
1537.\"
1538.\" Turn on automatic left navigation. This macro should only be
1539.\" called once (normally at the start of the document) as it
1540.\" indicates that all top-level section headings form a navigation
1541.\" list on the left of the main text.
1542.\"
1543.de ALN
1544. if '\*[.T]'html' \{\
1545. if !'\\$1'' \
1546. ds www-nav-colour \\$1\"
1547. if (0\\$2 > 0) \{\
1548. nr www-nav-width-left \\$2
1549. nr www-nav-width-right (100 - \\$2)
1550. \}
1551. rn @SH @SH-old
1552. rn www-SH @SH
1553. rn @NH @NH-old
1554. rn www-NH @NH
1555. rn @LP @LP-old
1556. rn www-LP @LP
1557. \}
92d0a6a6 1558..
4d3e9548
JL
1559.
1560.\" --------------------------------------------------------------------
1561.\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
92d0a6a6 1562.\"
4d3e9548
JL
1563.\" Initialize www.tmac so that when this macro set is used with
1564.\" non-HTML devices the urls are rendered the user defined attributes.
1565.\" For example:
92d0a6a6 1566.\"
4d3e9548
JL
1567.\" LINKSTYLE blue CR < >
1568.\"
1569.de LINKSTYLE
1570. if (\\n[.$] < 1) \
1571. www:error .\\$0 expects at least 1 argument.
1572. ds www:color \\$1\"
1573. shift
1574. if (\\n[.$] < 1) \
1575. return
1576. ds www:fontstyle \\$1\"
1577. shift
1578. if (\\n[.$] < 1) \
1579. www:error .\\$0 expects that both the open and close glyph is specified
1580. ds www:open \\$1\"
1581. ds www:close \\$2\"
1582..
92d0a6a6 1583.
4d3e9548
JL
1584.\" MATHML - enable eqn mathml output to pass through to the device
1585.\" driver
1586.
1587.de MATHML
1588. if (\\n[.O] == 0) \
1589. MATH<?p> \\$*
92d0a6a6
JR
1590..
1591.
4d3e9548
JL
1592.\" --------------------------------------------------------------------
1593.\" final setup
1594.\" --------------------------------------------------------------------
1595.
1596.LINKSTYLE blue C \[la] \[ra]
1597.
1598.if \n[www-html] \{\
1599. nh
1600. nr HY 0
1601.\}
1602.
92d0a6a6
JR
1603.if r ps4html .nop \O[0]
1604.cp \n(_C
1605.
1606.\" now set
1607.
1608.\" --------------------------------------------------------------------
1609.\" Emacs settings
1610.\" --------------------------------------------------------------------
1611.
1612.\" Local Variables:
1613.\" mode: nroff
1614.\" End:
1615.\" EOF