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
65 .\" set up www-image-template
67 .if !d www-image-template \
68 . ds www-image-template
71 . \" remove the title command when we are generating images for HTML
72 . \" (stops a title accidentally appearing inside an image)
82 .\" --------------------------------------------------------------------
83 .\" Test for `.substring'; result in register `www.substring_ok'.
84 .\" The automated break points in .URL addresses are only added if
85 .\" this register is non-zero.
87 .nr www:substring_ok 0
88 .de www:@test_substring
92 . substring \\$0:s 1 1
93 . if !'\\*[\\$0:s]'b' \{\
98 . substring \\$0:s 0 0
99 . if !'\\*[\\$0:s]'a' \{\
103 . ds \\$0:s abcdefg\"
104 . substring \\$0:s 1 -1
105 . if !'\\*[\\$0:s]'bcdefg' \{\
109 . nr www:substring_ok 1
113 .rm www:@test_substring
116 .\" --------------------------------------------------------------------
118 .\" --------------------------------------------------------------------
120 .\" --------------------------------------------------------------------
123 .\" Space before paragraph. Use \n[PD] if it exists.
134 .\" --------------------------------------------------------------------
135 .\" www:error (<test>...)
137 .\" Print error message.
140 . tm \\n[.F]:\\n[.c]: macro error: \\$*
143 .als www:error www-error
145 .\" --------------------------------------------------------------------
146 .\" www:lenstr (<register_name> <string_name>)
148 .\" Store length of string named <string_name> into register named
152 . if !(\\n[.$] == 2) \{\
153 . tm .\\$0 expects 2 arguments.
156 . length \\$0:n x\\*[\\$2]
157 . nr \\$1 (\\n[\\$0:n] - 1)
161 .\" --------------------------------------------------------------------
162 .\" www:splitstr (<name>)
164 .\" Add a space character between any two adjacent characters in string
165 .\" <name> and restore result into the string variable <name>; space
166 .\" characters are first replaced by the word `space'.
169 . if !(\\n[.$] == 1) \
170 . www:error .\\$0 expects 1 argument.
173 . ds \\$0:r "\\*[\\$1]\"
176 . ds \\$0:c "\\*[\\$0:r]\"
177 . substring \\$0:c 0 0
178 . ie '\\*[\\$0:c]' ' \
179 . as \\$0:s " space\"
181 . as \\$0:s " \\*[\\$0:c]\"
182 . www:lenstr \\$0:n \\$0:r
183 . if (\\n[\\$0:n] <= 1) \
185 . substring \\$0:r 1 -1
187 . if !'\\*[\\$0:s]'' \
188 . substring \\$0:s 1 -1
189 . ds \\$1 \\*[\\$0:s]\"
196 .\" --------------------------------------------------------------------
197 .\" www:url_breaks (<string_name>)
199 .\" Add `\:' (possible break point) within URL strings after `/'.
201 .\" Smart about multiple `/', existing `\:', and space characters;
202 .\" does not set a break point if less than 5 characters would go to
206 . if !(\\n[.$] == 1) \
207 . www:error .\\$0 expects 1 argument.
208 . if !\n[www:substring_ok] \
210 . ds \\$0:s "\\*[\\$1]\"
211 . www:splitstr \\$0:s
212 . www:url_breaks_split \\$0:s \\*[\\$0:s]
213 . ds \\$1 "\\*[\\$0:s]\"
217 .\" --------------------------------------------------------------------
218 .\" www:url_breaks_split (<result> <char> [<char>...])
220 .\" Add `\:' within URL strings, but arguments are a split string.
222 .\" Arguments: >=2: <result> <char> [<char>...]
224 .de www:url_breaks_split
225 . nr \\$0:min 5 \" minimal number of characters for next line
227 . www:error .\\$0 expects at least 2 arguments.
232 . while !\\n[\\$0:done] \{\
233 . if (\\n[.$] <= 0) \
235 . if '\\$1'space' \{\
240 . if (\\n[.$] < \\n[\\$0:min]) \{\
250 . \" we are at a `/' character
253 . if (\\n[.$] == 0) \{\
259 . if \\n[\\$0:done] \
261 . if (\\n[.$] < \\n[\\$0:min]) \
267 . ds \\*[\\$0:res] \\*[\\$0:s]\"
273 .\" --------------------------------------------------------------------
275 .\" --------------------------------------------------------------------
277 .\" --------------------------------------------------------------------
280 .\" The main auxiliary macro for the HTML interface.
283 . if \\n[www-html] \{\
284 . \" was implemented via .nop \&\X^html:\\$*^ but
285 . \" is now implemented using HTML-NS to utilize code factoring.
287 . \" the `\&' makes the vertical mode leave, so to say
296 .\" An auxiliary macro for HTML (without following space).
299 . nop \X^html:\\$*^\c
303 .\" Emit an HTML tag after shutting down a (possibly open) paragraph.
306 . ie \\n[www-html] \{\
307 . \" the `\&' makes the vertical mode leave, so to say
308 . nop \&\X^html</p>:\\$*^
315 .\" Emit an HTML tag. If text has been written in the paragraph
316 .\" then do not shut the paragraph down.
317 .\" If text was not written, remove the empty
318 .\" paragraph tag and emit the desired HTML tag.
322 . nop \&\X^html<?p>:\\$*^
326 .\" Emit a MATH tag. If text has been written in the paragraph
327 .\" then do not shut the paragraph down.
328 .\" If text was not written, remove the empty
329 .\" paragraph tag and emit the desired math tag.
333 . nop \&\X^math<?p>:\\$*^
336 .\" --------------------------------------------------------------------
339 .\" Automatic heading level cut off.
341 .\" N is the depth limit of automatically linked headings. So a depth
342 .\" of 2 would cause grohtml to generate a list of links for `.NH 1'
343 .\" and `.NH 2' but not for `.NH 3'.
350 .\" --------------------------------------------------------------------
351 .\" BCL foreground background active not-visited visited
354 . HTML <body "text=""\\$1""" \
361 .\" --------------------------------------------------------------------
365 . HTML <body "background=""\\$1"">"
368 .\" www:url_check_tag str
369 .\" If url named by \*[str] is internal (starts with #),
370 .\" redefine \*[str] to be the value of the string TAG_url.
372 .de www:url_check_tag
373 . ds \\$0:tmp \\*[\\$1]\"
374 . substring \\$0:tmp 0 0
375 . if '\\*[\\$0:tmp]'#' \{\
376 . ds \\$0:tmp \\*[\\$1]\"
377 . substring \\$0:tmp 1
378 . ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
380 . ie d \\*[\\$0:tmp] \
381 . ds \\$1 \\*[\\*[\\$0:tmp]]\"
383 . ds \\$1 see below\"
388 .\" --------------------------------------------------------------------
389 .\" URL url [description] [after]
391 .\" If description is absent then the url becomes the anchor text.
396 . www:url_check_tag \\$0:adr
397 . if !\\n[www-html] \
398 . www:url_breaks \\$0:adr
400 . ie \\n[www-html] \{\
404 . ds \\$0:after \&\\$3\"
407 . HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
409 . HTML-NS <a "href=""\\$1"">\\$2</a>"
411 . nop \\*[\\$0:after]
425 . nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
427 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
433 . nop \m[\\*[www:color]]\\$2\m[]\\$3
435 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
439 . nop \m[\\*[www:color]]\\$2\m[]
440 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
443 . nop \f[\\*[www:fontstyle]]\\$2\f[]
444 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
455 .\" --------------------------------------------------------------------
456 .\" FTP url description [after]
462 .\" --------------------------------------------------------------------
463 .\" MTO address description [after]
465 .\" ADDRESS is the email address (without the `mailto:' prefix).
467 .\" DESCRIPTION is the optional name. If an empty argument is given,
468 .\" ADDRESS is used instead.
470 .\" AFTER is optional stuff printed immediately after ADDRESS
471 .\" (resp. DESCRIPTION).
475 .\" Foobar has been written by
476 .\" .MTO fred@foo.bar "Fredrick Bloggs" .
479 . ie \\n[www-html] \{\
481 . URL mailto:\\$1 \\$1 "\\$3"
483 . URL mailto:\\$1 "\\$2" "\\$3"
493 . nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
495 . nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
501 . nop \m[\\*[www:color]]\\$2\m[]\\$3
503 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
507 . nop \m[\\*[www:color]]\\$2\m[]
508 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
511 . nop \f[\\*[www:fontstyle]]\\$2\f[]
512 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
519 .\" --------------------------------------------------------------------
522 .\" Generate an HTML name NAME.
523 .\" Define string TAG_NAME to TEXT, if present, otherwise to \n[PN].
526 . HTML <a "name=""\\$1""></a>"
528 . ds TAG_\\$1 \\n[PN]\"
533 .\" --------------------------------------------------------------------
534 .\" IMG [-R|-L|-C] filename [width] [height]
536 .\" Include an image of any type (only works for -Thtml).
538 .\" Alignment is centered by default (-C).
539 .\" Default value for WIDTH is 1i.
540 .\" If HEIGHT is not given, WIDTH is used as the height.
543 . ie \\n[www-html] \{\
545 . DEVTAG .right-image
550 . DEVTAG .centered-image
555 . nr www-height \\n[www-width]
558 . HTML <img "src=""\\$1""" \
559 "alt=""Image \\$1""" \
560 "width=""\\n[www-width]""" \
561 "height=""\\n[www-height]""\\*[www->]"
564 . nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
567 .\" --------------------------------------------------------------------
568 .\" PIMG [-R|-L|-C] filename [width] [height]
570 .\" Include a PNG image. It works for -Tps and -Thtml.
571 .\" The default value for WIDTH and HEIGHT is zero; the default
572 .\" alignment is centering (-C).
574 .\" Note: This macro can only be used with the `-U' option of groff,
575 .\" activating unsafe mode, if not used with -Thtml; the PNG image
576 .\" is then converted to the EPS format using netpbm utilities.
579 . ds www-pic-align -C\"
581 . ds www-pic-align -R\"
586 . ds www-pic-align -L\"
593 . ie \\n[www-html] \{\
594 . ds www-htmlalign align="center"\"
595 . if '\\*[www-pic-align]'-R' \
596 . ds www-htmlalign align="right"\"
597 . if '\\*[www-pic-align]'-L' \
598 . ds www-htmlalign align="left"\"
603 . nr www-width (\\$3 * 100 / 240)
605 . nr www-height (\\$4 * 100 / 240)
606 . ie (\\n[www-width] == 0) \{\
607 . ie (\\n[www-height] == 0) \
608 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
609 "alt=""Image \\$1""\\*[www->]</p>"
611 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
612 "alt=""Image \\$1""" \
613 "height=""\\n[www-height]""\\*[www->]</p>"
616 . ie (\\n[www-height] == 0) \
617 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
618 "alt=""Image \\$1""" \
619 "width=""\\n[www-width]""\\*[www->]</p>"
621 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
622 "alt=""Image \\$1""" \
623 "width=""\\n[www-width]""" \
624 "height=""\\n[www-height]""\\*[www->]</p>"
629 . www-make-unique-name
632 | @PNMTOPS_NOSETPAGE@ -noturn \
633 > \\*[www-unique-name].eps
635 . PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
640 .\" --------------------------------------------------------------------
641 .\" auxiliary definitions for MPIMG
643 .nr www-left-ll-trap 0
644 .nr www-left-po-trap 0
645 .nr www-right-ll-trap 0
647 .de www-finish-left-po
648 . po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
649 . wh \\n[www-left-po-trap]u
650 . nr www-left-indent 0
653 .\" called when the -R picture is finished
654 .de www-finish-right-ll
655 . ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
657 . \" now check whether we need to inline www-finish-left-ll
658 . if (\\n[www-left-ll-trap]u > 0) \
659 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
660 . mk www-left-po-trap
661 . nr www-left-po-trap +1v
662 . wh \\n[www-left-po-trap]u www-finish-left-po
663 . ll +\\n[www-left-indent]u
664 . wh \\n[www-left-ll-trap]u
665 . nr www-left-ll-trap 0
668 . \" and check whether we need to inline www-finish-left-po
669 . if (\\n[www-left-po-trap]u > 0) \
670 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
671 . po -\\n[www-left-indent]u
672 . wh \\n[www-left-po-trap]u
673 . nr www-left-indent 0
676 . wh \\n[www-right-ll-trap]u
677 . nr www-right-ll-trap 0
680 .de www-finish-left-ll
681 . if (\\n[www-right-ll-trap] > 0) \
682 . if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
683 . ll +\\n[www-right-indent]u
684 . nr www-right-ll-trap 0
687 . mk www-left-po-trap
688 . nr www-left-po-trap +1v
689 . wh \\n[www-left-po-trap]u www-finish-left-po
690 . ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
691 . wh \\n[www-left-ll-trap]u
692 . nr www-left-ll-trap 0
695 .\" www-handle-percent arg N1 N2 S1
696 .\" arg - input string (number or number%)
697 .\" output parameters:
698 .\" N1 - name of number register 1=absolute 0=percentage
699 .\" N2 - number register name for absolute value
700 .\" S1 - string register name for percentage value
702 .de www-handle-percent
703 . ds www-percent \\$1\"
704 . substring www-percent -1 -1
706 . ie '\\*[www-percent]'%' \{\
708 . substring www-abs 0 -2
710 . nr \\$3 \\*[www-abs]
720 .\" --------------------------------------------------------------------
721 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
723 .\" Include a PNG image and wrap text around it. It works for
724 .\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
725 .\" for HEIGHT is WIDTH; the default alignment is left (-L).
726 .\" -G is used to insert a gap between the text and the image.
727 .\" The height and width can also be given as a percentage.
728 .\" The PostScript device converts the percentage width into an
729 .\" absolute value by using \\n[.l], and the height by using \\n[.p].
732 .\" Note: This macro can only be used with the `-U' option of groff,
733 .\" activating unsafe mode, if not used with -Thtml; the PNG image
734 .\" is then converted to the EPS format using netpbm utilities.
736 .nr www-htmlimage-gap 0
739 . nr www-image-just 1
741 . while (\\n[.$] > 0) \{\
743 . nr www-image-just 1
748 . nr www-image-just 0
753 . nr www-image-gap \\$2
754 . nr www-htmlimage-gap (\\$2 * 100 / 240)
763 . ds www-size-specs width="\\n[www-width]" height="\\n[www-height]"\"
765 . nr www-is-absolute 0
767 . ds www-percentage none\"
768 . www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
769 . ie !\\n[www-is-absolute] \{\
770 . \" percentage of linelength requested
771 . nr www-width (\\n[www-absolute] * \\n[.l] / 100)
773 . nr www-width (\\n[www-width] * 100 / 240)
774 . ds www-size-specs width="\\*[www-percentage]"\"
777 . nr www-width \\n[www-absolute]
779 . nr www-width (\\n[www-width] * 100 / 240)
780 . ds www-size-specs width="\\n[www-width]"\"
783 . nr www-height \\n[www-width]
785 . nr www-is-absolute 0
787 . ds www-percentage none\"
788 . www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
789 . ie !\\n[www-is-absolute] \{\
790 . \" percentage of pagelength requested
791 . nr www-height (\\n[www-absolute] * \\n[.p] / 100)
793 . nr www-height (\\n[www-height] * 100 / 240)
794 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
797 . nr www-height \\n[www-absolute]
799 . nr www-height (\\n[www-height] * 100 / 240)
800 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-height]"\"
805 . \" height not specified; use width value
806 . ie !\\n[www-is-absolute] \{\
807 . \" percentage value
808 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
809 . nr www-height \\n[www-width]
812 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-width]"\"
813 . nr www-height \\n[www-width]
817 . ie \\n[www-html] \{\
818 . ie !\\n[www-image-just] \
819 . HTML <img "src=""\\$1""" \
820 "alt=""Image \\$1""" \
821 "hspace=""\\n[www-htmlimage-gap]""" \
823 "\\*[www-size-specs]\\*[www->]"
825 . HTML <img "src=""\\$1""" \
826 "alt=""Image \\$1""" \
827 "hspace=""\\n[www-htmlimage-gap]""" \
829 "\\*[www-size-specs]\\*[www->]"
832 . tm www-width is \\n[www-width]
833 . tm www-height is \\n[www-height]
835 . www-make-unique-name
838 | @PNMTOPS_NOSETPAGE@ -noturn \
839 > \\*[www-unique-name].eps
840 . ie !\\n[www-image-just] \{\
841 . \" we must now disable a possible left image trap
843 . if (\\n[www-left-ll-trap] > 0) \
844 . wh \\n[www-left-ll-trap]u
845 . if (\\n[www-left-po-trap] > 0) \
846 . wh \\n[www-left-po-trap]u
847 . PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
850 . nr www-right-indent \\n[ps-deswid]u
851 . \" we want to have some space between text and image,
852 . \" so the line length must be shorter
853 . ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
854 . mk www-right-ll-trap
855 . nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
856 . wh \\n[www-right-ll-trap]u www-finish-right-ll
858 . \" now restore possible left trap
859 . if (\\n[www-left-ll-trap] > 0) \
860 . wh \\n[www-left-ll-trap]u www-finish-left-ll
861 . if (\\n[www-left-po-trap] > 0) \
862 . wh \\n[www-left-po-trap]u
865 . \" we must now disable a possible right image trap
866 . if (\\n[www-right-ll-trap] > 0) \
867 . wh \\n[www-right-ll-trap]u
868 . PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
871 . nr www-left-indent \\n[ps-deswid]u
872 . \" increase offset by gap
873 . po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
874 . \" decrease line length by gap
875 . ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
876 . mk www-left-ll-trap
877 . nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
878 . wh \\n[www-left-ll-trap]u www-finish-left-ll
880 . \" now restore possible right trap
881 . if (\\n[www-right-ll-trap] > 0) \
882 . wh \\n[www-right-ll-trap]u www-finish-right-ll
888 .\" --------------------------------------------------------------------
891 .\" Begin heading. Heading level is N.
897 .\" If your heading contains URL, FTP, MTO macros you might wish to
898 .\" disable automatic links to headings. This can be done via `-P-l'
899 .\" from the command line or by using a cakk to `.HX 0'.
901 .nr www-heading-no -1
905 . nr www-heading-no 1
907 . nr www-heading-no \\$1
908 . DEVTAG-NH \\n[www-heading-no]
912 . if (\\n[www-heading-no] == -1) \
913 . www-error HnE found without a corresponding HnS
917 .\" --------------------------------------------------------------------
920 .\" Emit the automatically collected links derived from
921 .\" section/numbered headings at this position.
927 .\" --------------------------------------------------------------------
930 .\" Produce a horizontal line.
933 . HTML</p> <hr\\*[www->]
936 .\" --------------------------------------------------------------------
939 .\" Suppress the generation of the top and bottom rules which grohtml
940 .\" emits by default.
943 . DEVTAG .no-auto-rule
947 .\" www-end-nowhere - end of input trap called to finish diversion.
950 . if !\\n[www-html] \
955 .\" --------------------------------------------------------------------
958 .\" Generate an HTML title only. This differs from the -ms .TL macro
959 .\" which generates both an HTML title and an H1 heading.
961 .\" This is useful when an author wishes to use an HTML title as search
962 .\" engine fodder but a graphic title in the document.
964 .\" The macro terminates when a space or break is seen (.sp, .br).
968 . if !\\n[www-html] \
970 . it 2 www-end-nowhere
973 .\" --------------------------------------------------------------------
974 .\" auxiliary definitions for lists
976 .ds www-ul-level1 \[bu]\ \ \"
977 .ds www-ul-level2 \[sq]\ \ \"
978 .ds www-ul-level3 \[ci]\ \ \"
981 .ds www-ol-level1 decimal\"
982 .ds www-ol-level2 lower-alpha\"
983 .ds www-ol-level3 lower-roman\"
984 .ds www-ol-tmp 00\ \ \"
996 .\" allow nested lists
999 .nr www-li-indent \n[.i]
1000 .ds www-level0 nop\"
1011 .\" which macro to use for LI
1014 . ds www-level\\n[www-depth] \\$1\"
1015 . ds www-ltag\\n[www-depth]
1021 . als LI \\*[www-level\\n[www-depth]]
1024 .\" www-emit-ltag - shut down a previous open list tag
1025 .\" before issuing a new tag \\$1.
1026 .\" It then records tag \\$1 is open.
1029 . if !'\\*[www-ltag\\n[www-depth]]'' \
1030 . HTML-NS </\\*[www-ltag\\n[www-depth]]>
1033 . ds www-ltag\\n[www-depth] \\$1\"
1037 .\" Auxiliary macro for ULS.
1039 .de www-push-ul-level
1040 . nr www-ul-level +1
1041 . if (\\n[www-ul-level] > 3) \
1042 . www-error ULS: too many levels of indentation (\\n[www-ul-level])
1045 .\" Auxiliary macro for ULE.
1047 .de www-pop-ul-level
1048 . if !\\n[www-ul-level] \
1049 . www-error ULE: trying to terminate a list which does not exist
1050 . nr www-ul-level -1
1054 .\" Auxiliary macro for OLS.
1056 .de www-push-ol-level
1057 . nr www-ol-level +1
1058 . if (\\n[www-ol-level] > 3) \
1059 . www-error OLS: too many levels of indentation (\\n[www-ol-level])
1063 .\" Auxiliary macro for OLE.
1065 .de www-pop-ol-level
1066 . if !\\n[www-ol-level] \
1067 . www-error OLE: trying to terminate a list which does not exist
1068 . nr www-ol-level -1
1071 .\" --------------------------------------------------------------------
1074 .\" Start an unordered list.
1077 . www-push-li www-li-ul
1079 . ie \\n[www-html] \{\
1084 . nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1087 .\" --------------------------------------------------------------------
1090 .\" End an unordered list.
1093 . ie \\n[www-html] \{\
1098 . nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1099 . in \\n[www-li-indent]u
1105 .\" --------------------------------------------------------------------
1108 .\" Start an ordered list.
1111 . www-push-li www-li-ol
1113 . ie \\n[www-html] \{\
1115 . HTML</p> <ol "style=""list-style-type:" \
1116 "\\*[www-ol-level\\n[www-ol-level]]"">"
1119 . nr www-li-indent +\w'\\*[www-ol-tmp]'u
1122 .\" --------------------------------------------------------------------
1125 .\" End an ordered list.
1128 . ie \\n[www-html] \{\
1133 . nr www-li-indent -\w'\\*[www-ol-tmp]'u
1134 . in \\n[www-li-indent]u
1135 . nr www-ol-ctr\\n[www-ol-level] 0 1
1141 .\" --------------------------------------------------------------------
1144 .\" Start a definition list.
1147 . www-push-li www-li-dl
1148 . nr www-dl-level +1
1149 . ie \\n[www-html] \{\
1154 . nr www-li-indent +\\n[www-dl-shift]u
1155 . in \\n[www-li-indent]u
1159 .\" --------------------------------------------------------------------
1162 .\" End a definition list.
1165 . ie \\n[www-html] \{\
1170 . nr www-li-indent -\\n[www-dl-shift]u
1171 . in \\n[www-li-indent]u
1173 . nr www-dl-level -1
1177 .\" --------------------------------------------------------------------
1180 .\" Insert a list item.
1184 .\" www-li-ul - bulleted list item
1187 . ie \\n[www-html] \
1191 . in \\n[www-li-indent]u
1192 . ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1193 . nop \\*[www-ul-level\\n[www-ul-level]]\c
1198 .\" www-li-ol - numbered list item
1201 . ie \\n[www-html] \
1205 . in \\n[www-li-indent]u
1206 . ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1207 . nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
1212 .\" www-li-dl - definition list item
1215 . ie \\n[www-html] \{\
1216 . HTML <dt>\\$1</dt>
1221 . in \\n[www-li-indent]u
1222 . ti -\\n[www-dl-shift]u
1228 .\" --------------------------------------------------------------------
1229 .\" DC l text [color]
1231 .\" L is the letter to be dropped and enlarged.
1233 .\" TEXT is the following text whose height the first letter should not
1236 .\" COLOR is the optional color of the dropped letter (default black).
1239 . ds www-dropcolor black\"
1241 . ds www-dropcolor \\$3\"
1242 . ie '\*[.T]'html' \{\
1243 . www-make-unique-name
1244 . nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1245 . MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1249 . www-make-unique-name
1250 . \" To avoid interferences with another DC macro call which is located
1251 . \" very near to the current one, we draw the glyph on a separate page.
1252 . \" Otherwise it could theoretically happen that the dropped capital
1253 . \" glyphs overlap.
1257 . nop \O[5i\\*[www-unique-name].png]\O[1]
1258 . nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1268 . nr dummy \w'\\$1'u
1269 . nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1270 . char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1271 . nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1280 .\" supplementary macros used by other macro sets
1282 .\" here are some tags specially for -Tps or -Thtml when invoked by
1283 .\" pre-html to generate PNG images from postscript.
1285 .\" --------------------------------------------------------------------
1286 .\" HTML-DO-IMAGE - tell troff to issue an image marker which can be
1287 .\" read back by pre-html
1291 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1292 . if \\n[www-html] \
1293 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1296 .\" --------------------------------------------------------------------
1297 .\" HTML-IMAGE-END - terminate an image for HTML
1301 . nop \O[4]\O[2]\O[0]
1302 . if \\n[www-html] \
1303 . nop \O[4]\O[2]\O[1]
1308 .\" --------------------------------------------------------------------
1309 .\" www-make-unique-name - generate another unique name in string
1310 .\" `www-unique-name'
1312 .de www-make-unique-name
1314 . ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1317 .\" --------------------------------------------------------------------
1318 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1319 .\" to be rendered as an image.
1322 . \" generates a centered image
1323 . www-make-unique-name
1324 . HTML-DO-IMAGE \\*[www-unique-name] c
1327 .de HTML-IMAGE-RIGHT
1328 . www-make-unique-name
1329 . HTML-DO-IMAGE \\*[www-unique-name] r
1333 . www-make-unique-name
1334 . HTML-DO-IMAGE \\*[www-unique-name] l
1337 .de HTML-IMAGE-INLINE
1338 . www-make-unique-name
1339 . HTML-DO-IMAGE \\*[www-unique-name] i
1342 .\" EQN-HTML-IMAGE and friends check to see whether the equation is
1343 .\" not in an image, in which case it allows HTML
1344 .\" (mathml) to be generated (if -Txhtml was specified).
1347 . \" generates a centered image
1348 . www-make-unique-name
1349 . EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1352 .de EQN-HTML-IMAGE-RIGHT
1353 . www-make-unique-name
1354 . EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1357 .de EQN-HTML-IMAGE-LEFT
1358 . www-make-unique-name
1359 . EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1362 .de EQN-HTML-IMAGE-INLINE
1363 . www-make-unique-name
1364 . EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1367 .\" --------------------------------------------------------------------
1368 .\" EQN-HTML-DO-IMAGE - tell troff to issue an image marker which can be
1369 .\" read back by pre-html
1371 .de EQN-HTML-DO-IMAGE
1373 . if !(\\n[.O] == 0) \{\
1375 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1376 . if \\n[www-html] \
1377 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1381 . HTML-DO-IMAGE \\$*
1384 .\" --------------------------------------------------------------------
1385 .\" EQN-HTML-IMAGE-END - terminate an image for HTML
1387 .de EQN-HTML-IMAGE-END
1389 . if !(\\n[.O] == 0) \{\
1391 . nop \O[4]\O[2]\O[0]
1392 . if \\n[www-html] \
1393 . nop \O[4]\O[2]\O[1]
1400 .\" --------------------------------------------------------------------
1401 .\" Setup around HTML-IMAGE and friends
1403 .\" now set up TS, TE, EQ, EN default macros
1405 .\" we must not use `.als': the definition of .TE in s.tmac, for example,
1406 .\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1407 .\" causing an endless loop
1411 . nop \\*[HTML-IMAGE]\\
1416 . nop \\*[HTML-IMAGE-END]\\
1421 . nop \\*[EQN-HTML-IMAGE]\\
1426 . nop \\*[EQN-HTML-IMAGE-END]\\
1430 .\" --------------------------------------------------------------------
1433 .\" Generate multiple output files containing the HTML.
1434 .\" A file is split whenever a .SH or .NH 1 is encountered.
1435 .\" The argument to JOBNAME is the file stem for future output files.
1438 . DEVTAG .job-name \\$1
1441 .\" --------------------------------------------------------------------
1444 .\" Add information to the <head> </head> section of the HTML
1448 . DEVTAG .head "\\$*"
1451 .\" --------------------------------------------------------------------
1452 .\" start of some code
1459 .\" --------------------------------------------------------------------
1460 .\" end of some code
1467 .ds www-nav-colour #eeeeee\"
1468 .nr www-nav-width-left 30
1469 .nr www-nav-width-right 70
1471 .\" --------------------------------------------------------------------
1472 .\" LNS - left navigation start
1475 . HTML</p> <table><tr><td "valign=""top""" \
1476 "width=""\\n[www-nav-width-left]%""" \
1477 "bgcolor=""\\*[www-nav-colour]"">"
1479 . HTML</p> </td><td "valign=""top""" \
1480 "width=""\\n[www-nav-width-right]%"">"
1484 .\" --------------------------------------------------------------------
1485 .\" LNE - left navigation end
1488 . HTML</p> </td></tr></table>
1496 .\" some auxiliary macros for left navigation lists
1499 . if (0\\$1 == 0) \{\
1500 . if (\\n[SH-open] == 1) \
1508 . if (0\\$1 <= 1) \{\
1509 . if (\\n[SH-open] == 1) \
1518 . if (\\n[needs-begin] == 1) \{\
1525 .\" --------------------------------------------------------------------
1526 .\" ALN [colour] [left width percentage]
1528 .\" Turn on automatic left navigation. This macro should only be
1529 .\" called once (normally at the start of the document) as it
1530 .\" indicates that all top-level section headings form a navigation
1531 .\" list on the left of the main text.
1534 . if '\*[.T]'html' \{\
1536 . ds www-nav-colour \\$1\"
1537 . if (0\\$2 > 0) \{\
1538 . nr www-nav-width-left \\$2
1539 . nr www-nav-width-right (100 - \\$2)
1550 .\" --------------------------------------------------------------------
1551 .\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
1553 .\" Initialize www.tmac so that when this macro set is used with
1554 .\" non-HTML devices the urls are rendered the user defined attributes.
1557 .\" LINKSTYLE blue CR < >
1560 . if (\\n[.$] < 1) \
1561 . www:error .\\$0 expects at least 1 argument.
1562 . ds www:color \\$1\"
1564 . if (\\n[.$] < 1) \
1566 . ds www:fontstyle \\$1\"
1568 . if (\\n[.$] < 1) \
1569 . www:error .\\$0 expects that both the open and close glyph is specified
1570 . ds www:open \\$1\"
1571 . ds www:close \\$2\"
1574 .\" MATHML - enable eqn mathml output to pass through to the device
1578 . if (\\n[.O] == 0) \
1582 .\" --------------------------------------------------------------------
1584 .\" --------------------------------------------------------------------
1586 .LINKSTYLE blue C \[la] \[ra]
1588 .if \n[www-html] \{\
1593 .if r ps4html .nop \O[0]
1598 .\" --------------------------------------------------------------------
1600 .\" --------------------------------------------------------------------
1602 .\" Local Variables: