* tmac/www.tmac (TS, TE, EQ, EN): Don't use .als for setting up
[s-roff.git] / tmac / www.tmac
blobffc3ac65f98d6e638d1af94df1a6027163ecc829
1 .ig
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 ------------------------------------------------------------------------
8     Legalize
9 ------------------------------------------------------------------------
11 This file is part of groff, the GNU roff type-setting system.
13 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008
14   Free Software Foundation, Inc.
15 written by Gaius Mulley <gaius@glam.ac.uk>, with additions by
16 Werner Lemberg <wl@gnu.org> and Bernd Warken <bwarken@mayn.de>.
18 groff is free software; you can redistribute it and/or modify it under
19 the terms of the GNU General Public License as published by the Free
20 Software Foundation; either version 2, or (at your option) any later
21 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
26 for more details.
28 You should have received a copy of the GNU General Public License
29 along with groff; see the file COPYING.  If not, write to the Free
30 Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA
31 02110-1301, USA.
34 ------------------------------------------------------------------------
35     Description
36 ------------------------------------------------------------------------
38 A simple set of macros to provide HTML (or XHTML) documents with basic
39 www functionality.  It should work with any macro set.  In the following,
40 HTML always denotes XHTML also.
44 .\" --------------------------------------------------------------------
45 .\" Setup
46 .\" --------------------------------------------------------------------
48 .do if d www:lenstr .nx
50 .do mso devtag.tmac
52 .nr _C \n(.C
53 .cp 0
56 .nr www-html 0
57 .if '\*[.T]'html' .nr www-html 1
59 .\" set up www-image-template
61 .if !d www-image-template \
62 .  ds www-image-template
64 .if r ps4html \{\
65 .  \" remove the title command when we are generating images for html
66 .  \" (stops a title accidentally appearing inside an image)
67 .  di www-notitle
68 .  tl ''''
69 .  di
70 .  rm tl
71 .  de tl
72 .  .
73 .\}
76 .\" --------------------------------------------------------------------
77 .\" Test for `.substring'; result in register `www.substring_ok'.
78 .\" The automated break points in .URL addresses are only added if
79 .\" this register is non-zero.
80 .\"
81 .nr www:substring_ok 0
82 .de www:@test_substring
83 .  if !d substring \
84 .    return
85 .  ds \\$0:s abcdefg\"
86 .  substring \\$0:s 1 1
87 .  if !'\\*[\\$0:s]'b' \{\
88 .    rm \\$0:s
89 .    return
90 .  \}
91 .  ds \\$0:s abcdefg\"
92 .  substring \\$0:s 0 0
93 .  if !'\\*[\\$0:s]'a' \{\
94 .    rm \\$0:s
95 .    return
96 .  \}
97 .  ds \\$0:s abcdefg\"
98 .  substring \\$0:s 1 -1
99 .  if !'\\*[\\$0:s]'bcdefg' \{\
100 .    rm \\$0:s
101 .    return
102 .  \}
103 .  nr www:substring_ok 1
104 .  rm \\$0:s
106 .www:@test_substring
107 .rm www:@test_substring
110 .\" --------------------------------------------------------------------
111 .\" Local Macros
112 .\" --------------------------------------------------------------------
114 .\" --------------------------------------------------------------------
115 .\" www:paraspace
117 .\" Space before paragraph. Use \n[PD] if it exists.
119 .nr www:pd 0.5v
120 .de www:paraspace
121 .  ie r PD .sp \\n[PD]u
122 .  el .sp \\n[www:pd]u
125 .\" --------------------------------------------------------------------
126 .\" www:error (<test>...)
128 .\" Print error message
130 .de www-error
131 .  tm \\n[.F]:\\n[.c]: macro error: \\$*
133 .als www:error www-error
135 .\" --------------------------------------------------------------------
136 .\" www:lenstr (<register_name> <string_name>)
138 .\" Store length of string named <string_name> into register named
139 .\" <register_name>.
141 .de www:lenstr
142 .  if !(\\n[.$] == 2) \{\
143 .    tm .\\$0 expects 2 arguments.
144 .    ab
145 .  \}
146 .  length \\$0:n x\\*[\\$2]
147 .  nr \\$1 (\\n[\\$0:n]-1)
148 .  rr \\$0:n
151 .\" --------------------------------------------------------------------
152 .\" www:splitstr (<name>)
154 .\" Add a space character between any two adjacent characters in string
155 .\" <name> and restore result into the string variable <name>; space
156 .\" characters are first replaced by the word `space'.
158 .de www:splitstr
159 .  if !(\\n[.$] == 1) \
160 .    www:error .\\$0 expects 1 argument.
161 .  if '\\*[\\$1]'' \
162 .    return
163 .  ds \\$0:r "\\*[\\$1]\""
164 .  ds \\$0:s\"
165 .  while 1 \{\
166 .    ds \\$0:c "\\*[\\$0:r]\""
167 .    substring \\$0:c 0 0\"
168 .    ie '\\*[\\$0:c]' ' \
169 .      as \\$0:s " space\""
170 .    el \
171 .      as \\$0:s " \\*[\\$0:c]\""
172 .    www:lenstr \\$0:n \\$0:r
173 .    if (\\n[\\$0:n] <= 1) \{\
174 .      break
175 .    \}
176 .    substring \\$0:r 1 -1\"
177 .  \}
178 .  if !'\\*[\\$0:s]'' \
179 .    substring \\$0:s 1 -1 
180 .  ds \\$1 \\*[\\$0:s]\"
181 .  rm \\$0:c
182 .  rr \\$0:n
183 .  rm \\$0:r
184 .  rm \\$0:s
187 .\" --------------------------------------------------------------------
188 .\" www:url_breaks (<string_name>)
190 .\" Add `\:' (possible break point) within URL strings after `/'.
192 .\" Smart about multiple `/', existing `\:', and space characters;
193 .\" does not set a break point if less than 5 characters would go to
194 .\" the next line.
196 .de www:url_breaks
197 .  if !(\\n[.$] == 1) \
198 .    www:error .\\$0 expects 1 argument.
199 .  if !\n[www:substring_ok] \
200 .    return
201 .  ds \\$0:s "\\*[\\$1]\""
202 .  www:splitstr \\$0:s
203 .  www:url_breaks_splitted \\$0:s \\*[\\$0:s]
204 .  ds \\$1 "\\*[\\$0:s]\""
205 .  rm \\$0:s
208 .\" --------------------------------------------------------------------
209 .\" www:url_breaks_splitted (<result> <char> [<char>...])
211 .\" Add `\:' within URL strings, but arguments are a splitted string.
213 .\" Arguments: >=2: <result> <char> [<char>...]
215 .de www:url_breaks_splitted
216 .  nr \\$0:min 5             \" minimal number of characters for next line
217 .  if (\\n[.$] < 2) \
218 .    www:error .\\$0 expects at least 2 arguments.
219 .  ds \\$0:res \\$1\"
220 .  shift
221 .  ds \\$0:s\"
222 .  nr \\$0:done 0
223 .  while !\\n[\\$0:done] \{\
224 .    if (\\n[.$] <= 0) \{\
225 .      nr \\$0:done 1
226 .      break
227 .    \}
228 .    if '\\$1'space' \{\
229 .      as \\$0:s " \""
230 .      shift
231 .      continue
232 .    \}
233 .    if (\\n[.$] < \\n[\\$0:min]) \{\
234 .      as \\$0:s "\\$1\""
235 .      shift
236 .      continue
237 .    \}
238 .    if !'\\$1'/' \{\
239 .      as \\$0:s "\\$1\""
240 .      shift
241 .      continue
242 .    \}
243 .    \" we are at a `/' character
244 .    while '\\$1'/' \{\
245 .      as \\$0:s /\"
246 .      if (\\n[.$] == 0) \{\
247 .        nr \\$0:done 1
248 .        break
249 .      \}
250 .      shift
251 .    \}
252 .    if \\n[\\$0:done] \
253 .      break
254 .    if (\\n[.$] < \\n[\\$0:min]) \
255 .      continue
256 .    if '\\$1'\:' \
257 .      shift
258 .    as \\$0:s \:\"
259 .  \}
260 .  ds \\*[\\$0:res] \\*[\\$0:s]\"
261 .  rm \\$0:res
262 .  rm \\$0:s
266 .\" --------------------------------------------------------------------
267 .\" User Interface
268 .\" --------------------------------------------------------------------
270 .\" --------------------------------------------------------------------
271 .\" HTML
273 .\" the main auxiliary macro for the HTML interface
275 .de HTML
276 .  if \\n[www-html] \{\
277 .    \" was implemented via .nop \&\X^html:\\$*^ but
278 .    \" is now implemented using HTML-NS to utilize code factoring.
279 .    \"
280 .    \" the `\&' makes the vertical mode leave, so to say
281 .    \"
282 .    nop \&\c
283 .    HTML-NS \\$*
284 .    nop \&
285 .  \}
289 .\" an auxiliary macro for HTML (without following space)
291 .de HTML-NS
292 .  nop \X^html:\\$*^\c
296 .\" emit a HTML tag after shutting down a (possibly open) paragraph
298 .de HTML</p>
299 .  if \\n[www-html] \{\
300 .    \" the `\&' makes the vertical mode leave, so to say
301 .    nop \&\X^html</p>:\\$*^
302 .  \}
306 .\" emit an HTML tag.  If text has been written in the paragraph
307 .\"                    then do not shut the paragraph down.
308 .\"                    If text was not written, remove the empty
309 .\"                    paragraph tag and emit the desired html tag.
311 .de HTML<?p>
312 .  if \\n[www-html] .nop \&\X^html<?p>:\\$*^
316 .\" emit a MATH tag.  If text has been written in the paragraph
317 .\"                   then do not shut the paragraph down.
318 .\"                   If text was not written, remove the empty
319 .\"                   paragraph tag and emit the desired math tag.
321 .de MATH<?p>
322 .  if \\n[www-html] .nop \&\X^math<?p>:\\$*^
325 .\" --------------------------------------------------------------------
326 .\" HX n
328 .\"   Automatic heading level cut off.
330 .\"   N is the depth limit of automatically linked headings.  So a depth
331 .\"   of 2 would cause grohtml to generate a list of links for `.NH 1'
332 .\"   and `.NH 2' but not for `.NH 3'.
334 .de HX
335 .  if \\n[www-html] \
336 .    nop \X^index:\\$*^
339 .\" --------------------------------------------------------------------
340 .\" BCL foreground background active not-visited visited
342 .de BCL
343 .  HTML <body text=\\$1 \
344               bgcolor=\\$2 \
345               link=\\$3 \
346               alink=\\$4 \
347               vlink=\\$5>
350 .\" --------------------------------------------------------------------
351 .\" BGIMG imagefile
353 .de BGIMG
354 .  HTML <body background=\\$1>
357 .\" www:url_check_tag str
358 .\"    If url named by \*[str] is internal (starts with #), 
359 .\"    redefine \*[str] to be the value of the string TAG_url.
361 .de www:url_check_tag
362 .  ds \\$0:tmp \\*[\\$1]\"
363 .  substring \\$0:tmp 0 0
364 .  if '\\*[\\$0:tmp]'#' \{\
365 .    ds \\$0:tmp \\*[\\$1]\"
366 .    substring \\$0:tmp 1
367 .    ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
368 .    ie !'\\*[\\*[\\$0:tmp]]'' \
369 .      ds \\$1 \\*[\\*[\\$0:tmp]]\"
370 .    el \
371 .      ds \\$1 see below\"
372 .  \} 
373 .  rm \\$0:tmp
376 .\" --------------------------------------------------------------------
377 .\" URL url [description] [after]
378 .\"     if description is absent then the url becomes the anchor text
380 .de URL
381 .  if !'\\$1'' \{\
382 .    ds \\$0:adr \\$1\"
383 .    www:url_check_tag \\$0:adr
384 .    if !\\n[www-html] .www:url_breaks \\$0:adr
385 .  \}
386 .  ie \\n[www-html] \{\
387 .    ie '\\$3'' \
388 .      ds \\$0:after \&\"
389 .    el \
390 .      ds \\$0:after \&\\$3\"
391 .    ie '\\$2'' \
392 .       HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
393 .    el \
394 .       HTML-NS <a "href=""\\$1"">\\$2</a>"
395 .    nop \\*[\\$0:after]
396 .    rm \\$0:after
397 .  \}
398 .  el \{\
399 .    if !r ps4html .ad l
400 .    ie '\\$2'' \{\
401 .      ie '\\$1'' \{\
402 .        ie !'\\$3'' \
403 .          nop \\$3
404 .      \}
405 .      el \{\
406 .        ie \\n[.color] \
407 .          nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
408 .        el \
409 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
410 .      \}
411 .    \}
412 .    el \{\
413 .      ie '\\$1'' \{\
414 .        ie \\n[.color] \
415 .          nop \m[\\*[www:color]]\\$2\m[]\\$3
416 .        el \
417 .          nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
418 .      \}
419 .      el \{\
420 .        ie \\n[.color] \{\
421 .          nop \m[\\*[www:color]]\\$2\m[]
422 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
423 .        \}
424 .        el \{\
425 .          nop \f[\\*[www:fontstyle]]\\$2\f[]
426 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
427 .        \}
428 .      \}
429 .    \}
430 .    if !r ps4html .ad
431 .  \}
432 .  rm \\$0:adr
435 .\" --------------------------------------------------------------------
436 .\" FTP url description [after]
438 .\"   Same as URL.
440 .als FTP URL
442 .\" --------------------------------------------------------------------
443 .\" MTO address description [after]
445 .\"   ADDRESS is the email address (without the `mailto:' prefix).
447 .\"   DESCRIPTION is the optional name.  If an empty argument is given,
448 .\"   ADDRESS is used instead.
450 .\"   AFTER is optional stuff printed immediately after ADDRESS
451 .\"   (resp. DESCRIPTION).
453 .\"     Example:
455 .\"       Foobar has been written by
456 .\"       .MTO fred@foo.bar "Fredrick Bloggs" .
458 .de MTO
459 .  ie \\n[www-html] \{\
460 .    ie '\\$2'' \
461 .      URL mailto:\\$1 \\$1 "\\$3"
462 .    el \
463 .      URL mailto:\\$1 "\\$2" "\\$3"
464 .  \}
465 .  el \{\
466 .    ie '\\$2'' \{\
467 .      ie '\\$1'' \{\
468 .        ie !'\\$3'' \
469 .          nop \\$3
470 .      \}
471 .      el \{\
472 .        ie \\n[.color] \
473 .          nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
474 .        el \
475 .          nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
476 .      \}
477 .    \}
478 .    el \{\
479 .      ie '\\$1'' \{\
480 .        ie \\n[.color] \
481 .          nop \m[\\*[www:color]]\\$2\m[]\\$3
482 .        el \
483 .          nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
484 .      \}
485 .      el \{\
486 .        ie \\n[.color] \{\
487 .          nop \m[\\*[www:color]]\\$2\m[]
488 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
489 .        \}
490 .        el \{\
491 .          nop \f[\\*[www:fontstyle]]\\$2\f[]
492 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
493 .        \}
494 .      \}
495 .    \}
496 .  \}
499 .\" --------------------------------------------------------------------
500 .\" TAG name [text]
502 .\"   Generate an html name NAME.
503 .\"   Define string TAG_NAME to TEXT, if present,
504 .\"      otherwise to \n[PN].
507 .de TAG
508 .  HTML <a "name=""\\$1""></a>"
509 .  ie '\\$2'' \
510 .    ds TAG_\\$1 \\n[PN]
511 .  el \
512 .    ds TAG_\\$1 \\$2\"
515 .\" --------------------------------------------------------------------
516 .\" IMG [-R|-L|-C] filename [width] [height]
518 .\"   Include an image of any type (only works for -Thtml).
520 .\"   Alignment is centered by default (-C).
521 .\"   Default value for WIDTH is 1i.
522 .\"   If HEIGHT is not given, WIDTH is used as the height.
524 .de IMG
525 .  ie \\n[www-html] \{\
526 .    ie '\\$2'-R' \
527 .      DEVTAG .right-image
528 .    el \{\
529 .      ie '\\$2'-L' \
530 .        DEVTAG .left-image
531 .      el \
532 .        DEVTAG .centered-image
533 .    \}
534 .    nr www-width 100
535 .    if !'\\$3'' \
536 .      nr www-width \\$3
537 .    nr www-height \\n[www-width]
538 .    if !'\\$4'' \
539 .      nr www-height \\$4
540 .    HTML <img src="\\$1" alt="Image \\$1" \
541            "width=""\\n[www-width]""" \
542            "height=""\\n[www-height]"""></img>
543 .  \}
544 .  el \
545 .    nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
548 .\" --------------------------------------------------------------------
549 .\" PIMG  [-R|-L|-C] filename [width] [height]
551 .\"   Include a png image.  It works for -Tps and -Thtml.
552 .\"   The default value for WIDTH and HEIGHT is zero; the default
553 .\"   alignment is centering (-C).
555 .\" Note: This macro can only be used with the `-U' option of groff,
556 .\"       activating unsafe mode, if not used with -Thtml; the PNG image
557 .\"       is then converted to the EPS format using netpbm utilities.
559 .de PIMG
560 .  ds www-pic-align -C\"
561 .  ie '\\$1'-R' \{\
562 .    ds www-pic-align -R\"
563 .    shift
564 .  \}
565 .  el \{\
566 .    if '\\$1'-L' \{\
567 .      ds www-pic-align -L\"
568 .      shift
569 .    \}
570 .  \}
571 .  if '\\$1'-C' \
572 .    shift
574 .  ie \\n[www-html] \{\
575 .    ds www-htmlalign align=center\"
576 .    if '\\*[www-pic-align]'-R' \
577 .      ds www-htmlalign align=right\"
578 .    if '\\*[www-pic-align]'-L' \
579 .      ds www-htmlalign align=left\"
580 .    nr www-width 0
581 .    nr www-height 0
582 .    if !'\\$2'' \
583 .      nr www-width (\\$3 * 100 / 240)
584 .    if !'\\$3'' \
585 .      nr www-height (\\$4 * 100 / 240)
586 .    ie (\\n[www-width] == 0) \{\
587 .      ie (\\n[www-height] == 0) \
588 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
589                                              "alt=""Image \\$1"""></img></p>"
590 .      el \
591 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
592                                              "alt=""Image \\$1""" \
593                                              "height=""\\n[www-height]"""></img></p>
594 .    \}
595 .    el \{\
596 .      ie (\\n[www-height] == 0) \
597 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
598                                              "alt=""Image \\$1""" \
599                                              "width=""\\n[www-width]"""></img></p>
600 .      el \
601 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
602                                              "alt=""Image \\$1""" \
603                                              "width=""\\n[www-width]""" \
604                                              "height=""\\n[www-height]"""></img></p>
605 .    \}
606 .  \}
607 .  el \{\
608 .    if !r ps4html \{\
609 .      www-make-unique-name
610 .      sy pngtopnm \\$1 \
611           | pnmcrop -white \
612           | @PNMTOPS_NOSETPAGE@ -noturn \
613           > \\*[www-unique-name].eps
614 .      shift
615 .      PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
616 .    \}
617 .  \}
620 .\" --------------------------------------------------------------------
621 .\" auxiliary definitions for MPIMG
623 .nr www-left-ll-trap 0
624 .nr www-left-po-trap 0
625 .nr www-right-ll-trap 0
627 .de www-finish-left-po
628 .  po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
629 .  wh \\n[www-left-po-trap]u
630 .  nr www-left-indent 0
633 .\" called when the -R picture is finished
634 .de www-finish-right-ll
635 .  ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
636 .  \" now see whether we need to inline www-finish-left-ll
637 .  if (\\n[www-left-ll-trap]u > 0) \
638 .    if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
639 .      mk www-left-po-trap
640 .      nr www-left-po-trap +1v
641 .      wh \\n[www-left-po-trap]u www-finish-left-po
642 .      ll +\\n[www-left-indent]u
643 .      wh \\n[www-left-ll-trap]u
644 .      nr www-left-ll-trap 0
645 .    \}
646 .  \" and see whether we need to inline www-finish-left-po
647 .  if (\\n[www-left-po-trap]u > 0) \
648 .    if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
649 .      po -\\n[www-left-indent]u
650 .      wh \\n[www-left-po-trap]u
651 .      nr www-left-indent 0
652 .    \}
653 .  wh \\n[www-right-ll-trap]u
654 .  nr www-right-ll-trap 0
657 .de www-finish-left-ll
658 .  if (\\n[www-right-ll-trap] > 0) \
659 .    if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
660 .      ll +\\n[www-right-indent]u
661 .      nr www-right-ll-trap 0
662 .    \}
663 .  mk www-left-po-trap
664 .  nr www-left-po-trap +1v
665 .  wh \\n[www-left-po-trap]u www-finish-left-po
666 .  ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
667 .  wh \\n[www-left-ll-trap]u
668 .  nr www-left-ll-trap 0
671 .\" www-handle-percent arg N1 N2 S1
672 .\"                    arg - input string (number or number%)
673 .\"                    output parameters:
674 .\"                    N1 - name of number register 1=absolute 0=percentage
675 .\"                    N2 - number register name for absolute value
676 .\"                    S1 - string register name for percentage value
678 .de www-handle-percent 
679 .  ds www-percent \\$1\"
680 .  substring www-percent -1 -1
682 .  ie '\\*[www-percent]'%' \{\
683 .    ds www-abs \\$1\"
684 .    substring www-abs 0 -2
685 .    nr \\$2 0
686 .    nr \\$3 \\*[www-abs]
687 .    ds \\$4 \\$1\"
688 .  \}
689 .  el \{\
690 .    nr \\$2 1
691 .    nr \\$3 \\$1
692 .    ds \\$4 none\"
693 .  \}
696 .\" --------------------------------------------------------------------
697 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
699 .\"   Include a png image and wrap text around it.  It works for
700 .\"   -Tps and -Thtml.  The default value for WIDTH is 1i; default value
701 .\"   for HEIGHT is WIDTH; the default alignment is left (-L).
702 .\"   -G is used to insert a gap between the text and the image.
703 .\"   The height and width can also be given as a percentage.
704 .\"   The PostScript device converts the percentage width into an
705 .\"   absolute value by using \\n[.l], and the height by using \\n[.p].
706 .\"   
708 .\" Note: This macro can only be used with the `-U' option of groff,
709 .\"       activating unsafe mode, if not used with -Thtml; the PNG image
710 .\"       is then converted to the EPS format using netpbm utilities.
712 .nr www-htmlimage-gap 0
714 .de MPIMG
715 .  nr www-image-just 1
716 .  nr www-image-gap 0
717 .  while (\\n[.$] > 0) \{\
718 .    if '-L'\\$1' \{\
719 .      nr www-image-just 1
720 .      shift
721 .      continue
722 .    \}
723 .    if '-R'\\$1' \{\
724 .      nr www-image-just 0
725 .      shift
726 .      continue
727 .    \}
728 .    if '-G'\\$1' \{\
729 .      nr www-image-gap \\$2
730 .      nr www-htmlimage-gap (\\$2 * 100 / 240)
731 .      shift 2
732 .      continue
733 .    \}
734 .    break
735 .  \}
737 .  nr www-width 1i
738 .  nr www-height 1i
739 .  ds www-size-specs width=""\\n[www-width]" height="\\n[www-height]"
740 .  ie !'\\$2'' \{\
741 .    nr www-is-absolute 0
742 .    nr www-absolute 0
743 .    ds www-percentage none\"
744 .    www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
745 .    ie !\\n[www-is-absolute] \{\
746 .      \" percentage of linelength requested
747 .      nr www-width (\\n[www-absolute] * \\n[.l] / 100)
748 .      if \\n[www-html] \
749 .        nr www-width (\\n[www-width] * 100 / 240)
750 .      ds www-size-specs width=\"\\*[www-percentage]"
751 .    \}
752 .    el \{\
753 .      nr www-width \\n[www-absolute]
754 .      if \\n[www-html] \
755 .        nr www-width (\\n[www-width] * 100 / 240)
756 .      ds www-size-specs width=\"\\n[www-width]"
757 .    \}
759 .    nr www-height \\n[www-width]
760 .    ie !'\\$3'' \{\
761 .      nr www-is-absolute 0
762 .      nr www-absolute 0
763 .      ds www-percentage none\"
764 .      www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
765 .      ie !\\n[www-is-absolute] \{\
766 .        \" percentage of pagelength requested
767 .        nr www-height (\\n[www-absolute] * \\n[.p] / 100)
768 .        if \\n[www-html] \
769 .           nr www-height (\\n[www-height] * 100 / 240)
770 .        ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"
771 .      \}
772 .      el \{\
773 .        nr www-height \\n[www-absolute]
774 .        if \\n[www-html] \
775 .           nr www-height (\\n[www-height] * 100 / 240)
776 .        ds www-size-specs "\\*[www-size-specs] "height="\\*[www-height]"
777 .      \}
778 .    \}
779 .  \}
780 .  el \{\
781 .    \" height not specified; use width value
782 .    ie !\\n[www-is-absolute] \{\
783 .       \" percentage value
784 .       ds www-size-specs "\\*[www-size-specs] "height="\\*[www-percentage]"
785 .       nr www-height \\n[www-width]
786 .    \}
787 .    el \{\
788 .       ds www-size-specs "\\*[www-size-specs] "height="\\*[www-width]"
789 .       nr www-height \\n[www-width]
790 .    \}
791 .  \}
793 .  ie \\n[www-html] \{\
794 .    ie !\\n[www-image-just] \
795 .      HTML <img "src=""\\$1""" \
796                  "alt=""Image \\$1""" \
797                  "hspace=""\\n[www-htmlimage-gap]""" \
798                  "align=""right"" \\*[www-size-specs]"""></img>
799 .    el \
800 .      HTML <img "src=""\\$1""" \
801                  "alt=""Image \\$1""" \
802                  "hspace=""\\n[www-htmlimage-gap]""" \
803                  "align=""left"" \\*[www-size-specs]"""></img>
804 .  \}
805 .  el \{\
806 .    tm www-width is \\n[www-width]
807 .    tm www-height is \\n[www-height]
808 .    if !r ps4html \{\
809 .      www-make-unique-name
810 .      sy pngtopnm \\$1 \
811           | pnmcrop -white \
812           | @PNMTOPS_NOSETPAGE@ -noturn \
813           > \\*[www-unique-name].eps
814 .      ie !\\n[www-image-just] \{\
815 .        \" we must now disable a possible left image trap
816 .        sp -1
817 .        if (\\n[www-left-ll-trap] > 0) \
818 .          wh \\n[www-left-ll-trap]u
819 .        if (\\n[www-left-po-trap] > 0) \
820 .          wh \\n[www-left-po-trap]u
821 .        PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
822 .        sp -\\n[ps-desht]u
823 .        nr www-right-indent \\n[ps-deswid]u
824 .        \" we want to have some space between text and image,
825 .        \" so the line length must be shorter
826 .        ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
827 .        mk www-right-ll-trap
828 .        nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
829 .        wh \\n[www-right-ll-trap]u www-finish-right-ll
830 .        \" now restore possible left trap
831 .        if (\\n[www-left-ll-trap] > 0) \
832 .          wh \\n[www-left-ll-trap]u www-finish-left-ll
833 .        if (\\n[www-left-po-trap] > 0) \
834 .          wh \\n[www-left-po-trap]u
835 .      \}
836 .      el \{\
837 .        \" we must now disable a possible right image trap
838 .        if (\\n[www-right-ll-trap] > 0) \
839 .          wh \\n[www-right-ll-trap]u
840 .        PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
841 .        sp -\\n[ps-desht]u
842 .        nr www-left-indent \\n[ps-deswid]u
843 .        \" increase offset by gap
844 .        po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
845 .        \" decrease line length by gap
846 .        ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
847 .        mk www-left-ll-trap
848 .        nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
849 .        wh \\n[www-left-ll-trap]u www-finish-left-ll
850 .        \" now restore possible right trap
851 .        if (\\n[www-right-ll-trap] > 0) \
852 .          wh \\n[www-right-ll-trap]u www-finish-right-ll
853 .      \}
854 .    \}
855 .  \}
858 .\" --------------------------------------------------------------------
859 .\" HnS n
861 .\"   Begin heading.  Heading level is N.
863 .\" HnE
865 .\"   End heading.
867 .\" If your heading contains URL, FTP, MTO macros you might wish to
868 .\" disable automatic links to headings.  This can be done via `-P-l'
869 .\" from the command line or by using a cakk to `.HX 0'.
871 .nr www-heading-no -1
873 .de HnS
874 .  ie '\\$1'' \
875 .    nr www-heading-no 1
876 .  el \
877 .    nr www-heading-no \\$1
878 .  DEVTAG-NH \\n[www-heading-no]
881 .de HnE
882 .  if (\\n[www-heading-no] == -1) \
883 .    www-error HnE found without a corresponding HnS
884 .  DEVTAG-EO-H
887 .\" --------------------------------------------------------------------
888 .\" LK
890 .\"   Emit the automatically collected links derived from
891 .\"   section/numbered headings at this position.
893 .de LK
894 .  DEVTAG .links
897 .\" --------------------------------------------------------------------
898 .\" HR
900 .\"   Produce a horizontal line.
902 .de HR
903 .  HTML</p> <hr></hr>
906 .\" --------------------------------------------------------------------
907 .\" NHR
909 .\"  Suppresses the generation of the top and bottom rules which grohtml
910 .\"  emits by default.
912 .de NHR
913 .  DEVTAG .no-auto-rule
917 .\" www-end-nowhere - end of input trap called to finish diversion.
919 .de www-end-nowhere
920 .  if !\\n[www-html] \
921 .    di
922 .  DEVTAG-EO-TL
925 .\" --------------------------------------------------------------------
926 .\" HTL
928 .\"   Generate an HTML title only.  This differs from the -ms .TL macro
929 .\"   which generates both an HTML title and an H1 heading.
931 .\"   This is useful when an author wishes to use a HTML title as search
932 .\"   engine fodder but a graphic title in the document.
934 .\"   The macro terminates when a space or break is seen (.sp, .br).
936 .de HTL
937 .  DEVTAG .html-tl
938 .  if !\\n[www-html] \
939 .    di www-nowhere
940 .  it 2 www-end-nowhere
943 .\" --------------------------------------------------------------------
944 .\" auxiliary definitions for lists
946 .ds www-ul-level1 \[bu]\ \ \"
947 .ds www-ul-level2 \[sq]\ \ \"
948 .ds www-ul-level3 \[ci]\ \ \"
949 .nr www-ul-level 0
951 .ds www-ol-level1 decimal\"
952 .ds www-ol-level2 lower-alpha\"
953 .ds www-ol-level3 lower-roman\"
954 .ds www-ol-tmp 00\ \ \"
955 .nr www-ol-ctr1 0 1
956 .nr www-ol-ctr2 0 1
957 .nr www-ol-ctr3 0 1
958 .af www-ol-ctr2 a
959 .af www-ol-ctr3 i
960 .nr www-ol-level 0
962 .nr www-dl-level 0
963 .nr www-dl-shift 5n
966 .\" allow nested lists
968 .nr www-depth 0
969 .nr www-li-indent \n[.i]
970 .ds www-level0 nop\"
971 .ds www-level1
972 .ds www-level2
973 .ds www-level3
974 .ds www-level4
975 .ds www-level5
976 .ds www-level6
977 .ds www-level7
978 .ds www-level8
979 .ds www-level9
981 .\" which macro to use for LI
982 .de www-push-li
983 .  nr www-depth +1
984 .  ds www-level\\n[www-depth] \\$1\"
985 .  ds www-ltag\\n[www-depth]
986 .  als LI \\$1
989 .de www-pop-li
990 .  nr www-depth -1
991 .  als LI \\*[www-level\\n[www-depth]]
994 .\" www-emit-ltag - shuts down a previous open list tag
995 .\"                 before issuing a new tag \\$1.
996 .\"                 It then records tag \\$1 is open.
998 .de www-emit-ltag
999 .  if !'\\*[www-ltag\\n[www-depth]]'' \
1000 .    HTML-NS </\\*[www-ltag\\n[www-depth]]>
1001 .  if !'\\$1'' \
1002 .    HTML-NS <\\$1>
1003 .  ds www-ltag\\n[www-depth] \\$1
1007 .\" Auxiliary macro for ULS.
1009 .de www-push-ul-level
1010 .  nr www-ul-level +1
1011 .  if (\\n[www-ul-level] > 3) \
1012 .    www-error ULS: too many levels of indentation (\\n[www-ul-level])
1015 .\" Auxiliary macro for ULE.
1017 .de www-pop-ul-level
1018 .  if !\\n[www-ul-level] \
1019 .    www-error ULE: trying to terminate a list which does not exist
1020 .  nr www-ul-level -1
1024 .\" Auxiliary macro for OLS.
1026 .de www-push-ol-level
1027 .  nr www-ol-level +1
1028 .  if (\\n[www-ol-level] > 3) \
1029 .    www-error OLS: too many levels of indentation (\\n[www-ol-level])
1033 .\" Auxiliary macro for OLE.
1035 .de www-pop-ol-level
1036 .  if !\\n[www-ol-level] \
1037 .    www-error OLE: trying to terminate a list which does not exist
1038 .  nr www-ol-level -1
1041 .\" --------------------------------------------------------------------
1042 .\" ULS
1044 .\"   Start an unordered list.
1046 .de ULS
1047 .  www-push-li www-li-ul
1048 .  www-push-ul-level
1049 .  ie \\n[www-html] \{\
1050 .    www-emit-ltag
1051 .    HTML</p> <ul>
1052 .  \}
1053 .  el \
1054 .    nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1057 .\" --------------------------------------------------------------------
1058 .\" ULE
1060 .\"   End an unordered list.
1062 .de ULE
1063 .  ie \\n[www-html] \{\
1064 .    www-emit-ltag
1065 .    HTML</p> </ul>
1066 .  \}
1067 .  el \{\
1068 .    nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1069 .    in \\n[www-li-indent]u
1070 .  \}
1071 .  www-pop-ul-level
1072 .  www-pop-li
1075 .\" --------------------------------------------------------------------
1076 .\" OLS
1078 .\"   Start an ordered list.
1080 .de OLS
1081 .  www-push-li www-li-ol
1082 .  www-push-ol-level
1083 .  ie \\n[www-html] \{\
1084 .    www-emit-ltag
1085 .    HTML</p> <ol "style=""list-style-type:" \
1086                            "\\*[www-ol-level\\n[www-ol-level]]"">"
1087 .  \}
1088 .  el \
1089 .    nr www-li-indent +\w'\\*[www-ol-tmp]'u
1092 .\" --------------------------------------------------------------------
1093 .\" OLE
1095 .\"   End an ordered list.
1097 .de OLE
1098 .  ie \\n[www-html] \{\
1099 .    www-emit-ltag
1100 .    HTML </ol>
1101 .  \}
1102 .  el \{\
1103 .    nr www-li-indent -\w'\\*[www-ol-tmp]'u
1104 .    in \\n[www-li-indent]u
1105 .    nr www-ol-ctr\\n[www-ol-level] 0 1
1106 .  \}
1107 .  www-pop-ol-level
1108 .  www-pop-li
1111 .\" --------------------------------------------------------------------
1113 .\" DLS
1114 .\"   Start a definition list.
1116 .de DLS
1117 .  www-push-li www-li-dl
1118 .  nr www-dl-level +1
1119 .  ie \\n[www-html] \{\
1120 .    www-emit-ltag
1121 .    HTML</p> <dl>
1122 .  \}
1123 .  el \{\
1124 .    nr www-li-indent +\\n[www-dl-shift]u
1125 .    in \\n[www-li-indent]u
1126 .  \}
1129 .\" --------------------------------------------------------------------
1131 .\" DLE
1132 .\"   End a definition list.
1134 .de DLE
1135 .  ie \\n[www-html] \{\
1136 .    www-emit-ltag
1137 .    HTML </dl>
1138 .  \}
1139 .  el \{\
1140 .    nr www-li-indent -\\n[www-dl-shift]u
1141 .    in \\n[www-li-indent]u
1142 .  \}
1143 .  nr www-dl-level -1
1144 .  www-pop-li
1147 .\" --------------------------------------------------------------------
1148 .\" LI
1150 .\"   Insert a list item.
1152 .\" ********
1153 .\" www-li-ul - bulleted list item
1155 .de www-li-ul
1156 .  ie \\n[www-html] \
1157 .    www-emit-ltag li
1158 .  el \{\
1159 .    www:paraspace
1160 .    in \\n[www-li-indent]u
1161 .    ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1162 .    nop \\*[www-ul-level\\n[www-ul-level]]\c
1163 .  \}
1166 .\" ********
1167 .\" www-li-ol - numbered list item
1169 .de www-li-ol
1170 .  ie \\n[www-html] \
1171 .    www-emit-ltag li
1172 .  el \{\
1173 .    www:paraspace
1174 .    in \\n[www-li-indent]u
1175 .    ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1176 .    nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
1177 .  \}
1180 .\" ********
1181 .\" www-li-dl - definition list item
1183 .de www-li-dl
1184 .  ie \\n[www-html] \{\
1185 .    HTML <dt>\\$1</dt>
1186 .    www-emit-ltag dd
1187 .  \}
1188 .  el \{\
1189 .    www:paraspace
1190 .    in \\n[www-li-indent]u
1191 .    ti -\\n[www-dl-shift]u
1192 .    nop \&\\$1
1193 .    br
1194 .  \}
1197 .\" --------------------------------------------------------------------
1198 .\" DC l text [color]
1200 .\"   L is the letter to be dropped and enlarged.
1202 .\"   TEXT is the following text whose height the first letter should not
1203 .\"   exceed.
1205 .\"   COLOR is the optional color of the dropped letter (default black).
1207 .de DC
1208 .  ds www-dropcolor black\"
1209 .  if !'\\$3'' \
1210 .    ds www-dropcolor \\$3\"
1211 .  ie '\*[.T]'html' \{\
1212 .    www-make-unique-name
1213 .    nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1214 .    MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1215 .  \}
1216 .  el \{\
1217 .    ie r ps4html \{\
1218 .      www-make-unique-name
1219 .      \" To avoid interferences with another DC macro call which is located
1220 .      \" very near to the current one, we draw the glyph on a separate page.
1221 .      \" Otherwise it could theoretically happen that the dropped capital
1222 .      \" glyphs overlap.
1223 .      bp
1224 .      ev www-DC
1225 .      vs 320p
1226 .      nop \O[5i\\*[www-unique-name].png]\O[1]
1227 .      nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1228 .      nop \O[2]\O[0]
1229 .      br
1230 .      ev
1231 .      bp
1232 .    \}
1233 .    el \{\
1234 .      ie n \
1235 .        nop \\$1\c
1236 .      el \{\
1237 .        nr dummy \w'\\$1'u
1238 .        nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1239 .        char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1240 .        nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1241 '        ti \w'\\[dcap]'u
1242 .      \}
1243 .    \}
1244 .  \}
1245 .  nop \\$2
1249 .\" supplementary macros used by other macro sets
1251 .\" here are some tags specially for -Tps or -Thtml when invoked by
1252 .\" pre-html to generate png images from postscript.
1254 .\" --------------------------------------------------------------------
1255 .\" HTML-DO-IMAGE - tells troff to issue an image marker which can be
1256 .\"                 read back by pre-html
1258 .de HTML-DO-IMAGE
1259 .  if r ps4html \
1260 .    nop \O[5\\$2\\$1.png]\O[1]\O[3]
1261 .  if \\n[www-html] \
1262 .    nop \O[5\\$2\\$1.png]\O[0]\O[3]
1265 .\" --------------------------------------------------------------------
1266 .\" HTML-IMAGE-END - terminates an image for html
1268 .de HTML-IMAGE-END
1269 .  if r ps4html \
1270 .    nop \O[4]\O[2]\O[0]
1271 .  if \\n[www-html] \
1272 .    nop \O[4]\O[2]\O[1]
1275 .nr www-png-no 0
1277 .\" --------------------------------------------------------------------
1278 .\" www-make-unique-name - generates another unique name in string
1279 .\"                        `www-unique-name'
1281 .de www-make-unique-name
1282 .  nr www-png-no +1
1283 .  ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1286 .\" --------------------------------------------------------------------
1287 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1288 .\"            to be rendered as an image.
1290 .de HTML-IMAGE
1291 .  \" generates a centered image
1292 .  www-make-unique-name
1293 .  HTML-DO-IMAGE \\*[www-unique-name] c
1296 .de HTML-IMAGE-RIGHT
1297 .  www-make-unique-name
1298 .  HTML-DO-IMAGE \\*[www-unique-name] r
1301 .de HTML-IMAGE-LEFT
1302 .  www-make-unique-name
1303 .  HTML-DO-IMAGE \\*[www-unique-name] l
1306 .de HTML-IMAGE-INLINE
1307 .  www-make-unique-name
1308 .  HTML-DO-IMAGE \\*[www-unique-name] i
1311 .\"  EQN-HTML-IMAGE and friends check to see whether the equation is
1312 .\"                 not in an image, in which case it allows html
1313 .\"                 (mathml) to be generated (if -Txhtml was specified).
1315 .de EQN-HTML-IMAGE
1316 .  \" generates a centered image
1317 .  www-make-unique-name
1318 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1321 .de EQN-HTML-IMAGE-RIGHT
1322 .  www-make-unique-name
1323 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1326 .de EQN-HTML-IMAGE-LEFT
1327 .  www-make-unique-name
1328 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1331 .de EQN-HTML-IMAGE-INLINE
1332 .  www-make-unique-name
1333 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1336 .\" --------------------------------------------------------------------
1337 .\" EQN-HTML-DO-IMAGE - tells troff to issue an image marker which can be
1338 .\"                     read back by pre-html
1340 .de EQN-HTML-DO-IMAGE
1341 .  ie r xhtml \{\
1342 .    if !(\\n[.O] == 0) \{\
1343 .      if r ps4html \
1344 .        nop \O[5\\$2\\$1.png]\O[1]\O[3]
1345 .      if \\n[www-html] \
1346 .        nop \O[5\\$2\\$1.png]\O[0]\O[3]
1347 .    \}
1348 .  \}
1349 .  el .HTML-DO-IMAGE \\$*
1352 .\" --------------------------------------------------------------------
1353 .\" EQN-HTML-IMAGE-END - terminates an image for html
1355 .de EQN-HTML-IMAGE-END
1356 .  ie r xhtml \{\
1357 .    if !(\\n[.O] == 0) \{\
1358 .      if r ps4html \
1359 .        nop \O[4]\O[2]\O[0]
1360 .      if \\n[www-html] \
1361 .        nop \O[4]\O[2]\O[1]
1362 .    \}
1363 .  \}
1364 .  el .HTML-IMAGE-END
1367 .\" --------------------------------------------------------------------
1368 .\" Setup around HTML-IMAGE and friends
1370 .\" now set up TS, TE, EQ, EN default macros
1372 .\" we must not use `.als': the definition of .TE in s.tmac, for example,
1373 .\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1374 .\" causing an endless loop
1376 .if !d TS \{\
1377 .  de TS
1378 .    nop \\*[HTML-IMAGE]\\
1379 .  .
1381 .if !d TE \{\
1382 .  de TE
1383 .    nop \\*[HTML-IMAGE-END]\\
1384 .  .
1386 .if !d EQ \{\
1387 .  de EQ
1388 .    nop \\*[EQN-HTML-IMAGE]\\
1389 .  .
1391 .if !d EN \{\
1392 .  de EN
1393 .    nop \\*[EQN-HTML-IMAGE-END]\\
1394 .  .
1397 .\" --------------------------------------------------------------------
1398 .\" JOBNAME
1400 .\"   Generate multiple output files containing the html.
1401 .\"   A file is split whenever a .SH or .NH 1 is encountered.
1402 .\"   The argument to JOBNAME is the file stem for future output files.
1404 .de JOBNAME
1405 .  DEVTAG .job-name \\$1
1408 .\" --------------------------------------------------------------------
1409 .\" HEAD
1411 .\"   Adds information to the <head> </head> section of the html
1412 .\"   document
1413 .\" --------------------------------------------------------------------
1414 .de HEAD
1415 .  DEVTAG .head "\\$*"
1418 .\" --------------------------------------------------------------------
1419 .\" start of some code
1421 .de CDS
1422 .  ft C
1423 .  nf
1426 .\" --------------------------------------------------------------------
1427 .\" end of some code
1429 .de CDE
1430 .  fi
1431 .  ft P
1434 .ds www-nav-colour #eeeeee\"
1435 .nr www-nav-width-left 30
1436 .nr www-nav-width-right 70
1438 .\" --------------------------------------------------------------------
1439 .\" LNS - left navigation start
1441 .de LNS
1442 .  HTML</p> <table><tr><td valign=top \
1443                            width=\\n[www-nav-width-left]% \
1444                            "bgcolor=""\\*[www-nav-colour]"">"
1445 .  LK
1446 .  HTML</p> </td><td valign=top \
1447                      width=\\n[www-nav-width-right]%>
1448 .  nr SH-open 1
1451 .\" --------------------------------------------------------------------
1452 .\" LNE - left navigation end
1454 .de LNE
1455 .  HTML</p> </td></tr></table>
1456 .  HR
1459 .nr SH-open 0
1460 .nr needs-begin 0
1463 .\" some auxiliary macros for left navigation lists
1465 .de www-SH
1466 .  if (0\\$1 == 0) \{\
1467 .    if (\\n[SH-open] == 1) \
1468 .      LNE
1469 .    nr needs-begin 1
1470 .    @SH-old
1471 .  \}
1474 .de www-NH
1475 .  if (0\\$1 <= 1) \{\
1476 .    if (\\n[SH-open] == 1) \
1477 .      LNE
1478 .    nr needs-begin 1
1479 .    @NH-old
1480 .  \}
1483 .de www-LP
1484 .  @LP-old
1485 .  if (\\n[needs-begin] == 1) \{\
1486 .    HR
1487 .    LNS
1488 .  \}
1489 .  nr needs-begin 0
1492 .\" --------------------------------------------------------------------
1493 .\" ALN [colour] [left width percentage]
1495 .\"   Turn on automatic left navigation.  This macro should only be
1496 .\"   called once (normally at the start of the document) as it
1497 .\"   indicates that all top-level section headings form a navigation
1498 .\"   list on the left of the main text.
1500 .de ALN
1501 .  if '\*[.T]'html' \{\
1502 .    if !'\\$1'' \
1503 .      ds www-nav-colour \\$1\"
1504 .    if (0\\$2 > 0) \{\
1505 .      nr www-nav-width-left \\$2
1506 .      nr www-nav-width-right (100 - \\$2)
1507 .    \}
1508 .    rn @SH @SH-old
1509 .    rn www-SH @SH
1510 .    rn @NH @NH-old
1511 .    rn www-NH @NH
1512 .    rn @LP @LP-old
1513 .    rn www-LP @LP
1514 .  \}
1517 .\" --------------------------------------------------------------------
1518 .\"  LINKSTYLE color [fontstyle [openglyph closeglyph]]
1520 .\"    Initializes www.tmac so that when this macro set is used with
1521 .\"    non-HTML devices the urls are rendered the user defined attributes.
1522 .\"    For example:
1524 .\"    LINKSTYLE blue CR < >
1526 .de LINKSTYLE
1527 .  if (\\n[.$] < 1) \
1528 .    www:error .\\$0 expects at least 1 argument.
1529 .  ds www:color \\$1\"
1530 .  shift
1531 .  if (\\n[.$] < 1) \
1532 .    return
1533 .  ds www:fontstyle \\$1\"
1534 .  shift
1535 .  if (\\n[.$] < 1) \
1536 .    www:error .\\$0 expects that both the open and close glyph is specified
1537 .  ds www:open \\$1\"
1538 .  ds www:close \\$2\"
1541 .\" MATHML - enable eqn mathml output to pass through to the device
1542 .\"          driver
1544 .de MATHML
1545 .  if (\\n[.O] == 0) .MATH<?p> \\$*
1548 .\" --------------------------------------------------------------------
1549 .\" Final Setup
1550 .\" --------------------------------------------------------------------
1552 .LINKSTYLE blue C \[la] \[ra]
1554 .if \n[www-html] \{\
1555 .  nh
1556 .  nr HY 0
1559 .if r ps4html .nop \O[0]
1560 .cp \n(_C
1562 .\" now set
1564 .\" --------------------------------------------------------------------
1565 .\" Emacs settings
1566 .\" --------------------------------------------------------------------
1568 .\" Local Variables:
1569 .\" mode: nroff
1570 .\" End:
1571 .\" EOF