2 www.tmac - macro package for adding HTML elements to roff documents.
4 File position: <groff_source_top>/tmac/www.tmac
5 Installed position: groff's main macro directory.
7 ------------------------------------------------------------------------
9 ------------------------------------------------------------------------
11 This file is part of groff, the GNU roff type-setting system.
13 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008
14 Free Software Foundation, Inc.
15 written by Gaius Mulley <gaius@glam.ac.uk>, with additions by
16 Werner Lemberg <wl@gnu.org> and Bernd Warken <bwarken@mayn.de>.
18 groff is free software; you can redistribute it and/or modify it under
19 the terms of the GNU General Public License as published by the Free
20 Software Foundation; either version 2, or (at your option) any later
23 groff is distributed in the hope that it will be useful, but WITHOUT
24 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 You should have received a copy of the GNU General Public License
29 along with groff; see the file COPYING. If not, write to the Free
30 Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA
34 ------------------------------------------------------------------------
36 ------------------------------------------------------------------------
38 A simple set of macros to provide HTML (or XHTML) documents with basic
39 www functionality. It should work with any macro set. In the following,
40 HTML always denotes XHTML also.
44 .\" --------------------------------------------------------------------
46 .\" --------------------------------------------------------------------
48 .do if d www:lenstr .nx
57 .if '\*[.T]'html' .nr www-html 1
59 .\" set up www-image-template
61 .if !d www-image-template \
62 . ds www-image-template
65 . \" remove the title command when we are generating images for html
66 . \" (stops a title accidentally appearing inside an image)
76 .\" --------------------------------------------------------------------
77 .\" Test for `.substring'; result in register `www.substring_ok'.
78 .\" The automated break points in .URL addresses are only added if
79 .\" this register is non-zero.
81 .nr www:substring_ok 0
82 .de www:@test_substring
86 . substring \\$0:s 1 1
87 . if !'\\*[\\$0:s]'b' \{\
92 . substring \\$0:s 0 0
93 . if !'\\*[\\$0:s]'a' \{\
98 . substring \\$0:s 1 -1
99 . if !'\\*[\\$0:s]'bcdefg' \{\
103 . nr www:substring_ok 1
107 .rm www:@test_substring
110 .\" --------------------------------------------------------------------
112 .\" --------------------------------------------------------------------
114 .\" --------------------------------------------------------------------
117 .\" Space before paragraph. Use \n[PD] if it exists.
121 . ie r PD .sp \\n[PD]u
122 . el .sp \\n[www:pd]u
125 .\" --------------------------------------------------------------------
126 .\" www:error (<test>...)
128 .\" Print error message
131 . tm \\n[.F]:\\n[.c]: macro error: \\$*
133 .als www:error www-error
135 .\" --------------------------------------------------------------------
136 .\" www:lenstr (<register_name> <string_name>)
138 .\" Store length of string named <string_name> into register named
142 . if !(\\n[.$] == 2) \{\
143 . tm .\\$0 expects 2 arguments.
146 . length \\$0:n x\\*[\\$2]
147 . nr \\$1 (\\n[\\$0:n]-1)
151 .\" --------------------------------------------------------------------
152 .\" www:splitstr (<name>)
154 .\" Add a space character between any two adjacent characters in string
155 .\" <name> and restore result into the string variable <name>; space
156 .\" characters are first replaced by the word `space'.
159 . if !(\\n[.$] == 1) \
160 . www:error .\\$0 expects 1 argument.
163 . ds \\$0:r "\\*[\\$1]\""
166 . ds \\$0:c "\\*[\\$0:r]\""
167 . substring \\$0:c 0 0\"
168 . ie '\\*[\\$0:c]' ' \
169 . as \\$0:s " space\""
171 . as \\$0:s " \\*[\\$0:c]\""
172 . www:lenstr \\$0:n \\$0:r
173 . if (\\n[\\$0:n] <= 1) \{\
176 . substring \\$0:r 1 -1\"
178 . if !'\\*[\\$0:s]'' \
179 . substring \\$0:s 1 -1
180 . ds \\$1 \\*[\\$0:s]\"
187 .\" --------------------------------------------------------------------
188 .\" www:url_breaks (<string_name>)
190 .\" Add `\:' (possible break point) within URL strings after `/'.
192 .\" Smart about multiple `/', existing `\:', and space characters;
193 .\" does not set a break point if less than 5 characters would go to
197 . if !(\\n[.$] == 1) \
198 . www:error .\\$0 expects 1 argument.
199 . if !\n[www:substring_ok] \
201 . ds \\$0:s "\\*[\\$1]\""
202 . www:splitstr \\$0:s
203 . www:url_breaks_splitted \\$0:s \\*[\\$0:s]
204 . ds \\$1 "\\*[\\$0:s]\""
208 .\" --------------------------------------------------------------------
209 .\" www:url_breaks_splitted (<result> <char> [<char>...])
211 .\" Add `\:' within URL strings, but arguments are a splitted string.
213 .\" Arguments: >=2: <result> <char> [<char>...]
215 .de www:url_breaks_splitted
216 . nr \\$0:min 5 \" minimal number of characters for next line
218 . www:error .\\$0 expects at least 2 arguments.
223 . while !\\n[\\$0:done] \{\
224 . if (\\n[.$] <= 0) \{\
228 . if '\\$1'space' \{\
233 . if (\\n[.$] < \\n[\\$0:min]) \{\
243 . \" we are at a `/' character
246 . if (\\n[.$] == 0) \{\
252 . if \\n[\\$0:done] \
254 . if (\\n[.$] < \\n[\\$0:min]) \
260 . ds \\*[\\$0:res] \\*[\\$0:s]\"
266 .\" --------------------------------------------------------------------
268 .\" --------------------------------------------------------------------
270 .\" --------------------------------------------------------------------
273 .\" the main auxiliary macro for the HTML interface
276 . if \\n[www-html] \{\
277 . \" was implemented via .nop \&\X^html:\\$*^ but
278 . \" is now implemented using HTML-NS to utilize code factoring.
280 . \" the `\&' makes the vertical mode leave, so to say
289 .\" an auxiliary macro for HTML (without following space)
292 . nop \X^html:\\$*^\c
296 .\" emit a HTML tag after shutting down a (possibly open) paragraph
299 . if \\n[www-html] \{\
300 . \" the `\&' makes the vertical mode leave, so to say
301 . nop \&\X^html</p>:\\$*^
306 .\" emit an HTML tag. If text has been written in the paragraph
307 .\" then do not shut the paragraph down.
308 .\" If text was not written, remove the empty
309 .\" paragraph tag and emit the desired html tag.
312 . if \\n[www-html] .nop \&\X^html<?p>:\\$*^
316 .\" emit a MATH tag. If text has been written in the paragraph
317 .\" then do not shut the paragraph down.
318 .\" If text was not written, remove the empty
319 .\" paragraph tag and emit the desired math tag.
322 . if \\n[www-html] .nop \&\X^math<?p>:\\$*^
325 .\" --------------------------------------------------------------------
328 .\" Automatic heading level cut off.
330 .\" N is the depth limit of automatically linked headings. So a depth
331 .\" of 2 would cause grohtml to generate a list of links for `.NH 1'
332 .\" and `.NH 2' but not for `.NH 3'.
339 .\" --------------------------------------------------------------------
340 .\" BCL foreground background active not-visited visited
343 . HTML <body text=\\$1 \
350 .\" --------------------------------------------------------------------
354 . HTML <body background=\\$1>
357 .\" www:url_check_tag str
358 .\" If url named by \*[str] is internal (starts with #),
359 .\" redefine \*[str] to be the value of the string TAG_url.
361 .de www:url_check_tag
362 . ds \\$0:tmp \\*[\\$1]\"
363 . substring \\$0:tmp 0 0
364 . if '\\*[\\$0:tmp]'#' \{\
365 . ds \\$0:tmp \\*[\\$1]\"
366 . substring \\$0:tmp 1
367 . ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
368 . ie !'\\*[\\*[\\$0:tmp]]'' \
369 . ds \\$1 \\*[\\*[\\$0:tmp]]\"
371 . ds \\$1 see below\"
376 .\" --------------------------------------------------------------------
377 .\" URL url [description] [after]
378 .\" if description is absent then the url becomes the anchor text
383 . www:url_check_tag \\$0:adr
384 . if !\\n[www-html] .www:url_breaks \\$0:adr
386 . ie \\n[www-html] \{\
390 . ds \\$0:after \&\\$3\"
392 . HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
394 . HTML-NS <a "href=""\\$1"">\\$2</a>"
395 . nop \\*[\\$0:after]
399 . if !r ps4html .ad l
407 . nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
409 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
415 . nop \m[\\*[www:color]]\\$2\m[]\\$3
417 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
421 . nop \m[\\*[www:color]]\\$2\m[]
422 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
425 . nop \f[\\*[www:fontstyle]]\\$2\f[]
426 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
435 .\" --------------------------------------------------------------------
436 .\" FTP url description [after]
442 .\" --------------------------------------------------------------------
443 .\" MTO address description [after]
445 .\" ADDRESS is the email address (without the `mailto:' prefix).
447 .\" DESCRIPTION is the optional name. If an empty argument is given,
448 .\" ADDRESS is used instead.
450 .\" AFTER is optional stuff printed immediately after ADDRESS
451 .\" (resp. DESCRIPTION).
455 .\" Foobar has been written by
456 .\" .MTO fred@foo.bar "Fredrick Bloggs" .
459 . ie \\n[www-html] \{\
461 . URL mailto:\\$1 \\$1 "\\$3"
463 . URL mailto:\\$1 "\\$2" "\\$3"
473 . nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
475 . nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
481 . nop \m[\\*[www:color]]\\$2\m[]\\$3
483 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
487 . nop \m[\\*[www:color]]\\$2\m[]
488 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
491 . nop \f[\\*[www:fontstyle]]\\$2\f[]
492 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
499 .\" --------------------------------------------------------------------
502 .\" Generate an html name NAME.
503 .\" Define string TAG_NAME to TEXT, if present,
504 .\" otherwise to \n[PN].
508 . HTML <a "name=""\\$1""></a>"
510 . ds TAG_\\$1 \\n[PN]
515 .\" --------------------------------------------------------------------
516 .\" IMG [-R|-L|-C] filename [width] [height]
518 .\" Include an image of any type (only works for -Thtml).
520 .\" Alignment is centered by default (-C).
521 .\" Default value for WIDTH is 1i.
522 .\" If HEIGHT is not given, WIDTH is used as the height.
525 . ie \\n[www-html] \{\
527 . DEVTAG .right-image
532 . DEVTAG .centered-image
537 . nr www-height \\n[www-width]
540 . HTML <img src="\\$1" alt="Image \\$1" \
541 "width=""\\n[www-width]""" \
542 "height=""\\n[www-height]"""></img>
545 . nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
548 .\" --------------------------------------------------------------------
549 .\" PIMG [-R|-L|-C] filename [width] [height]
551 .\" Include a png image. It works for -Tps and -Thtml.
552 .\" The default value for WIDTH and HEIGHT is zero; the default
553 .\" alignment is centering (-C).
555 .\" Note: This macro can only be used with the `-U' option of groff,
556 .\" activating unsafe mode, if not used with -Thtml; the PNG image
557 .\" is then converted to the EPS format using netpbm utilities.
560 . ds www-pic-align -C\"
562 . ds www-pic-align -R\"
567 . ds www-pic-align -L\"
574 . ie \\n[www-html] \{\
575 . ds www-htmlalign align=center\"
576 . if '\\*[www-pic-align]'-R' \
577 . ds www-htmlalign align=right\"
578 . if '\\*[www-pic-align]'-L' \
579 . ds www-htmlalign align=left\"
583 . nr www-width (\\$3 * 100 / 240)
585 . nr www-height (\\$4 * 100 / 240)
586 . ie (\\n[www-width] == 0) \{\
587 . ie (\\n[www-height] == 0) \
588 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
589 "alt=""Image \\$1"""></img></p>"
591 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
592 "alt=""Image \\$1""" \
593 "height=""\\n[www-height]"""></img></p>
596 . ie (\\n[www-height] == 0) \
597 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
598 "alt=""Image \\$1""" \
599 "width=""\\n[www-width]"""></img></p>
601 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
602 "alt=""Image \\$1""" \
603 "width=""\\n[www-width]""" \
604 "height=""\\n[www-height]"""></img></p>
609 . www-make-unique-name
612 | @PNMTOPS_NOSETPAGE@ -noturn \
613 > \\*[www-unique-name].eps
615 . PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
620 .\" --------------------------------------------------------------------
621 .\" auxiliary definitions for MPIMG
623 .nr www-left-ll-trap 0
624 .nr www-left-po-trap 0
625 .nr www-right-ll-trap 0
627 .de www-finish-left-po
628 . po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
629 . wh \\n[www-left-po-trap]u
630 . nr www-left-indent 0
633 .\" called when the -R picture is finished
634 .de www-finish-right-ll
635 . ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
636 . \" now see whether we need to inline www-finish-left-ll
637 . if (\\n[www-left-ll-trap]u > 0) \
638 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
639 . mk www-left-po-trap
640 . nr www-left-po-trap +1v
641 . wh \\n[www-left-po-trap]u www-finish-left-po
642 . ll +\\n[www-left-indent]u
643 . wh \\n[www-left-ll-trap]u
644 . nr www-left-ll-trap 0
646 . \" and see whether we need to inline www-finish-left-po
647 . if (\\n[www-left-po-trap]u > 0) \
648 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
649 . po -\\n[www-left-indent]u
650 . wh \\n[www-left-po-trap]u
651 . nr www-left-indent 0
653 . wh \\n[www-right-ll-trap]u
654 . nr www-right-ll-trap 0
657 .de www-finish-left-ll
658 . if (\\n[www-right-ll-trap] > 0) \
659 . if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
660 . ll +\\n[www-right-indent]u
661 . nr www-right-ll-trap 0
663 . mk www-left-po-trap
664 . nr www-left-po-trap +1v
665 . wh \\n[www-left-po-trap]u www-finish-left-po
666 . ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
667 . wh \\n[www-left-ll-trap]u
668 . nr www-left-ll-trap 0
671 .\" www-handle-percent arg N1 N2 S1
672 .\" arg - input string (number or number%)
673 .\" output parameters:
674 .\" N1 - name of number register 1=absolute 0=percentage
675 .\" N2 - number register name for absolute value
676 .\" S1 - string register name for percentage value
678 .de www-handle-percent
679 . ds www-percent \\$1\"
680 . substring www-percent -1 -1
682 . ie '\\*[www-percent]'%' \{\
684 . substring www-abs 0 -2
686 . nr \\$3 \\*[www-abs]
696 .\" --------------------------------------------------------------------
697 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
699 .\" Include a png image and wrap text around it. It works for
700 .\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
701 .\" for HEIGHT is WIDTH; the default alignment is left (-L).
702 .\" -G is used to insert a gap between the text and the image.
703 .\" The height and width can also be given as a percentage.
704 .\" The PostScript device converts the percentage width into an
705 .\" absolute value by using \\n[.l], and the height by using \\n[.p].
708 .\" Note: This macro can only be used with the `-U' option of groff,
709 .\" activating unsafe mode, if not used with -Thtml; the PNG image
710 .\" is then converted to the EPS format using netpbm utilities.
712 .nr www-htmlimage-gap 0
715 . nr www-image-just 1
717 . while (\\n[.$] > 0) \{\
719 . nr www-image-just 1
724 . nr www-image-just 0
729 . nr www-image-gap \\$2
730 . nr www-htmlimage-gap (\\$2 * 100 / 240)
739 . ds www-size-specs width=""\\n[www-width]" height="\\n[www-height]"
741 . nr www-is-absolute 0
743 . ds www-percentage none\"
744 . www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
745 . ie !\\n[www-is-absolute] \{\
746 . \" percentage of linelength requested
747 . nr www-width (\\n[www-absolute] * \\n[.l] / 100)
749 . nr www-width (\\n[www-width] * 100 / 240)
750 . ds www-size-specs width=\"\\*[www-percentage]"
753 . nr www-width \\n[www-absolute]
755 . nr www-width (\\n[www-width] * 100 / 240)
756 . ds www-size-specs width=\"\\n[www-width]"
759 . nr www-height \\n[www-width]
761 . nr www-is-absolute 0
763 . ds www-percentage none\"
764 . www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
765 . ie !\\n[www-is-absolute] \{\
766 . \" percentage of pagelength requested
767 . nr www-height (\\n[www-absolute] * \\n[.p] / 100)
769 . nr www-height (\\n[www-height] * 100 / 240)
770 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"
773 . nr www-height \\n[www-absolute]
775 . nr www-height (\\n[www-height] * 100 / 240)
776 . ds www-size-specs "\\*[www-size-specs] "height="\\*[www-height]"
781 . \" height not specified; use width value
782 . ie !\\n[www-is-absolute] \{\
783 . \" percentage value
784 . ds www-size-specs "\\*[www-size-specs] "height="\\*[www-percentage]"
785 . nr www-height \\n[www-width]
788 . ds www-size-specs "\\*[www-size-specs] "height="\\*[www-width]"
789 . nr www-height \\n[www-width]
793 . ie \\n[www-html] \{\
794 . ie !\\n[www-image-just] \
795 . HTML <img "src=""\\$1""" \
796 "alt=""Image \\$1""" \
797 "hspace=""\\n[www-htmlimage-gap]""" \
798 "align=""right"" \\*[www-size-specs]"""></img>
800 . HTML <img "src=""\\$1""" \
801 "alt=""Image \\$1""" \
802 "hspace=""\\n[www-htmlimage-gap]""" \
803 "align=""left"" \\*[www-size-specs]"""></img>
806 . tm www-width is \\n[www-width]
807 . tm www-height is \\n[www-height]
809 . www-make-unique-name
812 | @PNMTOPS_NOSETPAGE@ -noturn \
813 > \\*[www-unique-name].eps
814 . ie !\\n[www-image-just] \{\
815 . \" we must now disable a possible left image trap
817 . if (\\n[www-left-ll-trap] > 0) \
818 . wh \\n[www-left-ll-trap]u
819 . if (\\n[www-left-po-trap] > 0) \
820 . wh \\n[www-left-po-trap]u
821 . PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
823 . nr www-right-indent \\n[ps-deswid]u
824 . \" we want to have some space between text and image,
825 . \" so the line length must be shorter
826 . ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
827 . mk www-right-ll-trap
828 . nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
829 . wh \\n[www-right-ll-trap]u www-finish-right-ll
830 . \" now restore possible left trap
831 . if (\\n[www-left-ll-trap] > 0) \
832 . wh \\n[www-left-ll-trap]u www-finish-left-ll
833 . if (\\n[www-left-po-trap] > 0) \
834 . wh \\n[www-left-po-trap]u
837 . \" we must now disable a possible right image trap
838 . if (\\n[www-right-ll-trap] > 0) \
839 . wh \\n[www-right-ll-trap]u
840 . PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
842 . nr www-left-indent \\n[ps-deswid]u
843 . \" increase offset by gap
844 . po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
845 . \" decrease line length by gap
846 . ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
847 . mk www-left-ll-trap
848 . nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
849 . wh \\n[www-left-ll-trap]u www-finish-left-ll
850 . \" now restore possible right trap
851 . if (\\n[www-right-ll-trap] > 0) \
852 . wh \\n[www-right-ll-trap]u www-finish-right-ll
858 .\" --------------------------------------------------------------------
861 .\" Begin heading. Heading level is N.
867 .\" If your heading contains URL, FTP, MTO macros you might wish to
868 .\" disable automatic links to headings. This can be done via `-P-l'
869 .\" from the command line or by using a cakk to `.HX 0'.
871 .nr www-heading-no -1
875 . nr www-heading-no 1
877 . nr www-heading-no \\$1
878 . DEVTAG-NH \\n[www-heading-no]
882 . if (\\n[www-heading-no] == -1) \
883 . www-error HnE found without a corresponding HnS
887 .\" --------------------------------------------------------------------
890 .\" Emit the automatically collected links derived from
891 .\" section/numbered headings at this position.
897 .\" --------------------------------------------------------------------
900 .\" Produce a horizontal line.
906 .\" --------------------------------------------------------------------
909 .\" Suppresses the generation of the top and bottom rules which grohtml
910 .\" emits by default.
913 . DEVTAG .no-auto-rule
917 .\" www-end-nowhere - end of input trap called to finish diversion.
920 . if !\\n[www-html] \
925 .\" --------------------------------------------------------------------
928 .\" Generate an HTML title only. This differs from the -ms .TL macro
929 .\" which generates both an HTML title and an H1 heading.
931 .\" This is useful when an author wishes to use a HTML title as search
932 .\" engine fodder but a graphic title in the document.
934 .\" The macro terminates when a space or break is seen (.sp, .br).
938 . if !\\n[www-html] \
940 . it 2 www-end-nowhere
943 .\" --------------------------------------------------------------------
944 .\" auxiliary definitions for lists
946 .ds www-ul-level1 \[bu]\ \ \"
947 .ds www-ul-level2 \[sq]\ \ \"
948 .ds www-ul-level3 \[ci]\ \ \"
951 .ds www-ol-level1 decimal\"
952 .ds www-ol-level2 lower-alpha\"
953 .ds www-ol-level3 lower-roman\"
954 .ds www-ol-tmp 00\ \ \"
966 .\" allow nested lists
969 .nr www-li-indent \n[.i]
981 .\" which macro to use for LI
984 . ds www-level\\n[www-depth] \\$1\"
985 . ds www-ltag\\n[www-depth]
991 . als LI \\*[www-level\\n[www-depth]]
994 .\" www-emit-ltag - shuts down a previous open list tag
995 .\" before issuing a new tag \\$1.
996 .\" It then records tag \\$1 is open.
999 . if !'\\*[www-ltag\\n[www-depth]]'' \
1000 . HTML-NS </\\*[www-ltag\\n[www-depth]]>
1003 . ds www-ltag\\n[www-depth] \\$1
1007 .\" Auxiliary macro for ULS.
1009 .de www-push-ul-level
1010 . nr www-ul-level +1
1011 . if (\\n[www-ul-level] > 3) \
1012 . www-error ULS: too many levels of indentation (\\n[www-ul-level])
1015 .\" Auxiliary macro for ULE.
1017 .de www-pop-ul-level
1018 . if !\\n[www-ul-level] \
1019 . www-error ULE: trying to terminate a list which does not exist
1020 . nr www-ul-level -1
1024 .\" Auxiliary macro for OLS.
1026 .de www-push-ol-level
1027 . nr www-ol-level +1
1028 . if (\\n[www-ol-level] > 3) \
1029 . www-error OLS: too many levels of indentation (\\n[www-ol-level])
1033 .\" Auxiliary macro for OLE.
1035 .de www-pop-ol-level
1036 . if !\\n[www-ol-level] \
1037 . www-error OLE: trying to terminate a list which does not exist
1038 . nr www-ol-level -1
1041 .\" --------------------------------------------------------------------
1044 .\" Start an unordered list.
1047 . www-push-li www-li-ul
1049 . ie \\n[www-html] \{\
1054 . nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1057 .\" --------------------------------------------------------------------
1060 .\" End an unordered list.
1063 . ie \\n[www-html] \{\
1068 . nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1069 . in \\n[www-li-indent]u
1075 .\" --------------------------------------------------------------------
1078 .\" Start an ordered list.
1081 . www-push-li www-li-ol
1083 . ie \\n[www-html] \{\
1085 . HTML</p> <ol "style=""list-style-type:" \
1086 "\\*[www-ol-level\\n[www-ol-level]]"">"
1089 . nr www-li-indent +\w'\\*[www-ol-tmp]'u
1092 .\" --------------------------------------------------------------------
1095 .\" End an ordered list.
1098 . ie \\n[www-html] \{\
1103 . nr www-li-indent -\w'\\*[www-ol-tmp]'u
1104 . in \\n[www-li-indent]u
1105 . nr www-ol-ctr\\n[www-ol-level] 0 1
1111 .\" --------------------------------------------------------------------
1114 .\" Start a definition list.
1117 . www-push-li www-li-dl
1118 . nr www-dl-level +1
1119 . ie \\n[www-html] \{\
1124 . nr www-li-indent +\\n[www-dl-shift]u
1125 . in \\n[www-li-indent]u
1129 .\" --------------------------------------------------------------------
1132 .\" End a definition list.
1135 . ie \\n[www-html] \{\
1140 . nr www-li-indent -\\n[www-dl-shift]u
1141 . in \\n[www-li-indent]u
1143 . nr www-dl-level -1
1147 .\" --------------------------------------------------------------------
1150 .\" Insert a list item.
1153 .\" www-li-ul - bulleted list item
1156 . ie \\n[www-html] \
1160 . in \\n[www-li-indent]u
1161 . ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1162 . nop \\*[www-ul-level\\n[www-ul-level]]\c
1167 .\" www-li-ol - numbered list item
1170 . ie \\n[www-html] \
1174 . in \\n[www-li-indent]u
1175 . ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1176 . nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
1181 .\" www-li-dl - definition list item
1184 . ie \\n[www-html] \{\
1185 . HTML <dt>\\$1</dt>
1190 . in \\n[www-li-indent]u
1191 . ti -\\n[www-dl-shift]u
1197 .\" --------------------------------------------------------------------
1198 .\" DC l text [color]
1200 .\" L is the letter to be dropped and enlarged.
1202 .\" TEXT is the following text whose height the first letter should not
1205 .\" COLOR is the optional color of the dropped letter (default black).
1208 . ds www-dropcolor black\"
1210 . ds www-dropcolor \\$3\"
1211 . ie '\*[.T]'html' \{\
1212 . www-make-unique-name
1213 . nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1214 . MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1218 . www-make-unique-name
1219 . \" To avoid interferences with another DC macro call which is located
1220 . \" very near to the current one, we draw the glyph on a separate page.
1221 . \" Otherwise it could theoretically happen that the dropped capital
1222 . \" glyphs overlap.
1226 . nop \O[5i\\*[www-unique-name].png]\O[1]
1227 . nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1237 . nr dummy \w'\\$1'u
1238 . nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1239 . char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1240 . nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1249 .\" supplementary macros used by other macro sets
1251 .\" here are some tags specially for -Tps or -Thtml when invoked by
1252 .\" pre-html to generate png images from postscript.
1254 .\" --------------------------------------------------------------------
1255 .\" HTML-DO-IMAGE - tells troff to issue an image marker which can be
1256 .\" read back by pre-html
1260 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1261 . if \\n[www-html] \
1262 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1265 .\" --------------------------------------------------------------------
1266 .\" HTML-IMAGE-END - terminates an image for html
1270 . nop \O[4]\O[2]\O[0]
1271 . if \\n[www-html] \
1272 . nop \O[4]\O[2]\O[1]
1277 .\" --------------------------------------------------------------------
1278 .\" www-make-unique-name - generates another unique name in string
1279 .\" `www-unique-name'
1281 .de www-make-unique-name
1283 . ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1286 .\" --------------------------------------------------------------------
1287 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1288 .\" to be rendered as an image.
1291 . \" generates a centered image
1292 . www-make-unique-name
1293 . HTML-DO-IMAGE \\*[www-unique-name] c
1296 .de HTML-IMAGE-RIGHT
1297 . www-make-unique-name
1298 . HTML-DO-IMAGE \\*[www-unique-name] r
1302 . www-make-unique-name
1303 . HTML-DO-IMAGE \\*[www-unique-name] l
1306 .de HTML-IMAGE-INLINE
1307 . www-make-unique-name
1308 . HTML-DO-IMAGE \\*[www-unique-name] i
1311 .\" EQN-HTML-IMAGE and friends check to see whether the equation is
1312 .\" not in an image, in which case it allows html
1313 .\" (mathml) to be generated (if -Txhtml was specified).
1316 . \" generates a centered image
1317 . www-make-unique-name
1318 . EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1321 .de EQN-HTML-IMAGE-RIGHT
1322 . www-make-unique-name
1323 . EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1326 .de EQN-HTML-IMAGE-LEFT
1327 . www-make-unique-name
1328 . EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1331 .de EQN-HTML-IMAGE-INLINE
1332 . www-make-unique-name
1333 . EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1336 .\" --------------------------------------------------------------------
1337 .\" EQN-HTML-DO-IMAGE - tells troff to issue an image marker which can be
1338 .\" read back by pre-html
1340 .de EQN-HTML-DO-IMAGE
1342 . if !(\\n[.O] == 0) \{\
1344 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1345 . if \\n[www-html] \
1346 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1349 . el .HTML-DO-IMAGE \\$*
1352 .\" --------------------------------------------------------------------
1353 .\" EQN-HTML-IMAGE-END - terminates an image for html
1355 .de EQN-HTML-IMAGE-END
1357 . if !(\\n[.O] == 0) \{\
1359 . nop \O[4]\O[2]\O[0]
1360 . if \\n[www-html] \
1361 . nop \O[4]\O[2]\O[1]
1364 . el .HTML-IMAGE-END
1367 .\" --------------------------------------------------------------------
1368 .\" Setup around HTML-IMAGE and friends
1370 .\" now set up TS, TE, EQ, EN default macros
1372 .\" we must not use `.als': the definition of .TE in s.tmac, for example,
1373 .\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1374 .\" causing an endless loop
1378 . nop \\*[HTML-IMAGE]\\
1383 . nop \\*[HTML-IMAGE-END]\\
1388 . nop \\*[EQN-HTML-IMAGE]\\
1393 . nop \\*[EQN-HTML-IMAGE-END]\\
1397 .\" --------------------------------------------------------------------
1400 .\" Generate multiple output files containing the html.
1401 .\" A file is split whenever a .SH or .NH 1 is encountered.
1402 .\" The argument to JOBNAME is the file stem for future output files.
1405 . DEVTAG .job-name \\$1
1408 .\" --------------------------------------------------------------------
1411 .\" Adds information to the <head> </head> section of the html
1413 .\" --------------------------------------------------------------------
1415 . DEVTAG .head "\\$*"
1418 .\" --------------------------------------------------------------------
1419 .\" start of some code
1426 .\" --------------------------------------------------------------------
1427 .\" end of some code
1434 .ds www-nav-colour #eeeeee\"
1435 .nr www-nav-width-left 30
1436 .nr www-nav-width-right 70
1438 .\" --------------------------------------------------------------------
1439 .\" LNS - left navigation start
1442 . HTML</p> <table><tr><td valign=top \
1443 width=\\n[www-nav-width-left]% \
1444 "bgcolor=""\\*[www-nav-colour]"">"
1446 . HTML</p> </td><td valign=top \
1447 width=\\n[www-nav-width-right]%>
1451 .\" --------------------------------------------------------------------
1452 .\" LNE - left navigation end
1455 . HTML</p> </td></tr></table>
1463 .\" some auxiliary macros for left navigation lists
1466 . if (0\\$1 == 0) \{\
1467 . if (\\n[SH-open] == 1) \
1475 . if (0\\$1 <= 1) \{\
1476 . if (\\n[SH-open] == 1) \
1485 . if (\\n[needs-begin] == 1) \{\
1492 .\" --------------------------------------------------------------------
1493 .\" ALN [colour] [left width percentage]
1495 .\" Turn on automatic left navigation. This macro should only be
1496 .\" called once (normally at the start of the document) as it
1497 .\" indicates that all top-level section headings form a navigation
1498 .\" list on the left of the main text.
1501 . if '\*[.T]'html' \{\
1503 . ds www-nav-colour \\$1\"
1504 . if (0\\$2 > 0) \{\
1505 . nr www-nav-width-left \\$2
1506 . nr www-nav-width-right (100 - \\$2)
1517 .\" --------------------------------------------------------------------
1518 .\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
1520 .\" Initializes www.tmac so that when this macro set is used with
1521 .\" non-HTML devices the urls are rendered the user defined attributes.
1524 .\" LINKSTYLE blue CR < >
1527 . if (\\n[.$] < 1) \
1528 . www:error .\\$0 expects at least 1 argument.
1529 . ds www:color \\$1\"
1531 . if (\\n[.$] < 1) \
1533 . ds www:fontstyle \\$1\"
1535 . if (\\n[.$] < 1) \
1536 . www:error .\\$0 expects that both the open and close glyph is specified
1537 . ds www:open \\$1\"
1538 . ds www:close \\$2\"
1541 .\" MATHML - enable eqn mathml output to pass through to the device
1545 . if (\\n[.O] == 0) .MATH<?p> \\$*
1548 .\" --------------------------------------------------------------------
1550 .\" --------------------------------------------------------------------
1552 .LINKSTYLE blue C \[la] \[ra]
1554 .if \n[www-html] \{\
1559 .if r ps4html .nop \O[0]
1564 .\" --------------------------------------------------------------------
1566 .\" --------------------------------------------------------------------
1568 .\" Local Variables: