2 @ www.tmac - macro package for adding HTML elements to roff documents.
3 @ A simple set of macros to provide HTML (or XHTML) documents with basic
4 @ www functionality. It should work with any macro set. In the following,
5 @ HTML always denotes XHTML also.
7 Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
9 Copyright (C) 2001 - 2006, 2008
10 Free Software Foundation, Inc.
11 written by Gaius Mulley <gaius@glam.ac.uk>, with additions by
12 Werner Lemberg <wl@gnu.org> and Bernd Warken <bwarken@mayn.de>.
14 This is free software; you can redistribute it and/or modify it under
15 the terms of the GNU General Public License as published by the Free
16 Software Foundation; either version 2, or (at your option) any later
19 This is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 You should have received a copy of the GNU General Public License
25 along with groff; see the file COPYING. If not, write to the Free
26 Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA
33 .do if d www:lenstr .nx
50 .\" set up www-image-template
52 .if !d www-image-template \
53 . ds www-image-template
56 . \" remove the title command when we are generating images for HTML
57 . \" (stops a title accidentally appearing inside an image)
67 .\" Test for `.substring'; result in register `www.substring_ok'.
68 .\" The automated break points in .URL addresses are only added if
69 .\" this register is non-zero.
70 .nr www:substring_ok 0
71 .de www:@test_substring
75 . substring \\$0:s 1 1
76 . if !'\\*[\\$0:s]'b' \{\
81 . substring \\$0:s 0 0
82 . if !'\\*[\\$0:s]'a' \{\
87 . substring \\$0:s 1 -1
88 . if !'\\*[\\$0:s]'bcdefg' \{\
92 . nr www:substring_ok 1
96 .rm www:@test_substring
103 .\" Space before paragraph. Use \n[PD] if it exists.
113 .\" www:error (<test>...)
115 .\" Print error message.
117 . tm \\n[.F]:\\n[.c]: macro error: \\$*
120 .als www:error www-error
122 .\" www:lenstr (<register_name> <string_name>)
124 .\" Store length of string named <string_name> into register named
127 . if !(\\n[.$] == 2) \{\
128 . tm .\\$0 expects 2 arguments.
131 . length \\$0:n x\\*[\\$2]
132 . nr \\$1 (\\n[\\$0:n] - 1)
136 .\" www:splitstr (<name>)
138 .\" Add a space character between any two adjacent characters in string
139 .\" <name> and restore result into the string variable <name>; space
140 .\" characters are first replaced by the word `space'.
142 . if !(\\n[.$] == 1) \
143 . www:error .\\$0 expects 1 argument.
146 . ds \\$0:r "\\*[\\$1]\"
149 . ds \\$0:c "\\*[\\$0:r]\"
150 . substring \\$0:c 0 0
151 . ie '\\*[\\$0:c]' ' \
152 . as \\$0:s " space\"
154 . as \\$0:s " \\*[\\$0:c]\"
155 . www:lenstr \\$0:n \\$0:r
156 . if (\\n[\\$0:n] <= 1) \
158 . substring \\$0:r 1 -1
160 . if !'\\*[\\$0:s]'' \
161 . substring \\$0:s 1 -1
162 . ds \\$1 \\*[\\$0:s]\"
169 .\" www:url_breaks (<string_name>)
171 .\" Add `\:' (possible break point) within URL strings after `/'.
173 .\" Smart about multiple `/', existing `\:', and space characters;
174 .\" does not set a break point if less than 5 characters would go to
177 . if !(\\n[.$] == 1) \
178 . www:error .\\$0 expects 1 argument.
179 . if !\n[www:substring_ok] \
181 . ds \\$0:s "\\*[\\$1]\"
182 . www:splitstr \\$0:s
183 . www:url_breaks_split \\$0:s \\*[\\$0:s]
184 . ds \\$1 "\\*[\\$0:s]\"
188 .\" www:url_breaks_split (<result> <char> [<char>...])
190 .\" Add `\:' within URL strings, but arguments are a split string.
192 .\" Arguments: >=2: <result> <char> [<char>...]
193 .de www:url_breaks_split
194 . nr \\$0:min 5 \" minimal number of characters for next line
196 . www:error .\\$0 expects at least 2 arguments.
201 . while !\\n[\\$0:done] \{\
202 . if (\\n[.$] <= 0) \
204 . if '\\$1'space' \{\
209 . if (\\n[.$] < \\n[\\$0:min]) \{\
219 . \" we are at a `/' character
222 . if (\\n[.$] == 0) \{\
228 . if \\n[\\$0:done] \
230 . if (\\n[.$] < \\n[\\$0:min]) \
236 . ds \\*[\\$0:res] \\*[\\$0:s]\"
246 .\" The main auxiliary macro for the HTML interface.
248 . if \\n[www-html] \{\
249 . \" was implemented via .nop \&\X^html:\\$*^ but
250 . \" is now implemented using HTML-NS to utilize code factoring.
252 . \" the `\&' makes the vertical mode leave, so to say
261 .\" An auxiliary macro for HTML (without following space).
263 . nop \X^html:\\$*^\c
267 .\" Emit an HTML tag after shutting down a (possibly open) paragraph.
269 . ie \\n[www-html] \{\
270 . \" the `\&' makes the vertical mode leave, so to say
271 . nop \&\X^html</p>:\\$*^
278 .\" Emit an HTML tag. If text has been written in the paragraph
279 .\" then do not shut the paragraph down.
280 .\" If text was not written, remove the empty
281 .\" paragraph tag and emit the desired HTML tag.
284 . nop \&\X^html<?p>:\\$*^
288 .\" Emit a MATH tag. If text has been written in the paragraph
289 .\" then do not shut the paragraph down.
290 .\" If text was not written, remove the empty
291 .\" paragraph tag and emit the desired math tag.
294 . nop \&\X^math<?p>:\\$*^
299 .\" Automatic heading level cut off.
301 .\" N is the depth limit of automatically linked headings. So a depth
302 .\" of 2 would cause grohtml to generate a list of links for `.NH 1'
303 .\" and `.NH 2' but not for `.NH 3'.
309 .\" BCL foreground background active not-visited visited
311 . HTML <body "text=""\\$1""" \
320 . HTML <body "background=""\\$1"">"
323 .\" www:url_check_tag str
324 .\" If url named by \*[str] is internal (starts with #),
325 .\" redefine \*[str] to be the value of the string TAG_url.
326 .de www:url_check_tag
327 . ds \\$0:tmp \\*[\\$1]\"
328 . substring \\$0:tmp 0 0
329 . if '\\*[\\$0:tmp]'#' \{\
330 . ds \\$0:tmp \\*[\\$1]\"
331 . substring \\$0:tmp 1
332 . ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
334 . ie d \\*[\\$0:tmp] \
335 . ds \\$1 \\*[\\*[\\$0:tmp]]\"
337 . ds \\$1 see below\"
342 .\" URL url [description] [after]
344 .\" If description is absent then the url becomes the anchor text.
348 . www:url_check_tag \\$0:adr
349 . if !\\n[www-html] \
350 . www:url_breaks \\$0:adr
352 . ie \\n[www-html] \{\
356 . ds \\$0:after \&\\$3\"
359 . HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
361 . HTML-NS <a "href=""\\$1"">\\$2</a>"
363 . nop \\*[\\$0:after]
377 . nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
379 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
385 . nop \m[\\*[www:color]]\\$2\m[]\\$3
387 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
391 . nop \m[\\*[www:color]]\\$2\m[]
392 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
395 . nop \f[\\*[www:fontstyle]]\\$2\f[]
396 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
407 .\" FTP url description [after]
412 .\" MTO address description [after]
414 .\" ADDRESS is the email address (without the `mailto:' prefix).
416 .\" DESCRIPTION is the optional name. If an empty argument is given,
417 .\" ADDRESS is used instead.
419 .\" AFTER is optional stuff printed immediately after ADDRESS
420 .\" (resp. DESCRIPTION).
424 .\" Foobar has been written by
425 .\" .MTO fred@foo.bar "Fredrick Bloggs" .
427 . ie \\n[www-html] \{\
429 . URL mailto:\\$1 \\$1 "\\$3"
431 . URL mailto:\\$1 "\\$2" "\\$3"
441 . nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
443 . nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
449 . nop \m[\\*[www:color]]\\$2\m[]\\$3
451 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
455 . nop \m[\\*[www:color]]\\$2\m[]
456 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
459 . nop \f[\\*[www:fontstyle]]\\$2\f[]
460 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
469 .\" Generate an HTML name NAME.
470 .\" Define string TAG_NAME to TEXT, if present, otherwise to \n[PN].
472 . HTML <a "name=""\\$1""></a>"
474 . ds TAG_\\$1 \\n[PN]\"
479 .\" IMG [-R|-L|-C] filename [width] [height]
481 .\" Include an image of any type (only works for -Thtml).
483 .\" Alignment is centered by default (-C).
484 .\" Default value for WIDTH is 1i.
485 .\" If HEIGHT is not given, WIDTH is used as the height.
487 . ie \\n[www-html] \{\
489 . DEVTAG .right-image
494 . DEVTAG .centered-image
499 . nr www-height \\n[www-width]
502 . HTML <img "src=""\\$1""" \
503 "alt=""Image \\$1""" \
504 "width=""\\n[www-width]""" \
505 "height=""\\n[www-height]""\\*[www->]"
508 . nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
511 .\" PIMG [-R|-L|-C] filename [width] [height]
513 .\" Include a PNG image. It works for -Tps and -Thtml.
514 .\" The default value for WIDTH and HEIGHT is zero; the default
515 .\" alignment is centering (-C).
517 .\" Note: This macro can only be used with the `-U' option of groff,
518 .\" activating unsafe mode, if not used with -Thtml; the PNG image
519 .\" is then converted to the EPS format using netpbm utilities.
521 . ds www-pic-align -C\"
523 . ds www-pic-align -R\"
528 . ds www-pic-align -L\"
535 . ie \\n[www-html] \{\
536 . ds www-htmlalign align="center"\"
537 . if '\\*[www-pic-align]'-R' \
538 . ds www-htmlalign align="right"\"
539 . if '\\*[www-pic-align]'-L' \
540 . ds www-htmlalign align="left"\"
545 . nr www-width (\\$3 * 100 / 240)
547 . nr www-height (\\$4 * 100 / 240)
548 . ie (\\n[www-width] == 0) \{\
549 . ie (\\n[www-height] == 0) \
550 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
551 "alt=""Image \\$1""\\*[www->]</p>"
553 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
554 "alt=""Image \\$1""" \
555 "height=""\\n[www-height]""\\*[www->]</p>"
558 . ie (\\n[www-height] == 0) \
559 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
560 "alt=""Image \\$1""" \
561 "width=""\\n[www-width]""\\*[www->]</p>"
563 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
564 "alt=""Image \\$1""" \
565 "width=""\\n[www-width]""" \
566 "height=""\\n[www-height]""\\*[www->]</p>"
571 . www-make-unique-name
574 | @PNMTOPS_NOSETPAGE@ -noturn \
575 > \\*[www-unique-name].eps
577 . PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
582 .\" auxiliary definitions for MPIMG
583 .nr www-left-ll-trap 0
584 .nr www-left-po-trap 0
585 .nr www-right-ll-trap 0
587 .de www-finish-left-po
588 . po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
589 . wh \\n[www-left-po-trap]u
590 . nr www-left-indent 0
593 .\" called when the -R picture is finished
594 .de www-finish-right-ll
595 . ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
597 . \" now check whether we need to inline www-finish-left-ll
598 . if (\\n[www-left-ll-trap]u > 0) \
599 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
600 . mk www-left-po-trap
601 . nr www-left-po-trap +1v
602 . wh \\n[www-left-po-trap]u www-finish-left-po
603 . ll +\\n[www-left-indent]u
604 . wh \\n[www-left-ll-trap]u
605 . nr www-left-ll-trap 0
608 . \" and check whether we need to inline www-finish-left-po
609 . if (\\n[www-left-po-trap]u > 0) \
610 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
611 . po -\\n[www-left-indent]u
612 . wh \\n[www-left-po-trap]u
613 . nr www-left-indent 0
616 . wh \\n[www-right-ll-trap]u
617 . nr www-right-ll-trap 0
620 .de www-finish-left-ll
621 . if (\\n[www-right-ll-trap] > 0) \
622 . if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
623 . ll +\\n[www-right-indent]u
624 . nr www-right-ll-trap 0
627 . mk www-left-po-trap
628 . nr www-left-po-trap +1v
629 . wh \\n[www-left-po-trap]u www-finish-left-po
630 . ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
631 . wh \\n[www-left-ll-trap]u
632 . nr www-left-ll-trap 0
635 .\" www-handle-percent arg N1 N2 S1
636 .\" arg - input string (number or number%)
637 .\" output parameters:
638 .\" N1 - name of number register 1=absolute 0=percentage
639 .\" N2 - number register name for absolute value
640 .\" S1 - string register name for percentage value
641 .de www-handle-percent
642 . ds www-percent \\$1\"
643 . substring www-percent -1 -1
645 . ie '\\*[www-percent]'%' \{\
647 . substring www-abs 0 -2
649 . nr \\$3 \\*[www-abs]
659 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
661 .\" Include a PNG image and wrap text around it. It works for
662 .\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
663 .\" for HEIGHT is WIDTH; the default alignment is left (-L).
664 .\" -G is used to insert a gap between the text and the image.
665 .\" The height and width can also be given as a percentage.
666 .\" The PostScript device converts the percentage width into an
667 .\" absolute value by using \\n[.l], and the height by using \\n[.p].
669 .\" Note: This macro can only be used with the `-U' option of groff,
670 .\" activating unsafe mode, if not used with -Thtml; the PNG image
671 .\" is then converted to the EPS format using netpbm utilities.
672 .nr www-htmlimage-gap 0
675 . nr www-image-just 1
677 . while (\\n[.$] > 0) \{\
679 . nr www-image-just 1
684 . nr www-image-just 0
689 . nr www-image-gap \\$2
690 . nr www-htmlimage-gap (\\$2 * 100 / 240)
699 . ds www-size-specs width="\\n[www-width]" height="\\n[www-height]"\"
701 . nr www-is-absolute 0
703 . ds www-percentage none\"
704 . www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
705 . ie !\\n[www-is-absolute] \{\
706 . \" percentage of linelength requested
707 . nr www-width (\\n[www-absolute] * \\n[.l] / 100)
709 . nr www-width (\\n[www-width] * 100 / 240)
710 . ds www-size-specs width="\\*[www-percentage]"\"
713 . nr www-width \\n[www-absolute]
715 . nr www-width (\\n[www-width] * 100 / 240)
716 . ds www-size-specs width="\\n[www-width]"\"
719 . nr www-height \\n[www-width]
721 . nr www-is-absolute 0
723 . ds www-percentage none\"
724 . www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
725 . ie !\\n[www-is-absolute] \{\
726 . \" percentage of pagelength requested
727 . nr www-height (\\n[www-absolute] * \\n[.p] / 100)
729 . nr www-height (\\n[www-height] * 100 / 240)
730 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
733 . nr www-height \\n[www-absolute]
735 . nr www-height (\\n[www-height] * 100 / 240)
736 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-height]"\"
741 . \" height not specified; use width value
742 . ie !\\n[www-is-absolute] \{\
743 . \" percentage value
744 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
745 . nr www-height \\n[www-width]
748 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-width]"\"
749 . nr www-height \\n[www-width]
753 . ie \\n[www-html] \{\
754 . ie !\\n[www-image-just] \
755 . HTML <img "src=""\\$1""" \
756 "alt=""Image \\$1""" \
757 "hspace=""\\n[www-htmlimage-gap]""" \
759 "\\*[www-size-specs]\\*[www->]"
761 . HTML <img "src=""\\$1""" \
762 "alt=""Image \\$1""" \
763 "hspace=""\\n[www-htmlimage-gap]""" \
765 "\\*[www-size-specs]\\*[www->]"
768 . tm www-width is \\n[www-width]
769 . tm www-height is \\n[www-height]
771 . www-make-unique-name
774 | @PNMTOPS_NOSETPAGE@ -noturn \
775 > \\*[www-unique-name].eps
776 . ie !\\n[www-image-just] \{\
777 . \" we must now disable a possible left image trap
779 . if (\\n[www-left-ll-trap] > 0) \
780 . wh \\n[www-left-ll-trap]u
781 . if (\\n[www-left-po-trap] > 0) \
782 . wh \\n[www-left-po-trap]u
783 . PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
786 . nr www-right-indent \\n[ps-deswid]u
787 . \" we want to have some space between text and image,
788 . \" so the line length must be shorter
789 . ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
790 . mk www-right-ll-trap
791 . nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
792 . wh \\n[www-right-ll-trap]u www-finish-right-ll
794 . \" now restore possible left trap
795 . if (\\n[www-left-ll-trap] > 0) \
796 . wh \\n[www-left-ll-trap]u www-finish-left-ll
797 . if (\\n[www-left-po-trap] > 0) \
798 . wh \\n[www-left-po-trap]u
801 . \" we must now disable a possible right image trap
802 . if (\\n[www-right-ll-trap] > 0) \
803 . wh \\n[www-right-ll-trap]u
804 . PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
807 . nr www-left-indent \\n[ps-deswid]u
808 . \" increase offset by gap
809 . po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
810 . \" decrease line length by gap
811 . ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
812 . mk www-left-ll-trap
813 . nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
814 . wh \\n[www-left-ll-trap]u www-finish-left-ll
816 . \" now restore possible right trap
817 . if (\\n[www-right-ll-trap] > 0) \
818 . wh \\n[www-right-ll-trap]u www-finish-right-ll
826 .\" Begin heading. Heading level is N.
832 .\" If your heading contains URL, FTP, MTO macros you might wish to
833 .\" disable automatic links to headings. This can be done via `-P-l'
834 .\" from the command line or by using a cakk to `.HX 0'.
835 .nr www-heading-no -1
839 . nr www-heading-no 1
841 . nr www-heading-no \\$1
842 . DEVTAG-NH \\n[www-heading-no]
846 . if (\\n[www-heading-no] == -1) \
847 . www-error HnE found without a corresponding HnS
853 .\" Emit the automatically collected links derived from
854 .\" section/numbered headings at this position.
861 .\" Produce a horizontal line.
863 . HTML</p> <hr\\*[www->]
868 .\" Suppress the generation of the top and bottom rules which grohtml
869 .\" emits by default.
871 . DEVTAG .no-auto-rule
875 .\" www-end-nowhere - end of input trap called to finish diversion.
877 . if !\\n[www-html] \
884 .\" Generate an HTML title only. This differs from the -ms .TL macro
885 .\" which generates both an HTML title and an H1 heading.
887 .\" This is useful when an author wishes to use an HTML title as search
888 .\" engine fodder but a graphic title in the document.
890 .\" The macro terminates when a space or break is seen (.sp, .br).
893 . if !\\n[www-html] \
895 . it 2 www-end-nowhere
898 .\" auxiliary definitions for lists
899 .ds www-ul-level1 \[bu]\ \ \"
900 .ds www-ul-level2 \[sq]\ \ \"
901 .ds www-ul-level3 \[ci]\ \ \"
904 .ds www-ol-level1 decimal\"
905 .ds www-ol-level2 lower-alpha\"
906 .ds www-ol-level3 lower-roman\"
907 .ds www-ol-tmp 00\ \ \"
919 .\" allow nested lists
921 .nr www-li-indent \n[.i]
933 .\" which macro to use for LI
936 . ds www-level\\n[www-depth] \\$1\"
937 . ds www-ltag\\n[www-depth]
943 . als LI \\*[www-level\\n[www-depth]]
946 .\" www-emit-ltag - shut down a previous open list tag
947 .\" before issuing a new tag \\$1.
948 .\" It then records tag \\$1 is open.
950 . if !'\\*[www-ltag\\n[www-depth]]'' \
951 . HTML-NS </\\*[www-ltag\\n[www-depth]]>
954 . ds www-ltag\\n[www-depth] \\$1\"
958 .\" Auxiliary macro for ULS.
959 .de www-push-ul-level
961 . if (\\n[www-ul-level] > 3) \
962 . www-error ULS: too many levels of indentation (\\n[www-ul-level])
965 .\" Auxiliary macro for ULE.
967 . if !\\n[www-ul-level] \
968 . www-error ULE: trying to terminate a list which does not exist
973 .\" Auxiliary macro for OLS.
974 .de www-push-ol-level
976 . if (\\n[www-ol-level] > 3) \
977 . www-error OLS: too many levels of indentation (\\n[www-ol-level])
981 .\" Auxiliary macro for OLE.
983 . if !\\n[www-ol-level] \
984 . www-error OLE: trying to terminate a list which does not exist
990 .\" Start an unordered list.
992 . www-push-li www-li-ul
994 . ie \\n[www-html] \{\
999 . nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1004 .\" End an unordered list.
1006 . ie \\n[www-html] \{\
1011 . nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1012 . in \\n[www-li-indent]u
1020 .\" Start an ordered list.
1022 . www-push-li www-li-ol
1024 . ie \\n[www-html] \{\
1026 . HTML</p> <ol "style=""list-style-type:" \
1027 "\\*[www-ol-level\\n[www-ol-level]]"">"
1030 . nr www-li-indent +\w'\\*[www-ol-tmp]'u
1035 .\" End an ordered list.
1037 . ie \\n[www-html] \{\
1042 . nr www-li-indent -\w'\\*[www-ol-tmp]'u
1043 . in \\n[www-li-indent]u
1044 . nr www-ol-ctr\\n[www-ol-level] 0 1
1052 .\" Start a definition list.
1054 . www-push-li www-li-dl
1055 . nr www-dl-level +1
1056 . ie \\n[www-html] \{\
1061 . nr www-li-indent +\\n[www-dl-shift]u
1062 . in \\n[www-li-indent]u
1068 .\" End a definition list.
1070 . ie \\n[www-html] \{\
1075 . nr www-li-indent -\\n[www-dl-shift]u
1076 . in \\n[www-li-indent]u
1078 . nr www-dl-level -1
1084 .\" Insert a list item.
1088 .\" www-li-ul - bulleted list item
1090 . ie \\n[www-html] \
1094 . in \\n[www-li-indent]u
1095 . ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1096 . nop \\*[www-ul-level\\n[www-ul-level]]\c
1101 .\" www-li-ol - numbered list item
1103 . ie \\n[www-html] \
1107 . in \\n[www-li-indent]u
1108 . ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1109 . nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
1114 .\" www-li-dl - definition list item
1116 . ie \\n[www-html] \{\
1117 . HTML <dt>\\$1</dt>
1122 . in \\n[www-li-indent]u
1123 . ti -\\n[www-dl-shift]u
1129 .\" DC l text [color]
1131 .\" L is the letter to be dropped and enlarged.
1133 .\" TEXT is the following text whose height the first letter should not
1136 .\" COLOR is the optional color of the dropped letter (default black).
1138 . ds www-dropcolor black\"
1140 . ds www-dropcolor \\$3\"
1141 . ie '\*[.T]'html' \{\
1142 . www-make-unique-name
1143 . nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1144 . MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1148 . www-make-unique-name
1149 . \" To avoid interferences with another DC macro call which is located
1150 . \" very near to the current one, we draw the glyph on a separate page.
1151 . \" Otherwise it could theoretically happen that the dropped capital
1152 . \" glyphs overlap.
1156 . nop \O[5i\\*[www-unique-name].png]\O[1]
1157 . nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1167 . nr dummy \w'\\$1'u
1168 . nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1169 . char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1170 . nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1179 .\" supplementary macros used by other macro sets
1181 .\" here are some tags specially for -Tps or -Thtml when invoked by
1182 .\" pre-html to generate PNG images from postscript.
1184 .\" HTML-DO-IMAGE - tell troff to issue an image marker which can be
1185 .\" read back by pre-html
1188 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1189 . if \\n[www-html] \
1190 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1193 .\" HTML-IMAGE-END - terminate an image for HTML
1196 . nop \O[4]\O[2]\O[0]
1197 . if \\n[www-html] \
1198 . nop \O[4]\O[2]\O[1]
1203 .\" www-make-unique-name - generate another unique name in string
1204 .\" `www-unique-name'
1205 .de www-make-unique-name
1207 . ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1210 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1211 .\" to be rendered as an image.
1213 . \" generates a centered image
1214 . www-make-unique-name
1215 . HTML-DO-IMAGE \\*[www-unique-name] c
1218 .de HTML-IMAGE-RIGHT
1219 . www-make-unique-name
1220 . HTML-DO-IMAGE \\*[www-unique-name] r
1224 . www-make-unique-name
1225 . HTML-DO-IMAGE \\*[www-unique-name] l
1228 .de HTML-IMAGE-INLINE
1229 . www-make-unique-name
1230 . HTML-DO-IMAGE \\*[www-unique-name] i
1233 .\" EQN-HTML-IMAGE and friends check to see whether the equation is
1234 .\" not in an image, in which case it allows HTML
1235 .\" (mathml) to be generated (if -Txhtml was specified).
1237 . \" generates a centered image
1238 . www-make-unique-name
1239 . EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1242 .de EQN-HTML-IMAGE-RIGHT
1243 . www-make-unique-name
1244 . EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1247 .de EQN-HTML-IMAGE-LEFT
1248 . www-make-unique-name
1249 . EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1252 .de EQN-HTML-IMAGE-INLINE
1253 . www-make-unique-name
1254 . EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1257 .\" EQN-HTML-DO-IMAGE - tell troff to issue an image marker which can be
1258 .\" read back by pre-html
1259 .de EQN-HTML-DO-IMAGE
1261 . if !(\\n[.O] == 0) \{\
1263 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1264 . if \\n[www-html] \
1265 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1269 . HTML-DO-IMAGE \\$*
1272 .\" EQN-HTML-IMAGE-END - terminate an image for HTML
1273 .de EQN-HTML-IMAGE-END
1275 . if !(\\n[.O] == 0) \{\
1277 . nop \O[4]\O[2]\O[0]
1278 . if \\n[www-html] \
1279 . nop \O[4]\O[2]\O[1]
1286 .\" Setup around HTML-IMAGE and friends
1288 .\" now set up TS, TE, EQ, EN default macros
1290 .\" we must not use `.als': the definition of .TE in s.tmac, for example,
1291 .\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1292 .\" causing an endless loop
1295 . nop \\*[HTML-IMAGE]\\
1300 . nop \\*[HTML-IMAGE-END]\\
1305 . nop \\*[EQN-HTML-IMAGE]\\
1310 . nop \\*[EQN-HTML-IMAGE-END]\\
1316 .\" Generate multiple output files containing the HTML.
1317 .\" A file is split whenever a .SH or .NH 1 is encountered.
1318 .\" The argument to JOBNAME is the file stem for future output files.
1320 . DEVTAG .job-name \\$1
1325 .\" Add information to the <head> </head> section of the HTML
1328 . DEVTAG .head "\\$*"
1331 .\" start of some code
1337 .\" end of some code
1344 .ds www-nav-colour #eeeeee\"
1345 .nr www-nav-width-left 30
1346 .nr www-nav-width-right 70
1348 .\" LNS - left navigation start
1350 . HTML</p> <table><tr><td "valign=""top""" \
1351 "width=""\\n[www-nav-width-left]%""" \
1352 "bgcolor=""\\*[www-nav-colour]"">"
1354 . HTML</p> </td><td "valign=""top""" \
1355 "width=""\\n[www-nav-width-right]%"">"
1359 .\" LNE - left navigation end
1361 . HTML</p> </td></tr></table>
1369 .\" some auxiliary macros for left navigation lists
1371 . if (0\\$1 == 0) \{\
1372 . if (\\n[SH-open] == 1) \
1380 . if (0\\$1 <= 1) \{\
1381 . if (\\n[SH-open] == 1) \
1390 . if (\\n[needs-begin] == 1) \{\
1397 .\" ALN [colour] [left width percentage]
1399 .\" Turn on automatic left navigation. This macro should only be
1400 .\" called once (normally at the start of the document) as it
1401 .\" indicates that all top-level section headings form a navigation
1402 .\" list on the left of the main text.
1404 . if '\*[.T]'html' \{\
1406 . ds www-nav-colour \\$1\"
1407 . if (0\\$2 > 0) \{\
1408 . nr www-nav-width-left \\$2
1409 . nr www-nav-width-right (100 - \\$2)
1420 .\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
1422 .\" Initialize www.tmac so that when this macro set is used with
1423 .\" non-HTML devices the urls are rendered the user defined attributes.
1426 .\" LINKSTYLE blue CR < >
1428 . if (\\n[.$] < 1) \
1429 . www:error .\\$0 expects at least 1 argument.
1430 . ds www:color \\$1\"
1432 . if (\\n[.$] < 1) \
1434 . ds www:fontstyle \\$1\"
1436 . if (\\n[.$] < 1) \
1437 . www:error .\\$0 expects that both the open and close glyph is specified
1438 . ds www:open \\$1\"
1439 . ds www:close \\$2\"
1442 .\" MATHML - enable eqn mathml output to pass through to the device
1445 . if (\\n[.O] == 0) \
1450 .LINKSTYLE blue C \[la] \[ra]
1452 .if \n[www-html] \{\
1457 .if r ps4html .nop \O[0]