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, 2009
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 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].
524 . HTML <a "name=""\\$1""></a>"
526 . ds TAG_\\$1 \\n[PN]\"
531 .\" --------------------------------------------------------------------
532 .\" IMG [-R|-L|-C] filename [width] [height]
534 .\" Include an image of any type (only works for -Thtml).
536 .\" Alignment is centered by default (-C).
537 .\" Default value for WIDTH is 1i.
538 .\" If HEIGHT is not given, WIDTH is used as the height.
541 . ie \\n[www-html] \{\
543 . DEVTAG .right-image
548 . DEVTAG .centered-image
553 . nr www-height \\n[www-width]
556 . HTML <img "src=""\\$1""" \
557 "alt=""Image \\$1""" \
558 "width=""\\n[www-width]""" \
559 "height=""\\n[www-height]""\\*[www->]"
562 . nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
565 .\" --------------------------------------------------------------------
566 .\" PIMG [-R|-L|-C] filename [width] [height]
568 .\" Include a PNG image. It works for -Tps and -Thtml.
569 .\" The default value for WIDTH and HEIGHT is zero; the default
570 .\" alignment is centering (-C).
572 .\" Note: This macro can only be used with the `-U' option of groff,
573 .\" activating unsafe mode, if not used with -Thtml; the PNG image
574 .\" is then converted to the EPS format using netpbm utilities.
577 . ds www-pic-align -C\"
579 . ds www-pic-align -R\"
584 . ds www-pic-align -L\"
591 . ie \\n[www-html] \{\
592 . ds www-htmlalign align="center"\"
593 . if '\\*[www-pic-align]'-R' \
594 . ds www-htmlalign align="right"\"
595 . if '\\*[www-pic-align]'-L' \
596 . ds www-htmlalign align="left"\"
601 . nr www-width (\\$3 * 100 / 240)
603 . nr www-height (\\$4 * 100 / 240)
604 . ie (\\n[www-width] == 0) \{\
605 . ie (\\n[www-height] == 0) \
606 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
607 "alt=""Image \\$1""\\*[www->]</p>"
609 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
610 "alt=""Image \\$1""" \
611 "height=""\\n[www-height]""\\*[www->]</p>"
614 . ie (\\n[www-height] == 0) \
615 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
616 "alt=""Image \\$1""" \
617 "width=""\\n[www-width]""\\*[www->]</p>"
619 . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
620 "alt=""Image \\$1""" \
621 "width=""\\n[www-width]""" \
622 "height=""\\n[www-height]""\\*[www->]</p>"
627 . www-make-unique-name
630 | @PNMTOPS_NOSETPAGE@ -noturn \
631 > \\*[www-unique-name].eps
633 . PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
638 .\" --------------------------------------------------------------------
639 .\" auxiliary definitions for MPIMG
641 .nr www-left-ll-trap 0
642 .nr www-left-po-trap 0
643 .nr www-right-ll-trap 0
645 .de www-finish-left-po
646 . po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
647 . wh \\n[www-left-po-trap]u
648 . nr www-left-indent 0
651 .\" called when the -R picture is finished
652 .de www-finish-right-ll
653 . ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
655 . \" now check whether we need to inline www-finish-left-ll
656 . if (\\n[www-left-ll-trap]u > 0) \
657 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
658 . mk www-left-po-trap
659 . nr www-left-po-trap +1v
660 . wh \\n[www-left-po-trap]u www-finish-left-po
661 . ll +\\n[www-left-indent]u
662 . wh \\n[www-left-ll-trap]u
663 . nr www-left-ll-trap 0
666 . \" and check whether we need to inline www-finish-left-po
667 . if (\\n[www-left-po-trap]u > 0) \
668 . if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
669 . po -\\n[www-left-indent]u
670 . wh \\n[www-left-po-trap]u
671 . nr www-left-indent 0
674 . wh \\n[www-right-ll-trap]u
675 . nr www-right-ll-trap 0
678 .de www-finish-left-ll
679 . if (\\n[www-right-ll-trap] > 0) \
680 . if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
681 . ll +\\n[www-right-indent]u
682 . nr www-right-ll-trap 0
685 . mk www-left-po-trap
686 . nr www-left-po-trap +1v
687 . wh \\n[www-left-po-trap]u www-finish-left-po
688 . ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
689 . wh \\n[www-left-ll-trap]u
690 . nr www-left-ll-trap 0
693 .\" www-handle-percent arg N1 N2 S1
694 .\" arg - input string (number or number%)
695 .\" output parameters:
696 .\" N1 - name of number register 1=absolute 0=percentage
697 .\" N2 - number register name for absolute value
698 .\" S1 - string register name for percentage value
700 .de www-handle-percent
701 . ds www-percent \\$1\"
702 . substring www-percent -1 -1
704 . ie '\\*[www-percent]'%' \{\
706 . substring www-abs 0 -2
708 . nr \\$3 \\*[www-abs]
718 .\" --------------------------------------------------------------------
719 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
721 .\" Include a PNG image and wrap text around it. It works for
722 .\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
723 .\" for HEIGHT is WIDTH; the default alignment is left (-L).
724 .\" -G is used to insert a gap between the text and the image.
725 .\" The height and width can also be given as a percentage.
726 .\" The PostScript device converts the percentage width into an
727 .\" absolute value by using \\n[.l], and the height by using \\n[.p].
730 .\" Note: This macro can only be used with the `-U' option of groff,
731 .\" activating unsafe mode, if not used with -Thtml; the PNG image
732 .\" is then converted to the EPS format using netpbm utilities.
734 .nr www-htmlimage-gap 0
737 . nr www-image-just 1
739 . while (\\n[.$] > 0) \{\
741 . nr www-image-just 1
746 . nr www-image-just 0
751 . nr www-image-gap \\$2
752 . nr www-htmlimage-gap (\\$2 * 100 / 240)
761 . ds www-size-specs width="\\n[www-width]" height="\\n[www-height]"\"
763 . nr www-is-absolute 0
765 . ds www-percentage none\"
766 . www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
767 . ie !\\n[www-is-absolute] \{\
768 . \" percentage of linelength requested
769 . nr www-width (\\n[www-absolute] * \\n[.l] / 100)
771 . nr www-width (\\n[www-width] * 100 / 240)
772 . ds www-size-specs width="\\*[www-percentage]"\"
775 . nr www-width \\n[www-absolute]
777 . nr www-width (\\n[www-width] * 100 / 240)
778 . ds www-size-specs width="\\n[www-width]"\"
781 . nr www-height \\n[www-width]
783 . nr www-is-absolute 0
785 . ds www-percentage none\"
786 . www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
787 . ie !\\n[www-is-absolute] \{\
788 . \" percentage of pagelength requested
789 . nr www-height (\\n[www-absolute] * \\n[.p] / 100)
791 . nr www-height (\\n[www-height] * 100 / 240)
792 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
795 . nr www-height \\n[www-absolute]
797 . nr www-height (\\n[www-height] * 100 / 240)
798 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-height]"\"
803 . \" height not specified; use width value
804 . ie !\\n[www-is-absolute] \{\
805 . \" percentage value
806 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
807 . nr www-height \\n[www-width]
810 . ds www-size-specs "\\*[www-size-specs] height="\\*[www-width]"\"
811 . nr www-height \\n[www-width]
815 . ie \\n[www-html] \{\
816 . ie !\\n[www-image-just] \
817 . HTML <img "src=""\\$1""" \
818 "alt=""Image \\$1""" \
819 "hspace=""\\n[www-htmlimage-gap]""" \
821 "\\*[www-size-specs]\\*[www->]"
823 . HTML <img "src=""\\$1""" \
824 "alt=""Image \\$1""" \
825 "hspace=""\\n[www-htmlimage-gap]""" \
827 "\\*[www-size-specs]\\*[www->]"
830 . tm www-width is \\n[www-width]
831 . tm www-height is \\n[www-height]
833 . www-make-unique-name
836 | @PNMTOPS_NOSETPAGE@ -noturn \
837 > \\*[www-unique-name].eps
838 . ie !\\n[www-image-just] \{\
839 . \" we must now disable a possible left image trap
841 . if (\\n[www-left-ll-trap] > 0) \
842 . wh \\n[www-left-ll-trap]u
843 . if (\\n[www-left-po-trap] > 0) \
844 . wh \\n[www-left-po-trap]u
845 . PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
848 . nr www-right-indent \\n[ps-deswid]u
849 . \" we want to have some space between text and image,
850 . \" so the line length must be shorter
851 . ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
852 . mk www-right-ll-trap
853 . nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
854 . wh \\n[www-right-ll-trap]u www-finish-right-ll
856 . \" now restore possible left trap
857 . if (\\n[www-left-ll-trap] > 0) \
858 . wh \\n[www-left-ll-trap]u www-finish-left-ll
859 . if (\\n[www-left-po-trap] > 0) \
860 . wh \\n[www-left-po-trap]u
863 . \" we must now disable a possible right image trap
864 . if (\\n[www-right-ll-trap] > 0) \
865 . wh \\n[www-right-ll-trap]u
866 . PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
869 . nr www-left-indent \\n[ps-deswid]u
870 . \" increase offset by gap
871 . po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
872 . \" decrease line length by gap
873 . ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
874 . mk www-left-ll-trap
875 . nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
876 . wh \\n[www-left-ll-trap]u www-finish-left-ll
878 . \" now restore possible right trap
879 . if (\\n[www-right-ll-trap] > 0) \
880 . wh \\n[www-right-ll-trap]u www-finish-right-ll
886 .\" --------------------------------------------------------------------
889 .\" Begin heading. Heading level is N.
895 .\" If your heading contains URL, FTP, MTO macros you might wish to
896 .\" disable automatic links to headings. This can be done via `-P-l'
897 .\" from the command line or by using a cakk to `.HX 0'.
899 .nr www-heading-no -1
903 . nr www-heading-no 1
905 . nr www-heading-no \\$1
906 . DEVTAG-NH \\n[www-heading-no]
910 . if (\\n[www-heading-no] == -1) \
911 . www-error HnE found without a corresponding HnS
915 .\" --------------------------------------------------------------------
918 .\" Emit the automatically collected links derived from
919 .\" section/numbered headings at this position.
925 .\" --------------------------------------------------------------------
928 .\" Produce a horizontal line.
931 . HTML</p> <hr\\*[www->]
934 .\" --------------------------------------------------------------------
937 .\" Suppress the generation of the top and bottom rules which grohtml
938 .\" emits by default.
941 . DEVTAG .no-auto-rule
945 .\" www-end-nowhere - end of input trap called to finish diversion.
948 . if !\\n[www-html] \
953 .\" --------------------------------------------------------------------
956 .\" Generate an HTML title only. This differs from the -ms .TL macro
957 .\" which generates both an HTML title and an H1 heading.
959 .\" This is useful when an author wishes to use an HTML title as search
960 .\" engine fodder but a graphic title in the document.
962 .\" The macro terminates when a space or break is seen (.sp, .br).
966 . if !\\n[www-html] \
968 . it 2 www-end-nowhere
971 .\" --------------------------------------------------------------------
972 .\" auxiliary definitions for lists
974 .ds www-ul-level1 \[bu]\ \ \"
975 .ds www-ul-level2 \[sq]\ \ \"
976 .ds www-ul-level3 \[ci]\ \ \"
979 .ds www-ol-level1 decimal\"
980 .ds www-ol-level2 lower-alpha\"
981 .ds www-ol-level3 lower-roman\"
982 .ds www-ol-tmp 00\ \ \"
994 .\" allow nested lists
997 .nr www-li-indent \n[.i]
1009 .\" which macro to use for LI
1012 . ds www-level\\n[www-depth] \\$1\"
1013 . ds www-ltag\\n[www-depth]
1019 . als LI \\*[www-level\\n[www-depth]]
1022 .\" www-emit-ltag - shut down a previous open list tag
1023 .\" before issuing a new tag \\$1.
1024 .\" It then records tag \\$1 is open.
1027 . if !'\\*[www-ltag\\n[www-depth]]'' \
1028 . HTML-NS </\\*[www-ltag\\n[www-depth]]>
1031 . ds www-ltag\\n[www-depth] \\$1\"
1035 .\" Auxiliary macro for ULS.
1037 .de www-push-ul-level
1038 . nr www-ul-level +1
1039 . if (\\n[www-ul-level] > 3) \
1040 . www-error ULS: too many levels of indentation (\\n[www-ul-level])
1043 .\" Auxiliary macro for ULE.
1045 .de www-pop-ul-level
1046 . if !\\n[www-ul-level] \
1047 . www-error ULE: trying to terminate a list which does not exist
1048 . nr www-ul-level -1
1052 .\" Auxiliary macro for OLS.
1054 .de www-push-ol-level
1055 . nr www-ol-level +1
1056 . if (\\n[www-ol-level] > 3) \
1057 . www-error OLS: too many levels of indentation (\\n[www-ol-level])
1061 .\" Auxiliary macro for OLE.
1063 .de www-pop-ol-level
1064 . if !\\n[www-ol-level] \
1065 . www-error OLE: trying to terminate a list which does not exist
1066 . nr www-ol-level -1
1069 .\" --------------------------------------------------------------------
1072 .\" Start an unordered list.
1075 . www-push-li www-li-ul
1077 . ie \\n[www-html] \{\
1082 . nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1085 .\" --------------------------------------------------------------------
1088 .\" End an unordered list.
1091 . ie \\n[www-html] \{\
1096 . nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1097 . in \\n[www-li-indent]u
1103 .\" --------------------------------------------------------------------
1106 .\" Start an ordered list.
1109 . www-push-li www-li-ol
1111 . ie \\n[www-html] \{\
1113 . HTML</p> <ol "style=""list-style-type:" \
1114 "\\*[www-ol-level\\n[www-ol-level]]"">"
1117 . nr www-li-indent +\w'\\*[www-ol-tmp]'u
1120 .\" --------------------------------------------------------------------
1123 .\" End an ordered list.
1126 . ie \\n[www-html] \{\
1131 . nr www-li-indent -\w'\\*[www-ol-tmp]'u
1132 . in \\n[www-li-indent]u
1133 . nr www-ol-ctr\\n[www-ol-level] 0 1
1139 .\" --------------------------------------------------------------------
1142 .\" Start a definition list.
1145 . www-push-li www-li-dl
1146 . nr www-dl-level +1
1147 . ie \\n[www-html] \{\
1152 . nr www-li-indent +\\n[www-dl-shift]u
1153 . in \\n[www-li-indent]u
1157 .\" --------------------------------------------------------------------
1160 .\" End a definition list.
1163 . ie \\n[www-html] \{\
1168 . nr www-li-indent -\\n[www-dl-shift]u
1169 . in \\n[www-li-indent]u
1171 . nr www-dl-level -1
1175 .\" --------------------------------------------------------------------
1178 .\" Insert a list item.
1182 .\" www-li-ul - bulleted list item
1185 . ie \\n[www-html] \
1189 . in \\n[www-li-indent]u
1190 . ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1191 . nop \\*[www-ul-level\\n[www-ul-level]]\c
1196 .\" www-li-ol - numbered list item
1199 . ie \\n[www-html] \
1203 . in \\n[www-li-indent]u
1204 . ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1205 . nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
1210 .\" www-li-dl - definition list item
1213 . ie \\n[www-html] \{\
1214 . HTML <dt>\\$1</dt>
1219 . in \\n[www-li-indent]u
1220 . ti -\\n[www-dl-shift]u
1226 .\" --------------------------------------------------------------------
1227 .\" DC l text [color]
1229 .\" L is the letter to be dropped and enlarged.
1231 .\" TEXT is the following text whose height the first letter should not
1234 .\" COLOR is the optional color of the dropped letter (default black).
1237 . ds www-dropcolor black\"
1239 . ds www-dropcolor \\$3\"
1240 . ie '\*[.T]'html' \{\
1241 . www-make-unique-name
1242 . nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1243 . MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1247 . www-make-unique-name
1248 . \" To avoid interferences with another DC macro call which is located
1249 . \" very near to the current one, we draw the glyph on a separate page.
1250 . \" Otherwise it could theoretically happen that the dropped capital
1251 . \" glyphs overlap.
1255 . nop \O[5i\\*[www-unique-name].png]\O[1]
1256 . nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1266 . nr dummy \w'\\$1'u
1267 . nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1268 . char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1269 . nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1278 .\" supplementary macros used by other macro sets
1280 .\" here are some tags specially for -Tps or -Thtml when invoked by
1281 .\" pre-html to generate PNG images from postscript.
1283 .\" --------------------------------------------------------------------
1284 .\" HTML-DO-IMAGE - tell troff to issue an image marker which can be
1285 .\" read back by pre-html
1289 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1290 . if \\n[www-html] \
1291 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1294 .\" --------------------------------------------------------------------
1295 .\" HTML-IMAGE-END - terminate an image for HTML
1299 . nop \O[4]\O[2]\O[0]
1300 . if \\n[www-html] \
1301 . nop \O[4]\O[2]\O[1]
1306 .\" --------------------------------------------------------------------
1307 .\" www-make-unique-name - generate another unique name in string
1308 .\" `www-unique-name'
1310 .de www-make-unique-name
1312 . ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1315 .\" --------------------------------------------------------------------
1316 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1317 .\" to be rendered as an image.
1320 . \" generates a centered image
1321 . www-make-unique-name
1322 . HTML-DO-IMAGE \\*[www-unique-name] c
1325 .de HTML-IMAGE-RIGHT
1326 . www-make-unique-name
1327 . HTML-DO-IMAGE \\*[www-unique-name] r
1331 . www-make-unique-name
1332 . HTML-DO-IMAGE \\*[www-unique-name] l
1335 .de HTML-IMAGE-INLINE
1336 . www-make-unique-name
1337 . HTML-DO-IMAGE \\*[www-unique-name] i
1340 .\" EQN-HTML-IMAGE and friends check to see whether the equation is
1341 .\" not in an image, in which case it allows HTML
1342 .\" (mathml) to be generated (if -Txhtml was specified).
1345 . \" generates a centered image
1346 . www-make-unique-name
1347 . EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1350 .de EQN-HTML-IMAGE-RIGHT
1351 . www-make-unique-name
1352 . EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1355 .de EQN-HTML-IMAGE-LEFT
1356 . www-make-unique-name
1357 . EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1360 .de EQN-HTML-IMAGE-INLINE
1361 . www-make-unique-name
1362 . EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1365 .\" --------------------------------------------------------------------
1366 .\" EQN-HTML-DO-IMAGE - tell troff to issue an image marker which can be
1367 .\" read back by pre-html
1369 .de EQN-HTML-DO-IMAGE
1371 . if !(\\n[.O] == 0) \{\
1373 . nop \O[5\\$2\\$1.png]\O[1]\O[3]
1374 . if \\n[www-html] \
1375 . nop \O[5\\$2\\$1.png]\O[0]\O[3]
1379 . HTML-DO-IMAGE \\$*
1382 .\" --------------------------------------------------------------------
1383 .\" EQN-HTML-IMAGE-END - terminate an image for HTML
1385 .de EQN-HTML-IMAGE-END
1387 . if !(\\n[.O] == 0) \{\
1389 . nop \O[4]\O[2]\O[0]
1390 . if \\n[www-html] \
1391 . nop \O[4]\O[2]\O[1]
1398 .\" --------------------------------------------------------------------
1399 .\" Setup around HTML-IMAGE and friends
1401 .\" now set up TS, TE, EQ, EN default macros
1403 .\" we must not use `.als': the definition of .TE in s.tmac, for example,
1404 .\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1405 .\" causing an endless loop
1410 . if \\n[www-html] \{\
1411 . nr www-TS-ll \\n[.l]
1418 . if \\n[www-html] \
1419 . ll \\n[www-TS-ll]u
1420 . HTML-IMAGE-END \\$@
1425 . EQN-HTML-IMAGE \\$@
1426 . if \\n[www-html] \{\
1427 . nr www-EQ-ll \\n[.l]
1434 . if \\n[www-html] \
1435 . ll \\n[www-EQ-ll]u
1436 . EQN-HTML-IMAGE-END \\$@
1440 .\" --------------------------------------------------------------------
1443 .\" Generate multiple output files containing the HTML.
1444 .\" A file is split whenever a .SH or .NH 1 is encountered.
1445 .\" The argument to JOBNAME is the file stem for future output files.
1448 . DEVTAG .job-name \\$1
1451 .\" --------------------------------------------------------------------
1454 .\" Add information to the <head> </head> section of the HTML
1458 . DEVTAG .head "\\$*"
1461 .\" --------------------------------------------------------------------
1462 .\" start of some code
1469 .\" --------------------------------------------------------------------
1470 .\" end of some code
1477 .ds www-nav-colour #eeeeee\"
1478 .nr www-nav-width-left 30
1479 .nr www-nav-width-right 70
1481 .\" --------------------------------------------------------------------
1482 .\" LNS - left navigation start
1485 . HTML</p> <table><tr><td "valign=""top""" \
1486 "width=""\\n[www-nav-width-left]%""" \
1487 "bgcolor=""\\*[www-nav-colour]"">"
1489 . HTML</p> </td><td "valign=""top""" \
1490 "width=""\\n[www-nav-width-right]%"">"
1494 .\" --------------------------------------------------------------------
1495 .\" LNE - left navigation end
1498 . HTML</p> </td></tr></table>
1506 .\" some auxiliary macros for left navigation lists
1509 . if (0\\$1 == 0) \{\
1510 . if (\\n[SH-open] == 1) \
1518 . if (0\\$1 <= 1) \{\
1519 . if (\\n[SH-open] == 1) \
1528 . if (\\n[needs-begin] == 1) \{\
1535 .\" --------------------------------------------------------------------
1536 .\" ALN [colour] [left width percentage]
1538 .\" Turn on automatic left navigation. This macro should only be
1539 .\" called once (normally at the start of the document) as it
1540 .\" indicates that all top-level section headings form a navigation
1541 .\" list on the left of the main text.
1544 . if '\*[.T]'html' \{\
1546 . ds www-nav-colour \\$1\"
1547 . if (0\\$2 > 0) \{\
1548 . nr www-nav-width-left \\$2
1549 . nr www-nav-width-right (100 - \\$2)
1560 .\" --------------------------------------------------------------------
1561 .\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
1563 .\" Initialize www.tmac so that when this macro set is used with
1564 .\" non-HTML devices the urls are rendered the user defined attributes.
1567 .\" LINKSTYLE blue CR < >
1570 . if (\\n[.$] < 1) \
1571 . www:error .\\$0 expects at least 1 argument.
1572 . ds www:color \\$1\"
1574 . if (\\n[.$] < 1) \
1576 . ds www:fontstyle \\$1\"
1578 . if (\\n[.$] < 1) \
1579 . www:error .\\$0 expects that both the open and close glyph is specified
1580 . ds www:open \\$1\"
1581 . ds www:close \\$2\"
1584 .\" MATHML - enable eqn mathml output to pass through to the device
1588 . if (\\n[.O] == 0) \
1592 .\" --------------------------------------------------------------------
1594 .\" --------------------------------------------------------------------
1596 .LINKSTYLE blue C \[la] \[ra]
1598 .if \n[www-html] \{\
1603 .if r ps4html .nop \O[0]
1608 .\" --------------------------------------------------------------------
1610 .\" --------------------------------------------------------------------
1612 .\" Local Variables: