.\" www.tmac
.\"
.\" A simple set of macros to provide HTML documents with basic
.\" www functionality.  It will work with any macro set.
.\"
.nr _C \n(.C
.cp 0
.nr www-html 0
.if '\*(.T'html' .nr www-html 1
.\"
.\"
.\"
.de HTML
.  if \\n[www-html] \{\
.\" the following line makes the vertical mode leave, so to say
\&
\X^html:\\$*^
.  \}
..
.de HTMLINDEX
.  if \\n[www-html] \X^index:\\$*^
..
.\"
.\"  BODYCOLOR - $1 is foreground color
.\"              $2 is background color
.\"              $3 is the color of an active hypertext link
.\"              $4 is the color of a hypertext link not yet visited
.\"              $5 is the color of a visited hypertext link
.\"
.de BODYCOLOR
.  HTML <body text=\\$1 bgcolor=\\$2 link=\\$3 alink=\\$4 vlink=\\$5>
..
.\"
.\" BACKGROUND - $1 is the background image file
.\"
.de BACKGROUND
.  HTML <body background=\\$1>
..
.\"
.\"  URL - $1 is the classical underlined blue text
.\"        $2 is the url
.\"        $3 is optional stuff printed immediately after $3
.\"
.de URL
.  ie \\n[www-html] \{\
.    HTML <a href="\\$2">\\$1</a>\\$3
.  \}
.  el \{\
\\$1 \%\(la\fC\\$2\fP\(ra\\$3
.  \}
..
.\"
.\"  FTP - $1 is the classical underlined blue text
.\"        $2 is the ftp url
.\"        $3 is optional stuff printed immediately after $2
.de FTP
.  ie \\n[www-html] \{\
.    HTML <a href=\\$2>\\$1</a>\\$3
.  \}
.  el \{\
\\$1 \%\(la\fC\\$2\fP\(ra\\$3
.  \}
..
.\"
.\" MAILTO - generate html email reference
.\"          $1 is the email address (without the `mailto:' prefix)
.\"          $2 is the optional name
.\"          $3 is optional stuff printed immediately after $2 (resp. $1)
.\"
.\"          example:
.\"
.\"            Foobar has been written by
.\"            .MAILTO fred@foo.bar "Fredrick Bloggs" .
.\"
.de MAILTO
.\"
.\" force reset after a potential heading by performing some motion..
.\" how do we do this --fixme--
.\"  \h'\w' ''\h'-\w' '' doesn't work..
.  ie \\n[www-html] \{\
.    ie '\\$2'' \{\
.      HTML "<a href=mailto:\\$1>\\$1</a>\\$3"
.    \}
.    el \{\
.      HTML "<a href=mailto:\\$1>\\$2</a>\\$3"
.    \}
.  \}
.  el \{\
.    ie '\\$2'' \{\
\fC\\$1\fP\\$3
.    \}
.    el \{\
\\$2 \%\(la\fC\\$1\fP\(ra\\$3
.    \}
.  \}
..
.\"
.\" TAG - generate an html name $1
.\"
.de TAG
.  HTML <a name="\\$1"></a>
..
.\"
.\" IMAGE - reference an image
.\"         $1 is the image file
.\"         $2 is the alignment r, l or c  (center by default)
.\"         $3 is the x width (default if absent 400 pixels)
.\"         $4 is the y width (default if absent is the x value)
.\"
.de IMAGE
.  ie \\n[www-html] \{\
.    ie '\\$2'r' .HTML-TAG ".right-image"
.    el \{\
.      ie '\\$2'l' .HTML-TAG ".left-image"
.      el .HTML-TAG ".centered-image"
.    \}
.    nr HTMLWIDTH 400
.    if !'\\$3'' \{\
.      nr HTMLWIDTH \\$3
.    \}
.    nr HTMLHEIGHT \\n[HTMLWIDTH]
.    if !'\\$4'' \{\
.      nr HTMLHEIGHT \\$4
.    \}
.    HTML <img src="\\$1" width=\\n[HTMLWIDTH] height=\\n[HTMLHEIGHT]>
.  \}
.  el \{\
.    B1
\(la\fC\\$1\fP\(ra
.    B2
.  \}
..
.\" HTML-TAG - emit a tag for the new grohtml
.de HTML-TAG
.  if \\n[www-html] \{\
.\" the following line makes the vertical mode leave, so to say
\&
\X^html-tag:\\$*^
.  \}
..
.\" LINKS - emit the automatically collected links derived from section/numbered
.\"         headings at this position.
.de LINKS
.   HTML-TAG ".links"
..
.\"
.\" LINE - produce a horizontal line
.\" 
.de LINE
.    ti 0
.    HTML <hr>
..
.\"
.\" supplimentary macros used by other macro sets
.\"
.\" here are some tags specially for -Tps or -Thtml when invoked by pre-html
.\" to generate png images from postscript.
.\"
.\" HTML-DO-IMAGE - tells troff to issue an image marker which can be
.\"                 read back by pre-html
.\"
.de HTML-DO-IMAGE
.  if r ps4html .begin \{\
.         image \\$2 \\$1.png
.         bp
.         tl ''''
\O[0]\O[1]
.  \}
.  if \\n[www-html] .begin \{\
.         image \\$2 \\$1.png
\O[0]
.  \}
..
.\"
.\" HTML-IMAGE-END - terminates an image for html
.\"
.de HTML-IMAGE-END
.  if r ps4html    \O[2]\O[1]\O[4]
.  if \\n[www-html] \O[2]\O[1]\O[4]
..
.nr png-no 0
.\"
.\" MAKE-UNIQUE-NAME - generates another unique name
.\"
.de MAKE-UNIQUE-NAME
.   nr png-no  \\n[png-no]+1
.   ds HTML-UNIQUE-NAME \\n(.F-auto-\\n[png-no]
..
.\"
.\" HTML-IMAGE - is the same name as a tag generated from eqn/tbl/pic.
.\"              Although the tags generated via the preprocessor
.\"              are given image names by pre-html and troff.
.\"              The macros below can only be invoked by *other macro sets*
.\"              not user troff input since the contents of macro sets are
.\"              not seen by pre-html.
.\"
.de HTML-IMAGE
.\" generates a centered image
.   MAKE-UNIQUE-NAME
.   HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] c
..
.de HTML-IMAGE-RIGHT
.   MAKE-UNIQUE-NAME
.   HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] r
..
.de HTML-IMAGE-LEFT
.   MAKE-UNIQUE-NAME
.   HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] l
..
.de HTML-IMAGE-INLINE
.   MAKE-UNIQUE-NAME
.   HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] i
..
.if \n[www-html] \{\
.   nh
.   nr HY 0
.\}
.cp \n(_C
