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-2018 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 (at your
21 option) any later version.
23 groff is distributed in the hope that it will be useful, but WITHOUT ANY
24 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 along
29 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
38 following, HTML always denotes XHTML also.
42 .\" --------------------------------------------------------------------
44 .\" --------------------------------------------------------------------
46 .do if d www:lenstr .nx
54 .\" Taken from tmac/an-ext.tmac
55 .\" Map mono-width fonts to standard fonts for groff's TTY device.
72 .\" set up www-image-template
74 .if !d www-image-template \
75 . ds www-image-template
78 . \" remove the title command when we are generating images for HTML
79 . \" (stops a title accidentally appearing inside an image)
89 .\" --------------------------------------------------------------------
90 .\" Test for '.substring'; result in register 'www.substring_ok'.
91 .\" The automated break points in .URL addresses are only added if
92 .\" this register is non-zero.
94 .nr www:substring_ok 0
95 .de www:@test_substring
99 . substring \\$0:s 1 1
100 . if !'\\*[\\$0:s]'b' \{\
104 . ds \\$0:s abcdefg\"
105 . substring \\$0:s 0 0
106 . if !'\\*[\\$0:s]'a' \{\
110 . ds \\$0:s abcdefg\"
111 . substring \\$0:s 1 -1
112 . if !'\\*[\\$0:s]'bcdefg' \{\
116 . nr www:substring_ok 1
120 .rm www:@test_substring
123 .\" --------------------------------------------------------------------
125 .\" --------------------------------------------------------------------
127 .\" --------------------------------------------------------------------
130 .\" Space before paragraph. Use \n[PD] if it exists.
141 .\" --------------------------------------------------------------------
142 .\" www:error (<test>...)
144 .\" Print error message.
147 . tm \\n[.F]:\\n[.c]: macro error: \\$*
150 .als www:error www-error
152 .\" --------------------------------------------------------------------
153 .\" www:lenstr (<register_name> <string_name>)
155 .\" Store length of string named <string_name> into register named
159 . if !(\\n[.$] == 2) \{\
160 . tm .\\$0 expects 2 arguments.
163 . length \\$0:n x\\*[\\$2]
164 . nr \\$1 (\\n[\\$0:n] - 1)
168 .\" --------------------------------------------------------------------
169 .\" www:splitstr (<name>)
171 .\" Add a space character between any two adjacent characters in string
172 .\" <name> and restore result into the string variable <name>; space
173 .\" characters are first replaced by the word 'space'.
176 . if !(\\n[.$] == 1) \
177 . www:error .\\$0 expects 1 argument.
180 . ds \\$0:r "\\*[\\$1]\"
183 . ds \\$0:c "\\*[\\$0:r]\"
184 . substring \\$0:c 0 0
185 . ie '\\*[\\$0:c]' ' \
186 . as \\$0:s " space\"
188 . as \\$0:s " \\*[\\$0:c]\"
189 . www:lenstr \\$0:n \\$0:r
190 . if (\\n[\\$0:n] <= 1) \
192 . substring \\$0:r 1 -1
194 . if !'\\*[\\$0:s]'' \
195 . substring \\$0:s 1 -1
196 . ds \\$1 \\*[\\$0:s]\"
203 .\" --------------------------------------------------------------------
204 .\" www:url_breaks (<string_name>)
206 .\" Add '\:' (possible break point) within URL strings after '/'.
208 .\" Smart about multiple '/', existing '\:', and space characters;
209 .\" does not set a break point if less than 5 characters would go to
213 . if !(\\n[.$] == 1) \
214 . www:error .\\$0 expects 1 argument.
215 . if !\n[www:substring_ok] \
217 . ds \\$0:s "\\*[\\$1]\"
218 . www:splitstr \\$0:s
219 . www:url_breaks_split \\$0:s \\*[\\$0:s]
220 . ds \\$1 "\\*[\\$0:s]\"
224 .\" --------------------------------------------------------------------
225 .\" www:url_breaks_split (<result> <char> [<char>...])
227 .\" Add '\:' within URL strings, but arguments are a split string.
229 .\" Arguments: >=2: <result> <char> [<char>...]
231 .de www:url_breaks_split
232 . nr \\$0:min 5 \" minimal number of characters for next line
234 . www:error .\\$0 expects at least 2 arguments.
239 . while !\\n[\\$0:done] \{\
240 . if (\\n[.$] <= 0) \
242 . if '\\$1'space' \{\
247 . if (\\n[.$] < \\n[\\$0:min]) \{\
257 . \" we are at a '/' character
260 . if (\\n[.$] == 0) \{\
266 . if \\n[\\$0:done] \
268 . if (\\n[.$] < \\n[\\$0:min]) \
274 . ds \\*[\\$0:res] \\*[\\$0:s]\"
280 .\" --------------------------------------------------------------------
282 .\" --------------------------------------------------------------------
284 .\" --------------------------------------------------------------------
287 .\" The main auxiliary macro for the HTML interface.
290 . if \\n[www-html] \{\
291 . \" was implemented via .nop \&\X^html:\\$*^ but
292 . \" is now implemented using HTML-NS to utilize code factoring.
294 . \" the '\&' makes the vertical mode leave, so to say
303 .\" An auxiliary macro for HTML (without following space).
306 . nop \X^html:\\$*^\c
310 .\" Emit an HTML tag after shutting down a (possibly open) paragraph.
313 . ie \\n[www-html] \{\
314 . \" the '\&' makes the vertical mode leave, so to say
315 . nop \&\X^html</p>:\\$*^
322 .\" Emit an HTML tag. If text has been written in the paragraph
323 .\" then do not shut the paragraph down.
324 .\" If text was not written, remove the empty
325 .\" paragraph tag and emit the desired HTML tag.
329 . nop \&\X^html<?p>:\\$*^
333 .\" Emit a MATH tag. If text has been written in the paragraph
334 .\" then do not shut the paragraph down.
335 .\" If text was not written, remove the empty
336 .\" paragraph tag and emit the desired math tag.
340 . nop \&\X^math<?p>:\\$*^
343 .\" --------------------------------------------------------------------
346 .\" Automatic heading level cut off.
348 .\" N is the depth limit of automatically linked headings. So a depth
349 .\" of 2 would cause grohtml to generate a list of links for '.NH 1'
350 .\" and '.NH 2' but not for '.NH 3'.
357 .\" --------------------------------------------------------------------
358 .\" BCL foreground background active not-visited visited
361 . HTML <body "text=""\\$1""" \
368 .\" --------------------------------------------------------------------
372 . HTML <body "background=""\\$1"">"
375 .\" www:url_check_tag str
376 .\" If url named by \*[str] is internal (starts with #),
377 .\" redefine \*[str] to be the value of the string TAG_url.
379 .de www:url_check_tag
380 . ds \\$0:tmp \\*[\\$1]\"
381 . substring \\$0:tmp 0 0
382 . if '\\*[\\$0:tmp]'#' \{\
383 . ds \\$0:tmp \\*[\\$1]\"
384 . substring \\$0:tmp 1
385 . ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
387 . ie d \\*[\\$0:tmp] \
388 . ds \\$1 \\*[\\*[\\$0:tmp]]\"
390 . ds \\$1 see below\"
395 .\" --------------------------------------------------------------------
396 .\" URL url [description] [after]
398 .\" If description is absent then the url becomes the anchor text.
403 . www:url_check_tag \\$0:adr
404 . if !\\n[www-html] \
405 . www:url_breaks \\$0:adr
407 . ie \\n[www-html] \{\
411 . ds \\$0:after \&\\$3\"
414 . HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
416 . HTML-NS <a "href=""\\$1"">\\$2</a>"
418 . nop \\*[\\$0:after]
432 . nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
434 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
440 . nop \m[\\*[www:color]]\\$2\m[]\\$3
442 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
446 . nop \m[\\*[www:color]]\\$2\m[]
447 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
450 . nop \f[\\*[www:fontstyle]]\\$2\f[]
451 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
462 .\" --------------------------------------------------------------------
463 .\" FTP url description [after]
469 .\" --------------------------------------------------------------------
470 .\" MTO address description [after]
472 .\" ADDRESS is the email address (without the 'mailto:' prefix).
474 .\" DESCRIPTION is the optional name. If an empty argument is given,
475 .\" ADDRESS is used instead.
477 .\" AFTER is optional stuff printed immediately after ADDRESS
478 .\" (resp. DESCRIPTION).
482 .\" Foobar has been written by
483 .\" .MTO fred@foo.bar "Fredrick Bloggs" .
486 . ie \\n[www-html] \{\
488 . URL mailto:\\$1 \\$1 "\\$3"
490 . URL mailto:\\$1 "\\$2" "\\$3"
500 . nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
502 . nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
508 . nop \m[\\*[www:color]]\\$2\m[]\\$3
510 . nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
514 . nop \m[\\*[www:color]]\\$2\m[]
515 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
518 . nop \f[\\*[www:fontstyle]]\\$2\f[]
519 . nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
526 .\" --------------------------------------------------------------------
529 .\" Generate an HTML name NAME.
530 .\" Define string TAG_NAME to TEXT, if present, otherwise to \n[PN].
531 .\" Register PN is the current page number.
534 . HTML <a "name=""\\$1""></a>"
538 . ds TAG_\\$1 \\n[PN]\"
543 .\" --------------------------------------------------------------------
544 .\" IMG [-R|-L|-C] filename [width] [height]
546 .\" Include an image of any type (only works for -Thtml).
548 .\" Alignment is centered by default (-C).
549 .\" Default value for WIDTH is 1i.
550 .\" If HEIGHT is not given, WIDTH is used as the height.
553 . ie \\n[www-html] \{\
555 . DEVTAG .right-image
560 . DEVTAG .centered-image
565 . nr www-height \\n[www-width]
568 . HTML <img "src=""\\$1""" \
569 "alt=""Image \\$1""" \
570 "width=""\\n[www-width]""" \
571 "height=""\\n[www-height]""\\*[www->]"
574 . nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
577 .\" --------------------------------------------------------------------
578 .\" PIMG [-R|-L|-C] filename [width] [height]
580 .\" Include a PNG image. It works for -Tps and -Thtml.
581 .\" The default value for WIDTH and HEIGHT is zero; the default
582 .\" alignment is centering (-C).
584 .\" Note: This macro can only be used with the '-U' option of groff,
585 .\" activating unsafe mode, if not used with -Thtml; the PNG image
586 .\" is then converted to the EPS format using netpbm utilities.
589 . ds www-pic-align -C\"
591 . ds www-pic-align -R\"
596 . ds www-pic-align -L\"
603 . ie \\n[www-html] \{\
604 . ds www-htmlalign align="center"\"
605 . if '\\*[www-pic-align]'-R' \
606 . ds www-htmlalign align="right"\"
607 . if '\\*[www-pic-align]'-L' \
608 . ds www-htmlalign align="left"\"
613 . nr www-width (\\$3 * 100 / 240)
615 . nr www-height (\\$4 * 100 / 240)
616 . ie (\\n[www-width] == 0) \{\
617 . ie (\\n[www-height] == 0) \
618 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
619 "alt=""Image \\$1""\\*[www->]</p>"
621 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
622 "alt=""Image \\$1""" \
623 "height=""\\n[www-height]""\\*[www->]</p>"
626 . ie (\\n[www-height] == 0) \
627 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
628 "alt=""Image \\$1""" \
629 "width=""\\n[www-width]""\\*[www->]</p>"
631 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
632 "alt=""Image \\$1""" \
633 "width=""\\n[www-width]""" \
634 "height=""\\n[www-height]""\\*[www->]</p>"
639 . www-make-unique-name
642 | @PNMTOPS_NOSETPAGE@ -noturn \
643 > \\*[www-unique-name].eps
645 . PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
650 .\" --------------------------------------------------------------------
651 .\" auxiliary definitions for MPIMG
653 .nr www-left-ll-trap 0
654 .nr www-left-po-trap 0
655 .nr www-right-ll-trap 0
657 .de www-finish-left-po
658 . po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
659 . wh \\n[www-left-po-trap]u
660 . nr www-left-indent 0
663 .\" called when the -R picture is finished
664 .de www-finish-right-ll
665 . ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
667 . \" now check whether we need to inline www-finish-left-ll
668 . if (\\n[www-left-ll-trap]u > 0) \
669 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
670 . mk www-left-po-trap
671 . nr www-left-po-trap +1v
672 . wh \\n[www-left-po-trap]u www-finish-left-po
673 . ll +\\n[www-left-indent]u
674 . wh \\n[www-left-ll-trap]u
675 . nr www-left-ll-trap 0
678 . \" and check whether we need to inline www-finish-left-po
679 . if (\\n[www-left-po-trap]u > 0) \
680 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
681 . po -\\n[www-left-indent]u
682 . wh \\n[www-left-po-trap]u
683 . nr www-left-indent 0
686 . wh \\n[www-right-ll-trap]u
687 . nr www-right-ll-trap 0
690 .de www-finish-left-ll
691 . if (\\n[www-right-ll-trap] > 0) \
692 . if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
693 . ll +\\n[www-right-indent]u
694 . nr www-right-ll-trap 0
697 . mk www-left-po-trap
698 . nr www-left-po-trap +1v
699 . wh \\n[www-left-po-trap]u www-finish-left-po
700 . ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
701 . wh \\n[www-left-ll-trap]u
702 . nr www-left-ll-trap 0
705 .\" www-handle-percent arg N1 N2 S1
706 .\" arg - input string (number or number%)
707 .\" output parameters:
708 .\" N1 - name of number register 1=absolute 0=percentage
709 .\" N2 - number register name for absolute value
710 .\" S1 - string register name for percentage value
712 .de www-handle-percent
713 . ds www-percent \\$1\"
714 . substring www-percent -1 -1
716 . ie '\\*[www-percent]'%' \{\
718 . substring www-abs 0 -2
720 . nr \\$3 \\*[www-abs]
730 .\" --------------------------------------------------------------------
731 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
733 .\" Include a PNG image and wrap text around it. It works for
734 .\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
735 .\" for HEIGHT is WIDTH; the default alignment is left (-L).
736 .\" -G is used to insert a gap between the text and the image.
737 .\" The height and width can also be given as a percentage.
738 .\" The PostScript device converts the percentage width into an
739 .\" absolute value by using \\n[.l], and the height by using \\n[.p].
742 .\" Note: This macro can only be used with the '-U' option of groff,
743 .\" activating unsafe mode, if not used with -Thtml; the PNG image
744 .\" is then converted to the EPS format using netpbm utilities.
746 .nr www-htmlimage-gap 0
749 . nr www-image-just 1
751 . while (\\n[.$] > 0) \{\
753 . nr www-image-just 1
758 . nr www-image-just 0
763 . nr www-image-gap \\$2
764 . nr www-htmlimage-gap (\\$2 * 100 / 240)
773 . ds www-size-specs width="\\n[www-width]" height="\\n[www-height]"\"
775 . nr www-is-absolute 0
777 . ds www-percentage none\"
778 . www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
779 . ie !\\n[www-is-absolute] \{\
780 . \" percentage of linelength requested
781 . nr www-width (\\n[www-absolute] * \\n[.l] / 100)
783 . nr www-width (\\n[www-width] * 100 / 240)
784 . ds www-size-specs width="\\*[www-percentage]"\"
787 . nr www-width \\n[www-absolute]
789 . nr www-width (\\n[www-width] * 100 / 240)
790 . ds www-size-specs width="\\n[www-width]"\"
793 . nr www-height \\n[www-width]
795 . nr www-is-absolute 0
797 . ds www-percentage none\"
798 . www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
799 . ie !\\n[www-is-absolute] \{\
800 . \" percentage of pagelength requested
801 . nr www-height (\\n[www-absolute] * \\n[.p] / 100)
803 . nr www-height (\\n[www-height] * 100 / 240)
804 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
807 . nr www-height \\n[www-absolute]
809 . nr www-height (\\n[www-height] * 100 / 240)
810 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-height]"\"
815 . \" height not specified; use width value
816 . ie !\\n[www-is-absolute] \{\
817 . \" percentage value
818 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
819 . nr www-height \\n[www-width]
822 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-width]"\"
823 . nr www-height \\n[www-width]
827 . ie \\n[www-html] \{\
828 . ie !\\n[www-image-just] \
829 . HTML <img "src=""\\$1""" \
830 "alt=""Image \\$1""" \
831 "hspace=""\\n[www-htmlimage-gap]""" \
833 "\\*[www-size-specs]\\*[www->]"
835 . HTML <img "src=""\\$1""" \
836 "alt=""Image \\$1""" \
837 "hspace=""\\n[www-htmlimage-gap]""" \
839 "\\*[www-size-specs]\\*[www->]"
842 . tm www-width is \\n[www-width]
843 . tm www-height is \\n[www-height]
845 . www-make-unique-name
848 | @PNMTOPS_NOSETPAGE@ -noturn \
849 > \\*[www-unique-name].eps
850 . ie !\\n[www-image-just] \{\
851 . \" we must now disable a possible left image trap
853 . if (\\n[www-left-ll-trap] > 0) \
854 . wh \\n[www-left-ll-trap]u
855 . if (\\n[www-left-po-trap] > 0) \
856 . wh \\n[www-left-po-trap]u
857 . PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
860 . nr www-right-indent \\n[ps-deswid]u
861 . \" we want to have some space between text and image,
862 . \" so the line length must be shorter
863 . ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
864 . mk www-right-ll-trap
865 . nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
866 . wh \\n[www-right-ll-trap]u www-finish-right-ll
868 . \" now restore possible left trap
869 . if (\\n[www-left-ll-trap] > 0) \
870 . wh \\n[www-left-ll-trap]u www-finish-left-ll
871 . if (\\n[www-left-po-trap] > 0) \
872 . wh \\n[www-left-po-trap]u
875 . \" we must now disable a possible right image trap
876 . if (\\n[www-right-ll-trap] > 0) \
877 . wh \\n[www-right-ll-trap]u
878 . PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
881 . nr www-left-indent \\n[ps-deswid]u
882 . \" increase offset by gap
883 . po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
884 . \" decrease line length by gap
885 . ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
886 . mk www-left-ll-trap
887 . nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
888 . wh \\n[www-left-ll-trap]u www-finish-left-ll
890 . \" now restore possible right trap
891 . if (\\n[www-right-ll-trap] > 0) \
892 . wh \\n[www-right-ll-trap]u www-finish-right-ll
898 .\" --------------------------------------------------------------------
901 .\" Begin heading. Heading level is N.
907 .\" If your heading contains URL, FTP, MTO macros you might wish to
908 .\" disable automatic links to headings. This can be done via '-P-l'
909 .\" from the command line or by using a cakk to '.HX 0'.
911 .nr www-heading-no -1
915 . nr www-heading-no 1
917 . nr www-heading-no \\$1
918 . DEVTAG-NH \\n[www-heading-no]
922 . if (\\n[www-heading-no] == -1) \
923 . www-error HnE found without a corresponding HnS
927 .\" --------------------------------------------------------------------
930 .\" Emit the automatically collected links derived from
931 .\" section/numbered headings at this position.
937 .\" --------------------------------------------------------------------
940 .\" Produce a horizontal line.
943 . HTML</p> <hr\\*[www->]
946 .\" --------------------------------------------------------------------
949 .\" Suppress the generation of the top and bottom rules which grohtml
950 .\" emits by default.
953 . DEVTAG .no-auto-rule
957 .\" www-end-nowhere - end of input trap called to finish diversion.
960 . if !\\n[www-html] \
965 .\" --------------------------------------------------------------------
968 .\" Generate an HTML title only. This differs from the -ms .TL macro
969 .\" which generates both an HTML title and an H1 heading.
971 .\" This is useful when an author wishes to use an HTML title as
972 .\" search engine fodder but a graphic title in the document.
974 .\" The macro terminates when a space or break is seen (.sp, .br).
978 . if !\\n[www-html] \
980 . it 2 www-end-nowhere
983 .\" --------------------------------------------------------------------
984 .\" auxiliary definitions for lists
986 .ds www-ul-level1 \[bu]\ \ \"
987 .ds www-ul-level2 \[sq]\ \ \"
988 .ds www-ul-level3 \[ci]\ \ \"
991 .ds www-ol-level1 decimal\"
992 .ds www-ol-level2 lower-alpha\"
993 .ds www-ol-level3 lower-roman\"
994 .ds www-ol-tmp 00\ \ \"
1006 .\" allow nested lists
1009 .nr www-li-indent \n[.i]
1010 .ds www-level0 nop\"
1021 .\" which macro to use for LI
1023 . nr www-li-indent \\n[.i]
1025 . ds www-level\\n[www-depth] \\$1\"
1026 . ds www-ltag\\n[www-depth]
1032 . als LI \\*[www-level\\n[www-depth]]
1035 .\" www-emit-ltag - shut down a previous open list tag
1036 .\" before issuing a new tag \\$1.
1037 .\" It then records tag \\$1 is open.
1040 . if !'\\*[www-ltag\\n[www-depth]]'' \
1041 . HTML-NS </\\*[www-ltag\\n[www-depth]]>
1044 . ds www-ltag\\n[www-depth] \\$1\"
1048 .\" Auxiliary macro for ULS.
1050 .de www-push-ul-level
1051 . nr www-ul-level +1
1052 . if (\\n[www-ul-level] > 3) \
1053 . www-error ULS: too many levels of indentation (\\n[www-ul-level])
1056 .\" Auxiliary macro for ULE.
1058 .de www-pop-ul-level
1059 . if !\\n[www-ul-level] \
1060 . www-error ULE: trying to terminate a list which does not exist
1061 . nr www-ul-level -1
1065 .\" Auxiliary macro for OLS.
1067 .de www-push-ol-level
1068 . nr www-ol-level +1
1069 . if (\\n[www-ol-level] > 3) \
1070 . www-error OLS: too many levels of indentation (\\n[www-ol-level])
1074 .\" Auxiliary macro for OLE.
1076 .de www-pop-ol-level
1077 . if !\\n[www-ol-level] \
1078 . www-error OLE: trying to terminate a list which does not exist
1079 . nr www-ol-level -1
1082 .\" --------------------------------------------------------------------
1085 .\" Start an unordered list.
1088 . www-push-li www-li-ul
1090 . ie \\n[www-html] \{\
1095 . nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1098 .\" --------------------------------------------------------------------
1101 .\" End an unordered list.
1104 . ie \\n[www-html] \{\
1109 . nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1110 . in \\n[www-li-indent]u
1116 .\" --------------------------------------------------------------------
1119 .\" Start an ordered list.
1122 . www-push-li www-li-ol
1124 . ie \\n[www-html] \{\
1126 . HTML</p> <ol "style=""list-style-type:" \
1127 "\\*[www-ol-level\\n[www-ol-level]]"">"
1130 . nr www-li-indent +\w'\\*[www-ol-tmp]'u
1133 .\" --------------------------------------------------------------------
1136 .\" End an ordered list.
1139 . ie \\n[www-html] \{\
1144 . nr www-li-indent -\w'\\*[www-ol-tmp]'u
1145 . in \\n[www-li-indent]u
1146 . nr www-ol-ctr\\n[www-ol-level] 0 1
1152 .\" --------------------------------------------------------------------
1155 .\" Start a definition list.
1158 . www-push-li www-li-dl
1159 . nr www-dl-level +1
1160 . ie \\n[www-html] \{\
1165 . nr www-li-indent +\\n[www-dl-shift]u
1166 . in \\n[www-li-indent]u
1170 .\" --------------------------------------------------------------------
1173 .\" End a definition list.
1176 . ie \\n[www-html] \{\
1181 . nr www-li-indent -\\n[www-dl-shift]u
1182 . in \\n[www-li-indent]u
1184 . nr www-dl-level -1
1188 .\" --------------------------------------------------------------------
1191 .\" Insert a list item.
1195 .\" www-li-ul - bulleted list item
1198 . ie \\n[www-html] \
1204 . in \\n[www-li-indent]u
1205 . ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1206 . nop \\*[www-ul-level\\n[www-ul-level]]\c
1211 .\" www-li-ol - numbered list item
1214 . ie \\n[www-html] \
1220 . in \\n[www-li-indent]u
1221 . ti -\w'\\n+[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1222 . nop \\n[www-ol-ctr\\n[www-ol-level]]\ \ \c
1227 .\" www-li-dl - definition list item
1230 . ie \\n[www-html] \{\
1231 . HTML <dt>\\$1</dt>
1238 . in \\n[www-li-indent]u
1239 . ti -\\n[www-dl-shift]u
1245 .\" --------------------------------------------------------------------
1246 .\" DC l text [color]
1248 .\" L is the letter to be dropped and enlarged.
1250 .\" TEXT is the following text whose height the first letter should
1253 .\" COLOR is the optional color of the dropped letter (default black).
1256 . ds www-dropcolor black\"
1258 . ds www-dropcolor \\$3\"
1259 . ie '\*[.T]'html' \{\
1260 . www-make-unique-name
1261 . nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1262 . MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1266 . www-make-unique-name
1267 . \" To avoid interferences with another DC macro call which is
1268 . \" located very near to the current one, we draw the glyph on a
1269 . \" separate page. Otherwise it could theoretically happen that
1270 . \" the dropped capital glyphs overlap.
1274 . nop \O[5i\\*[www-unique-name].png]\O[1]
1275 . nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1285 . nr dummy \w'\\$1'u
1286 . nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1287 . char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1288 . nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1297 .\" supplementary macros used by other macro sets
1299 .\" here are some tags specially for -Tps or -Thtml when invoked by
1300 .\" pre-html to generate PNG images from postscript.
1302 .\" --------------------------------------------------------------------
1303 .\" HTML-DO-IMAGE - tell troff to issue an image marker which can be
1304 .\" read back by pre-html
1308 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1309 . if \\n[www-html] \
1310 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1313 .\" --------------------------------------------------------------------
1314 .\" HTML-IMAGE-END - terminate an image for HTML
1318 . nop \O[4]\O[2]\O[0]
1319 . if \\n[www-html] \
1320 . nop \O[4]\O[2]\O[1]
1325 .\" --------------------------------------------------------------------
1326 .\" www-make-unique-name - generate another unique name in string
1327 .\" 'www-unique-name'
1329 .de www-make-unique-name
1331 . ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1334 .\" --------------------------------------------------------------------
1335 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1336 .\" to be rendered as an image.
1339 . \" generates a centered image
1340 . www-make-unique-name
1341 . HTML-DO-IMAGE \\*[www-unique-name] c
1344 .de HTML-IMAGE-RIGHT
1345 . www-make-unique-name
1346 . HTML-DO-IMAGE \\*[www-unique-name] r
1350 . www-make-unique-name
1351 . HTML-DO-IMAGE \\*[www-unique-name] l
1354 .de HTML-IMAGE-INLINE
1355 . www-make-unique-name
1356 . HTML-DO-IMAGE \\*[www-unique-name] i
1359 .\" EQN-HTML-IMAGE and friends check to see whether the equation is
1360 .\" not in an image, in which case it allows HTML
1361 .\" (mathml) to be generated (if -Txhtml was specified).
1364 . \" generates a centered image
1365 . www-make-unique-name
1366 . EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1369 .de EQN-HTML-IMAGE-RIGHT
1370 . www-make-unique-name
1371 . EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1374 .de EQN-HTML-IMAGE-LEFT
1375 . www-make-unique-name
1376 . EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1379 .de EQN-HTML-IMAGE-INLINE
1380 . www-make-unique-name
1381 . EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1384 .\" --------------------------------------------------------------------
1385 .\" EQN-HTML-DO-IMAGE - tell troff to issue an image marker which can be
1386 .\" read back by pre-html
1388 .de EQN-HTML-DO-IMAGE
1390 . if !(\\n[.O] == 0) \{\
1392 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1393 . if \\n[www-html] \
1394 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1398 . HTML-DO-IMAGE \\$*
1401 .\" --------------------------------------------------------------------
1402 .\" EQN-HTML-IMAGE-END - terminate an image for HTML
1404 .de EQN-HTML-IMAGE-END
1406 . if !(\\n[.O] == 0) \{\
1408 . nop \O[4]\O[2]\O[0]
1409 . if \\n[www-html] \
1410 . nop \O[4]\O[2]\O[1]
1417 .\" --------------------------------------------------------------------
1418 .\" Setup around HTML-IMAGE and friends
1420 .\" now set up TS, TE, EQ, EN default macros
1422 .\" we must not use '.als': the definition of .TE in s.tmac, for
1423 .\" example, calls .HTML-IMAGE-END, which would refer to itself due to
1424 .\" the alias, causing an endless loop
1429 . if \\n[www-html] \{\
1430 . nr www-TS-ll \\n[.l]
1437 . if \\n[www-html] \
1438 . ll \\n[www-TS-ll]u
1439 . HTML-IMAGE-END \\$@
1444 . EQN-HTML-IMAGE \\$@
1445 . if \\n[www-html] \{\
1446 . nr www-EQ-ll \\n[.l]
1453 . if \\n[www-html] \
1454 . ll \\n[www-EQ-ll]u
1455 . EQN-HTML-IMAGE-END \\$@
1459 .\" --------------------------------------------------------------------
1462 .\" Generate multiple output files containing the HTML.
1463 .\" A file is split whenever a .SH or .NH 1 is encountered.
1464 .\" The argument to JOBNAME is the file stem for future output files.
1467 . DEVTAG .job-name \\$1
1470 .\" --------------------------------------------------------------------
1473 .\" Add information to the <head> </head> section of the HTML
1477 . DEVTAG .head "\\$*"
1480 .\" --------------------------------------------------------------------
1481 .\" start of some code
1488 .\" --------------------------------------------------------------------
1489 .\" end of some code
1496 .ds www-nav-colour #eeeeee\"
1497 .nr www-nav-width-left 30
1498 .nr www-nav-width-right 70
1500 .\" --------------------------------------------------------------------
1501 .\" LNS - left navigation start
1504 . HTML</p> <table><tr><td "valign=""top""" \
1505 "width=""\\n[www-nav-width-left]%""" \
1506 "bgcolor=""\\*[www-nav-colour]"">"
1508 . HTML</p> </td><td "valign=""top""" \
1509 "width=""\\n[www-nav-width-right]%"">"
1513 .\" --------------------------------------------------------------------
1514 .\" LNE - left navigation end
1517 . HTML</p> </td></tr></table>
1525 .\" some auxiliary macros for left navigation lists
1528 . if (0\\$1 == 0) \{\
1529 . if (\\n[SH-open] == 1) \
1537 . if (0\\$1 <= 1) \{\
1538 . if (\\n[SH-open] == 1) \
1547 . if (\\n[needs-begin] == 1) \{\
1554 .\" --------------------------------------------------------------------
1555 .\" ALN [colour] [left width percentage]
1557 .\" Turn on automatic left navigation. This macro should only be
1558 .\" called once (normally at the start of the document) as it
1559 .\" indicates that all top-level section headings form a navigation
1560 .\" list on the left of the main text.
1563 . if '\*[.T]'html' \{\
1565 . ds www-nav-colour \\$1\"
1566 . if (0\\$2 > 0) \{\
1567 . nr www-nav-width-left \\$2
1568 . nr www-nav-width-right (100 - \\$2)
1579 .\" --------------------------------------------------------------------
1580 .\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
1582 .\" Initialize www.tmac so that when this macro set is used with
1583 .\" non-HTML devices the urls are rendered the user defined
1584 .\" attributes. For example:
1586 .\" LINKSTYLE blue CR < >
1589 . if (\\n[.$] < 1) \
1590 . www:error .\\$0 expects at least 1 argument.
1591 . ds www:color \\$1\"
1593 . if (\\n[.$] < 1) \
1595 . ds www:fontstyle \\$1\"
1597 . if (\\n[.$] < 1) \
1598 . www:error .\\$0 expects that both the open and close glyph is specified
1599 . ds www:open \\$1\"
1600 . ds www:close \\$2\"
1603 .\" MATHML - enable eqn mathml output to pass through to the device
1607 . if (\\n[.O] == 0) \
1611 .\" --------------------------------------------------------------------
1613 .\" --------------------------------------------------------------------
1615 .LINKSTYLE blue CR \[la] \[ra]
1617 .if \n[www-html] \{\
1622 .if r ps4html .nop \O[0]
1627 .\" ====================================================================
1629 .\" ====================================================================
1631 .\" Local Variables:
1635 .\" vim: set filetype=groff textwidth=72: