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