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-2014 Free Software Foundation, Inc.
14 written by Gaius Mulley <gaius@glam.ac.uk>, with additions by
15 Werner Lemberg <wl@gnu.org> and
16 Bernd Warken <groff-bernd.warken-72@web.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 3 of the License, or
21 (at your option) any later version.
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 this program. If not, see <http://www.gnu.org/licenses/>.
32 ------------------------------------------------------------------------
34 ------------------------------------------------------------------------
36 A simple set of macros to provide HTML (or XHTML) documents with basic
37 www functionality. It should work with any macro set. In the following,
38 HTML always denotes XHTML also.
42 .\" --------------------------------------------------------------------
44 .\" --------------------------------------------------------------------
46 .do if d www:lenstr .nx
63 .\" set up www-image-template
65 .if !d www-image-template \
66 . ds www-image-template
69 . \" remove the title command when we are generating images for HTML
70 . \" (stops a title accidentally appearing inside an image)
80 .\" --------------------------------------------------------------------
81 .\" Test for `.substring'; result in register `www.substring_ok'.
82 .\" The automated break points in .URL addresses are only added if
83 .\" this register is non-zero.
85 .nr www:substring_ok 0
86 .de www:@test_substring
90 . substring \\$0:s 1 1
91 . if !'\\*[\\$0:s]'b' \{\
96 . substring \\$0:s 0 0
97 . if !'\\*[\\$0:s]'a' \{\
101 . ds \\$0:s abcdefg\"
102 . substring \\$0:s 1 -1
103 . if !'\\*[\\$0:s]'bcdefg' \{\
107 . nr www:substring_ok 1
111 .rm www:@test_substring
114 .\" --------------------------------------------------------------------
116 .\" --------------------------------------------------------------------
118 .\" --------------------------------------------------------------------
121 .\" Space before paragraph. Use \n[PD] if it exists.
132 .\" --------------------------------------------------------------------
133 .\" www:error (<test>...)
135 .\" Print error message.
138 . tm \\n[.F]:\\n[.c]: macro error: \\$*
141 .als www:error www-error
143 .\" --------------------------------------------------------------------
144 .\" www:lenstr (<register_name> <string_name>)
146 .\" Store length of string named <string_name> into register named
150 . if !(\\n[.$] == 2) \{\
151 . tm .\\$0 expects 2 arguments.
154 . length \\$0:n x\\*[\\$2]
155 . nr \\$1 (\\n[\\$0:n] - 1)
159 .\" --------------------------------------------------------------------
160 .\" www:splitstr (<name>)
162 .\" Add a space character between any two adjacent characters in string
163 .\" <name> and restore result into the string variable <name>; space
164 .\" characters are first replaced by the word `space'.
167 . if !(\\n[.$] == 1) \
168 . www:error .\\$0 expects 1 argument.
171 . ds \\$0:r "\\*[\\$1]\"
174 . ds \\$0:c "\\*[\\$0:r]\"
175 . substring \\$0:c 0 0
176 . ie '\\*[\\$0:c]' ' \
177 . as \\$0:s " space\"
179 . as \\$0:s " \\*[\\$0:c]\"
180 . www:lenstr \\$0:n \\$0:r
181 . if (\\n[\\$0:n] <= 1) \
183 . substring \\$0:r 1 -1
185 . if !'\\*[\\$0:s]'' \
186 . substring \\$0:s 1 -1
187 . ds \\$1 \\*[\\$0:s]\"
194 .\" --------------------------------------------------------------------
195 .\" www:url_breaks (<string_name>)
197 .\" Add `\:' (possible break point) within URL strings after `/'.
199 .\" Smart about multiple `/', existing `\:', and space characters;
200 .\" does not set a break point if less than 5 characters would go to
204 . if !(\\n[.$] == 1) \
205 . www:error .\\$0 expects 1 argument.
206 . if !\n[www:substring_ok] \
208 . ds \\$0:s "\\*[\\$1]\"
209 . www:splitstr \\$0:s
210 . www:url_breaks_split \\$0:s \\*[\\$0:s]
211 . ds \\$1 "\\*[\\$0:s]\"
215 .\" --------------------------------------------------------------------
216 .\" www:url_breaks_split (<result> <char> [<char>...])
218 .\" Add `\:' within URL strings, but arguments are a split string.
220 .\" Arguments: >=2: <result> <char> [<char>...]
222 .de www:url_breaks_split
223 . nr \\$0:min 5 \" minimal number of characters for next line
225 . www:error .\\$0 expects at least 2 arguments.
230 . while !\\n[\\$0:done] \{\
231 . if (\\n[.$] <= 0) \
233 . if '\\$1'space' \{\
238 . if (\\n[.$] < \\n[\\$0:min]) \{\
248 . \" we are at a `/' character
251 . if (\\n[.$] == 0) \{\
257 . if \\n[\\$0:done] \
259 . if (\\n[.$] < \\n[\\$0:min]) \
265 . ds \\*[\\$0:res] \\*[\\$0:s]\"
271 .\" --------------------------------------------------------------------
273 .\" --------------------------------------------------------------------
275 .\" --------------------------------------------------------------------
278 .\" The main auxiliary macro for the HTML interface.
281 . if \\n[www-html] \{\
282 . \" was implemented via .nop \&\X^html:\\$*^ but
283 . \" is now implemented using HTML-NS to utilize code factoring.
285 . \" the `\&' makes the vertical mode leave, so to say
294 .\" An auxiliary macro for HTML (without following space).
297 . nop \X^html:\\$*^\c
301 .\" Emit an HTML tag after shutting down a (possibly open) paragraph.
304 . ie \\n[www-html] \{\
305 . \" the `\&' makes the vertical mode leave, so to say
306 . nop \&\X^html</p>:\\$*^
313 .\" Emit an HTML tag. If text has been written in the paragraph
314 .\" then do not shut the paragraph down.
315 .\" If text was not written, remove the empty
316 .\" paragraph tag and emit the desired HTML tag.
320 . nop \&\X^html<?p>:\\$*^
324 .\" Emit a MATH tag. If text has been written in the paragraph
325 .\" then do not shut the paragraph down.
326 .\" If text was not written, remove the empty
327 .\" paragraph tag and emit the desired math tag.
331 . nop \&\X^math<?p>:\\$*^
334 .\" --------------------------------------------------------------------
337 .\" Automatic heading level cut off.
339 .\" N is the depth limit of automatically linked headings. So a depth
340 .\" of 2 would cause grohtml to generate a list of links for `.NH 1'
341 .\" and `.NH 2' but not for `.NH 3'.
348 .\" --------------------------------------------------------------------
349 .\" BCL foreground background active not-visited visited
352 . HTML <body "text=""\\$1""" \
359 .\" --------------------------------------------------------------------
363 . HTML <body "background=""\\$1"">"
366 .\" www:url_check_tag str
367 .\" If url named by \*[str] is internal (starts with #),
368 .\" redefine \*[str] to be the value of the string TAG_url.
370 .de www:url_check_tag
371 . ds \\$0:tmp \\*[\\$1]\"
372 . substring \\$0:tmp 0 0
373 . if '\\*[\\$0:tmp]'#' \{\
374 . ds \\$0:tmp \\*[\\$1]\"
375 . substring \\$0:tmp 1
376 . ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
378 . ie d \\*[\\$0:tmp] \
379 . ds \\$1 \\*[\\*[\\$0:tmp]]\"
381 . ds \\$1 see below\"
386 .\" --------------------------------------------------------------------
387 .\" URL url [description] [after]
389 .\" If description is absent then the url becomes the anchor text.
394 . www:url_check_tag \\$0:adr
395 . if !\\n[www-html] \
396 . www:url_breaks \\$0:adr
398 . ie \\n[www-html] \{\
402 . ds \\$0:after \&\\$3\"
405 . HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
407 . HTML-NS <a "href=""\\$1"">\\$2</a>"
409 . nop \\*[\\$0:after]
423 . nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
425 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
431 . nop \m[\\*[www:color]]\\$2\m[]\\$3
433 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
437 . nop \m[\\*[www:color]]\\$2\m[]
438 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
441 . nop \f[\\*[www:fontstyle]]\\$2\f[]
442 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
453 .\" --------------------------------------------------------------------
454 .\" FTP url description [after]
460 .\" --------------------------------------------------------------------
461 .\" MTO address description [after]
463 .\" ADDRESS is the email address (without the `mailto:' prefix).
465 .\" DESCRIPTION is the optional name. If an empty argument is given,
466 .\" ADDRESS is used instead.
468 .\" AFTER is optional stuff printed immediately after ADDRESS
469 .\" (resp. DESCRIPTION).
473 .\" Foobar has been written by
474 .\" .MTO fred@foo.bar "Fredrick Bloggs" .
477 . ie \\n[www-html] \{\
479 . URL mailto:\\$1 \\$1 "\\$3"
481 . URL mailto:\\$1 "\\$2" "\\$3"
491 . nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
493 . nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
499 . nop \m[\\*[www:color]]\\$2\m[]\\$3
501 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
505 . nop \m[\\*[www:color]]\\$2\m[]
506 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
509 . nop \f[\\*[www:fontstyle]]\\$2\f[]
510 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
517 .\" --------------------------------------------------------------------
520 .\" Generate an HTML name NAME.
521 .\" Define string TAG_NAME to TEXT, if present, otherwise to \n[PN].
522 .\" Register PN is the current page number.
525 . HTML <a "name=""\\$1""></a>"
529 . ds TAG_\\$1 \\n[PN]\"
534 .\" --------------------------------------------------------------------
535 .\" IMG [-R|-L|-C] filename [width] [height]
537 .\" Include an image of any type (only works for -Thtml).
539 .\" Alignment is centered by default (-C).
540 .\" Default value for WIDTH is 1i.
541 .\" If HEIGHT is not given, WIDTH is used as the height.
544 . ie \\n[www-html] \{\
546 . DEVTAG .right-image
551 . DEVTAG .centered-image
556 . nr www-height \\n[www-width]
559 . HTML <img "src=""\\$1""" \
560 "alt=""Image \\$1""" \
561 "width=""\\n[www-width]""" \
562 "height=""\\n[www-height]""\\*[www->]"
565 . nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
568 .\" --------------------------------------------------------------------
569 .\" PIMG [-R|-L|-C] filename [width] [height]
571 .\" Include a PNG image. It works for -Tps and -Thtml.
572 .\" The default value for WIDTH and HEIGHT is zero; the default
573 .\" alignment is centering (-C).
575 .\" Note: This macro can only be used with the `-U' option of groff,
576 .\" activating unsafe mode, if not used with -Thtml; the PNG image
577 .\" is then converted to the EPS format using netpbm utilities.
580 . ds www-pic-align -C\"
582 . ds www-pic-align -R\"
587 . ds www-pic-align -L\"
594 . ie \\n[www-html] \{\
595 . ds www-htmlalign align="center"\"
596 . if '\\*[www-pic-align]'-R' \
597 . ds www-htmlalign align="right"\"
598 . if '\\*[www-pic-align]'-L' \
599 . ds www-htmlalign align="left"\"
604 . nr www-width (\\$3 * 100 / 240)
606 . nr www-height (\\$4 * 100 / 240)
607 . ie (\\n[www-width] == 0) \{\
608 . ie (\\n[www-height] == 0) \
609 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
610 "alt=""Image \\$1""\\*[www->]</p>"
612 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
613 "alt=""Image \\$1""" \
614 "height=""\\n[www-height]""\\*[www->]</p>"
617 . ie (\\n[www-height] == 0) \
618 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
619 "alt=""Image \\$1""" \
620 "width=""\\n[www-width]""\\*[www->]</p>"
622 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
623 "alt=""Image \\$1""" \
624 "width=""\\n[www-width]""" \
625 "height=""\\n[www-height]""\\*[www->]</p>"
630 . www-make-unique-name
633 | @PNMTOPS_NOSETPAGE@ -noturn \
634 > \\*[www-unique-name].eps
636 . PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
641 .\" --------------------------------------------------------------------
642 .\" auxiliary definitions for MPIMG
644 .nr www-left-ll-trap 0
645 .nr www-left-po-trap 0
646 .nr www-right-ll-trap 0
648 .de www-finish-left-po
649 . po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
650 . wh \\n[www-left-po-trap]u
651 . nr www-left-indent 0
654 .\" called when the -R picture is finished
655 .de www-finish-right-ll
656 . ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
658 . \" now check whether we need to inline www-finish-left-ll
659 . if (\\n[www-left-ll-trap]u > 0) \
660 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
661 . mk www-left-po-trap
662 . nr www-left-po-trap +1v
663 . wh \\n[www-left-po-trap]u www-finish-left-po
664 . ll +\\n[www-left-indent]u
665 . wh \\n[www-left-ll-trap]u
666 . nr www-left-ll-trap 0
669 . \" and check whether we need to inline www-finish-left-po
670 . if (\\n[www-left-po-trap]u > 0) \
671 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
672 . po -\\n[www-left-indent]u
673 . wh \\n[www-left-po-trap]u
674 . nr www-left-indent 0
677 . wh \\n[www-right-ll-trap]u
678 . nr www-right-ll-trap 0
681 .de www-finish-left-ll
682 . if (\\n[www-right-ll-trap] > 0) \
683 . if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
684 . ll +\\n[www-right-indent]u
685 . nr www-right-ll-trap 0
688 . mk www-left-po-trap
689 . nr www-left-po-trap +1v
690 . wh \\n[www-left-po-trap]u www-finish-left-po
691 . ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
692 . wh \\n[www-left-ll-trap]u
693 . nr www-left-ll-trap 0
696 .\" www-handle-percent arg N1 N2 S1
697 .\" arg - input string (number or number%)
698 .\" output parameters:
699 .\" N1 - name of number register 1=absolute 0=percentage
700 .\" N2 - number register name for absolute value
701 .\" S1 - string register name for percentage value
703 .de www-handle-percent
704 . ds www-percent \\$1\"
705 . substring www-percent -1 -1
707 . ie '\\*[www-percent]'%' \{\
709 . substring www-abs 0 -2
711 . nr \\$3 \\*[www-abs]
721 .\" --------------------------------------------------------------------
722 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
724 .\" Include a PNG image and wrap text around it. It works for
725 .\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
726 .\" for HEIGHT is WIDTH; the default alignment is left (-L).
727 .\" -G is used to insert a gap between the text and the image.
728 .\" The height and width can also be given as a percentage.
729 .\" The PostScript device converts the percentage width into an
730 .\" absolute value by using \\n[.l], and the height by using \\n[.p].
733 .\" Note: This macro can only be used with the `-U' option of groff,
734 .\" activating unsafe mode, if not used with -Thtml; the PNG image
735 .\" is then converted to the EPS format using netpbm utilities.
737 .nr www-htmlimage-gap 0
740 . nr www-image-just 1
742 . while (\\n[.$] > 0) \{\
744 . nr www-image-just 1
749 . nr www-image-just 0
754 . nr www-image-gap \\$2
755 . nr www-htmlimage-gap (\\$2 * 100 / 240)
764 . ds www-size-specs width="\\n[www-width]" height="\\n[www-height]"\"
766 . nr www-is-absolute 0
768 . ds www-percentage none\"
769 . www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
770 . ie !\\n[www-is-absolute] \{\
771 . \" percentage of linelength requested
772 . nr www-width (\\n[www-absolute] * \\n[.l] / 100)
774 . nr www-width (\\n[www-width] * 100 / 240)
775 . ds www-size-specs width="\\*[www-percentage]"\"
778 . nr www-width \\n[www-absolute]
780 . nr www-width (\\n[www-width] * 100 / 240)
781 . ds www-size-specs width="\\n[www-width]"\"
784 . nr www-height \\n[www-width]
786 . nr www-is-absolute 0
788 . ds www-percentage none\"
789 . www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
790 . ie !\\n[www-is-absolute] \{\
791 . \" percentage of pagelength requested
792 . nr www-height (\\n[www-absolute] * \\n[.p] / 100)
794 . nr www-height (\\n[www-height] * 100 / 240)
795 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
798 . nr www-height \\n[www-absolute]
800 . nr www-height (\\n[www-height] * 100 / 240)
801 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-height]"\"
806 . \" height not specified; use width value
807 . ie !\\n[www-is-absolute] \{\
808 . \" percentage value
809 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
810 . nr www-height \\n[www-width]
813 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-width]"\"
814 . nr www-height \\n[www-width]
818 . ie \\n[www-html] \{\
819 . ie !\\n[www-image-just] \
820 . HTML <img "src=""\\$1""" \
821 "alt=""Image \\$1""" \
822 "hspace=""\\n[www-htmlimage-gap]""" \
824 "\\*[www-size-specs]\\*[www->]"
826 . HTML <img "src=""\\$1""" \
827 "alt=""Image \\$1""" \
828 "hspace=""\\n[www-htmlimage-gap]""" \
830 "\\*[www-size-specs]\\*[www->]"
833 . tm www-width is \\n[www-width]
834 . tm www-height is \\n[www-height]
836 . www-make-unique-name
839 | @PNMTOPS_NOSETPAGE@ -noturn \
840 > \\*[www-unique-name].eps
841 . ie !\\n[www-image-just] \{\
842 . \" we must now disable a possible left image trap
844 . if (\\n[www-left-ll-trap] > 0) \
845 . wh \\n[www-left-ll-trap]u
846 . if (\\n[www-left-po-trap] > 0) \
847 . wh \\n[www-left-po-trap]u
848 . PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
851 . nr www-right-indent \\n[ps-deswid]u
852 . \" we want to have some space between text and image,
853 . \" so the line length must be shorter
854 . ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
855 . mk www-right-ll-trap
856 . nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
857 . wh \\n[www-right-ll-trap]u www-finish-right-ll
859 . \" now restore possible left trap
860 . if (\\n[www-left-ll-trap] > 0) \
861 . wh \\n[www-left-ll-trap]u www-finish-left-ll
862 . if (\\n[www-left-po-trap] > 0) \
863 . wh \\n[www-left-po-trap]u
866 . \" we must now disable a possible right image trap
867 . if (\\n[www-right-ll-trap] > 0) \
868 . wh \\n[www-right-ll-trap]u
869 . PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
872 . nr www-left-indent \\n[ps-deswid]u
873 . \" increase offset by gap
874 . po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
875 . \" decrease line length by gap
876 . ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
877 . mk www-left-ll-trap
878 . nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
879 . wh \\n[www-left-ll-trap]u www-finish-left-ll
881 . \" now restore possible right trap
882 . if (\\n[www-right-ll-trap] > 0) \
883 . wh \\n[www-right-ll-trap]u www-finish-right-ll
889 .\" --------------------------------------------------------------------
892 .\" Begin heading. Heading level is N.
898 .\" If your heading contains URL, FTP, MTO macros you might wish to
899 .\" disable automatic links to headings. This can be done via `-P-l'
900 .\" from the command line or by using a cakk to `.HX 0'.
902 .nr www-heading-no -1
906 . nr www-heading-no 1
908 . nr www-heading-no \\$1
909 . DEVTAG-NH \\n[www-heading-no]
913 . if (\\n[www-heading-no] == -1) \
914 . www-error HnE found without a corresponding HnS
918 .\" --------------------------------------------------------------------
921 .\" Emit the automatically collected links derived from
922 .\" section/numbered headings at this position.
928 .\" --------------------------------------------------------------------
931 .\" Produce a horizontal line.
934 . HTML</p> <hr\\*[www->]
937 .\" --------------------------------------------------------------------
940 .\" Suppress the generation of the top and bottom rules which grohtml
941 .\" emits by default.
944 . DEVTAG .no-auto-rule
948 .\" www-end-nowhere - end of input trap called to finish diversion.
951 . if !\\n[www-html] \
956 .\" --------------------------------------------------------------------
959 .\" Generate an HTML title only. This differs from the -ms .TL macro
960 .\" which generates both an HTML title and an H1 heading.
962 .\" This is useful when an author wishes to use an HTML title as search
963 .\" engine fodder but a graphic title in the document.
965 .\" The macro terminates when a space or break is seen (.sp, .br).
969 . if !\\n[www-html] \
971 . it 2 www-end-nowhere
974 .\" --------------------------------------------------------------------
975 .\" auxiliary definitions for lists
977 .ds www-ul-level1 \[bu]\ \ \"
978 .ds www-ul-level2 \[sq]\ \ \"
979 .ds www-ul-level3 \[ci]\ \ \"
982 .ds www-ol-level1 decimal\"
983 .ds www-ol-level2 lower-alpha\"
984 .ds www-ol-level3 lower-roman\"
985 .ds www-ol-tmp 00\ \ \"
997 .\" allow nested lists
1000 .nr www-li-indent \n[.i]
1001 .ds www-level0 nop\"
1012 .\" which macro to use for LI
1014 . nr www-li-indent \\n[.i]
1016 . ds www-level\\n[www-depth] \\$1\"
1017 . ds www-ltag\\n[www-depth]
1023 . als LI \\*[www-level\\n[www-depth]]
1026 .\" www-emit-ltag - shut down a previous open list tag
1027 .\" before issuing a new tag \\$1.
1028 .\" It then records tag \\$1 is open.
1031 . if !'\\*[www-ltag\\n[www-depth]]'' \
1032 . HTML-NS </\\*[www-ltag\\n[www-depth]]>
1035 . ds www-ltag\\n[www-depth] \\$1\"
1039 .\" Auxiliary macro for ULS.
1041 .de www-push-ul-level
1042 . nr www-ul-level +1
1043 . if (\\n[www-ul-level] > 3) \
1044 . www-error ULS: too many levels of indentation (\\n[www-ul-level])
1047 .\" Auxiliary macro for ULE.
1049 .de www-pop-ul-level
1050 . if !\\n[www-ul-level] \
1051 . www-error ULE: trying to terminate a list which does not exist
1052 . nr www-ul-level -1
1056 .\" Auxiliary macro for OLS.
1058 .de www-push-ol-level
1059 . nr www-ol-level +1
1060 . if (\\n[www-ol-level] > 3) \
1061 . www-error OLS: too many levels of indentation (\\n[www-ol-level])
1065 .\" Auxiliary macro for OLE.
1067 .de www-pop-ol-level
1068 . if !\\n[www-ol-level] \
1069 . www-error OLE: trying to terminate a list which does not exist
1070 . nr www-ol-level -1
1073 .\" --------------------------------------------------------------------
1076 .\" Start an unordered list.
1079 . www-push-li www-li-ul
1081 . ie \\n[www-html] \{\
1086 . nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1089 .\" --------------------------------------------------------------------
1092 .\" End an unordered list.
1095 . ie \\n[www-html] \{\
1100 . nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1101 . in \\n[www-li-indent]u
1107 .\" --------------------------------------------------------------------
1110 .\" Start an ordered list.
1113 . www-push-li www-li-ol
1115 . ie \\n[www-html] \{\
1117 . HTML</p> <ol "style=""list-style-type:" \
1118 "\\*[www-ol-level\\n[www-ol-level]]"">"
1121 . nr www-li-indent +\w'\\*[www-ol-tmp]'u
1124 .\" --------------------------------------------------------------------
1127 .\" End an ordered list.
1130 . ie \\n[www-html] \{\
1135 . nr www-li-indent -\w'\\*[www-ol-tmp]'u
1136 . in \\n[www-li-indent]u
1137 . nr www-ol-ctr\\n[www-ol-level] 0 1
1143 .\" --------------------------------------------------------------------
1146 .\" Start a definition list.
1149 . www-push-li www-li-dl
1150 . nr www-dl-level +1
1151 . ie \\n[www-html] \{\
1156 . nr www-li-indent +\\n[www-dl-shift]u
1157 . in \\n[www-li-indent]u
1161 .\" --------------------------------------------------------------------
1164 .\" End a definition list.
1167 . ie \\n[www-html] \{\
1172 . nr www-li-indent -\\n[www-dl-shift]u
1173 . in \\n[www-li-indent]u
1175 . nr www-dl-level -1
1179 .\" --------------------------------------------------------------------
1182 .\" Insert a list item.
1186 .\" www-li-ul - bulleted list item
1189 . ie \\n[www-html] \
1195 . in \\n[www-li-indent]u
1196 . ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1197 . nop \\*[www-ul-level\\n[www-ul-level]]\c
1202 .\" www-li-ol - numbered list item
1205 . ie \\n[www-html] \
1211 . in \\n[www-li-indent]u
1212 . ti -\w'\\n+[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1213 . nop \\n[www-ol-ctr\\n[www-ol-level]]\ \ \c
1218 .\" www-li-dl - definition list item
1221 . ie \\n[www-html] \{\
1222 . HTML <dt>\\$1</dt>
1229 . in \\n[www-li-indent]u
1230 . ti -\\n[www-dl-shift]u
1236 .\" --------------------------------------------------------------------
1237 .\" DC l text [color]
1239 .\" L is the letter to be dropped and enlarged.
1241 .\" TEXT is the following text whose height the first letter should not
1244 .\" COLOR is the optional color of the dropped letter (default black).
1247 . ds www-dropcolor black\"
1249 . ds www-dropcolor \\$3\"
1250 . ie '\*[.T]'html' \{\
1251 . www-make-unique-name
1252 . nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1253 . MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1257 . www-make-unique-name
1258 . \" To avoid interferences with another DC macro call which is located
1259 . \" very near to the current one, we draw the glyph on a separate page.
1260 . \" Otherwise it could theoretically happen that the dropped capital
1261 . \" glyphs overlap.
1265 . nop \O[5i\\*[www-unique-name].png]\O[1]
1266 . nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1276 . nr dummy \w'\\$1'u
1277 . nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1278 . char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1279 . nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1288 .\" supplementary macros used by other macro sets
1290 .\" here are some tags specially for -Tps or -Thtml when invoked by
1291 .\" pre-html to generate PNG images from postscript.
1293 .\" --------------------------------------------------------------------
1294 .\" HTML-DO-IMAGE - tell troff to issue an image marker which can be
1295 .\" read back by pre-html
1299 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1300 . if \\n[www-html] \
1301 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1304 .\" --------------------------------------------------------------------
1305 .\" HTML-IMAGE-END - terminate an image for HTML
1309 . nop \O[4]\O[2]\O[0]
1310 . if \\n[www-html] \
1311 . nop \O[4]\O[2]\O[1]
1316 .\" --------------------------------------------------------------------
1317 .\" www-make-unique-name - generate another unique name in string
1318 .\" `www-unique-name'
1320 .de www-make-unique-name
1322 . ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1325 .\" --------------------------------------------------------------------
1326 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1327 .\" to be rendered as an image.
1330 . \" generates a centered image
1331 . www-make-unique-name
1332 . HTML-DO-IMAGE \\*[www-unique-name] c
1335 .de HTML-IMAGE-RIGHT
1336 . www-make-unique-name
1337 . HTML-DO-IMAGE \\*[www-unique-name] r
1341 . www-make-unique-name
1342 . HTML-DO-IMAGE \\*[www-unique-name] l
1345 .de HTML-IMAGE-INLINE
1346 . www-make-unique-name
1347 . HTML-DO-IMAGE \\*[www-unique-name] i
1350 .\" EQN-HTML-IMAGE and friends check to see whether the equation is
1351 .\" not in an image, in which case it allows HTML
1352 .\" (mathml) to be generated (if -Txhtml was specified).
1355 . \" generates a centered image
1356 . www-make-unique-name
1357 . EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1360 .de EQN-HTML-IMAGE-RIGHT
1361 . www-make-unique-name
1362 . EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1365 .de EQN-HTML-IMAGE-LEFT
1366 . www-make-unique-name
1367 . EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1370 .de EQN-HTML-IMAGE-INLINE
1371 . www-make-unique-name
1372 . EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1375 .\" --------------------------------------------------------------------
1376 .\" EQN-HTML-DO-IMAGE - tell troff to issue an image marker which can be
1377 .\" read back by pre-html
1379 .de EQN-HTML-DO-IMAGE
1381 . if !(\\n[.O] == 0) \{\
1383 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1384 . if \\n[www-html] \
1385 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1389 . HTML-DO-IMAGE \\$*
1392 .\" --------------------------------------------------------------------
1393 .\" EQN-HTML-IMAGE-END - terminate an image for HTML
1395 .de EQN-HTML-IMAGE-END
1397 . if !(\\n[.O] == 0) \{\
1399 . nop \O[4]\O[2]\O[0]
1400 . if \\n[www-html] \
1401 . nop \O[4]\O[2]\O[1]
1408 .\" --------------------------------------------------------------------
1409 .\" Setup around HTML-IMAGE and friends
1411 .\" now set up TS, TE, EQ, EN default macros
1413 .\" we must not use `.als': the definition of .TE in s.tmac, for example,
1414 .\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1415 .\" causing an endless loop
1420 . if \\n[www-html] \{\
1421 . nr www-TS-ll \\n[.l]
1428 . if \\n[www-html] \
1429 . ll \\n[www-TS-ll]u
1430 . HTML-IMAGE-END \\$@
1435 . EQN-HTML-IMAGE \\$@
1436 . if \\n[www-html] \{\
1437 . nr www-EQ-ll \\n[.l]
1444 . if \\n[www-html] \
1445 . ll \\n[www-EQ-ll]u
1446 . EQN-HTML-IMAGE-END \\$@
1450 .\" --------------------------------------------------------------------
1453 .\" Generate multiple output files containing the HTML.
1454 .\" A file is split whenever a .SH or .NH 1 is encountered.
1455 .\" The argument to JOBNAME is the file stem for future output files.
1458 . DEVTAG .job-name \\$1
1461 .\" --------------------------------------------------------------------
1464 .\" Add information to the <head> </head> section of the HTML
1468 . DEVTAG .head "\\$*"
1471 .\" --------------------------------------------------------------------
1472 .\" start of some code
1479 .\" --------------------------------------------------------------------
1480 .\" end of some code
1487 .ds www-nav-colour #eeeeee\"
1488 .nr www-nav-width-left 30
1489 .nr www-nav-width-right 70
1491 .\" --------------------------------------------------------------------
1492 .\" LNS - left navigation start
1495 . HTML</p> <table><tr><td "valign=""top""" \
1496 "width=""\\n[www-nav-width-left]%""" \
1497 "bgcolor=""\\*[www-nav-colour]"">"
1499 . HTML</p> </td><td "valign=""top""" \
1500 "width=""\\n[www-nav-width-right]%"">"
1504 .\" --------------------------------------------------------------------
1505 .\" LNE - left navigation end
1508 . HTML</p> </td></tr></table>
1516 .\" some auxiliary macros for left navigation lists
1519 . if (0\\$1 == 0) \{\
1520 . if (\\n[SH-open] == 1) \
1528 . if (0\\$1 <= 1) \{\
1529 . if (\\n[SH-open] == 1) \
1538 . if (\\n[needs-begin] == 1) \{\
1545 .\" --------------------------------------------------------------------
1546 .\" ALN [colour] [left width percentage]
1548 .\" Turn on automatic left navigation. This macro should only be
1549 .\" called once (normally at the start of the document) as it
1550 .\" indicates that all top-level section headings form a navigation
1551 .\" list on the left of the main text.
1554 . if '\*[.T]'html' \{\
1556 . ds www-nav-colour \\$1\"
1557 . if (0\\$2 > 0) \{\
1558 . nr www-nav-width-left \\$2
1559 . nr www-nav-width-right (100 - \\$2)
1570 .\" --------------------------------------------------------------------
1571 .\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
1573 .\" Initialize www.tmac so that when this macro set is used with
1574 .\" non-HTML devices the urls are rendered the user defined attributes.
1577 .\" LINKSTYLE blue CR < >
1580 . if (\\n[.$] < 1) \
1581 . www:error .\\$0 expects at least 1 argument.
1582 . ds www:color \\$1\"
1584 . if (\\n[.$] < 1) \
1586 . ds www:fontstyle \\$1\"
1588 . if (\\n[.$] < 1) \
1589 . www:error .\\$0 expects that both the open and close glyph is specified
1590 . ds www:open \\$1\"
1591 . ds www:close \\$2\"
1594 .\" MATHML - enable eqn mathml output to pass through to the device
1598 . if (\\n[.O] == 0) \
1602 .\" --------------------------------------------------------------------
1604 .\" --------------------------------------------------------------------
1606 .LINKSTYLE blue C \[la] \[ra]
1608 .if \n[www-html] \{\
1613 .if r ps4html .nop \O[0]
1618 .\" --------------------------------------------------------------------
1620 .\" --------------------------------------------------------------------
1622 .\" Local Variables: