freebsd-nq/contrib/groff/tmac/www.tmac

1231 lines
31 KiB
Plaintext
Raw Normal View History

2003-05-01 13:09:50 +00:00
.ig
www.tmac - macro package for adding HTML elements to roff documents.
File position: <groff_source_top>/tmac/www.tmac
Installed position: groff's main macro directory.
------------------------------------------------------------------------
Legalize
------------------------------------------------------------------------
This file is part of groff, the GNU roff type-setting system.
2005-10-20 10:45:19 +00:00
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
2003-05-01 13:09:50 +00:00
written by Gaius Mulley <gaius@glam.ac.uk>, with additions by
Werner Lemberg <wl@gnu.org> and Bernd Warken <bwarken@mayn.de>.
groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
groff is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with groff; see the file COPYING. If not, write to the Free
2005-10-20 10:45:19 +00:00
Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA
02110-1301, USA.
2003-05-01 13:09:50 +00:00
------------------------------------------------------------------------
Description
------------------------------------------------------------------------
A simple set of macros to provide HTML documents with basic
www functionality. It should work with any macro set.
..
.
.\" --------------------------------------------------------------------
.\" Setup
.\" --------------------------------------------------------------------
.
2005-10-20 10:45:19 +00:00
.do if d www:lenstr .nx
.
.do mso devtag.tmac
.
2001-04-17 12:12:05 +00:00
.nr _C \n(.C
.cp 0
2002-10-11 08:52:17 +00:00
.
2005-10-20 10:45:19 +00:00
.
2001-04-17 12:12:05 +00:00
.nr www-html 0
2002-10-11 08:52:17 +00:00
.if '\*[.T]'html' .nr www-html 1
.
.\" set up www-image-template
.
.if !d www-image-template \
. ds www-image-template
.
.if r ps4html \{\
. \" remove the title command when we are generating images for html
. \" (stops a title accidentally appearing inside an image)
. di www-notitle
. tl ''''
. di
. rm tl
. de tl
. .
.\}
.
2003-05-01 13:09:50 +00:00
.
.\" --------------------------------------------------------------------
.\" Test for `.substring'; result in register `www.substring_ok'.
.\" The automated break points in .URL addresses are only added if
.\" this register is non-zero.
.\"
.nr www:substring_ok 0
.de www:@test_substring
. if !d substring \
. return
. ds \\$0:s abcdefg\"
. substring \\$0:s 1 1
. if !'\\*[\\$0:s]'b' \{\
. rm \\$0:s
. return
. \}
. ds \\$0:s abcdefg\"
. substring \\$0:s 0 0
. if !'\\*[\\$0:s]'a' \{\
. rm \\$0:s
. return
. \}
. ds \\$0:s abcdefg\"
. substring \\$0:s 1 -1
. if !'\\*[\\$0:s]'bcdefg' \{\
. rm \\$0:s
. return
. \}
. nr www:substring_ok 1
. rm \\$0:s
..
.www:@test_substring
.rm www:@test_substring
.
.
.\" --------------------------------------------------------------------
.\" Local Macros
.\" --------------------------------------------------------------------
.
.\" --------------------------------------------------------------------
2005-10-20 10:45:19 +00:00
.\" www:paraspace
.\"
.\" Space before paragraph. Use \n[PD] if it exists.
.\"
.nr www:pd 0.5v
.de www:paraspace
. ie r PD .sp \\n[PD]u
. el .sp \\n[www:pd]u
..
.
.\"
.\" --------------------------------------------------------------------
2003-05-01 13:09:50 +00:00
.\" www:error (<test>...)
.\"
.\" Print error message
.\"
2002-10-11 08:52:17 +00:00
.de www-error
. tm \\n[.F]:\\n[.c]: macro error: \\$*
..
2003-05-01 13:09:50 +00:00
.als www:error www-error
.
.\" --------------------------------------------------------------------
.\" www:lenstr (<register_name> <string_name>)
.\"
.\" Store length of string named <string_name> into register named
.\" <register_name>.
.\"
.de www:lenstr
. if !(\\n[.$] == 2) \{\
. tm .\\$0 expects 2 arguments.
. ab
. \}
. length \\$0:n x\\*[\\$2]
. nr \\$1 (\\n[\\$0:n]-1)
. rr \\$0:n
..
.\" --------------------------------------------------------------------
.\" www:splitstr (<name>)
.\"
.\" Add a space character between any two adjacent characters in string
.\" <name> and restore result into the string variable <name>; space
.\" characters are first replaced by the word `space'.
.\"
.de www:splitstr
. if !(\\n[.$] == 1) \
. www:error .\\$0 expects 1 argument.
. if '\\*[\\$1]'' \
. return
. ds \\$0:r "\\*[\\$1]\""
. ds \\$0:s\"
. while 1 \{\
. ds \\$0:c "\\*[\\$0:r]\""
. substring \\$0:c 0 0\"
. ie '\\*[\\$0:c]' ' \
. as \\$0:s " space\""
. el \
. as \\$0:s " \\*[\\$0:c]\""
. www:lenstr \\$0:n \\$0:r
. if (\\n[\\$0:n] <= 1) \{\
. break
. \}
. substring \\$0:r 1 -1\"
. \}
. if !'\\*[\\$0:s]'' \
. substring \\$0:s 1 -1
. ds \\$1 \\*[\\$0:s]
. rm \\$0:c
. rr \\$0:n
. rm \\$0:r
. rm \\$0:s
..
.\" --------------------------------------------------------------------
.\" www:url_breaks (<string_name>)
.\"
.\" Add `\:' (possible break point) within URL strings after `/'.
.\"
.\" Smart about multiple `/', existing `\:', and space characters;
.\" does not set a break point if less than 5 characters would go to
.\" the next line.
.\"
.de www:url_breaks
. if !(\\n[.$] == 1) \
. www:error .\\$0 expects 1 argument.
. if !\n[www:substring_ok] \
. return
. ds \\$0:s "\\*[\\$1]\""
. www:splitstr \\$0:s
. www:url_breaks_splitted \\$0:s \\*[\\$0:s]
. ds \\$1 "\\*[\\$0:s]\""
. rm \\$0:s
..
.\" --------------------------------------------------------------------
.\" www:url_breaks_splitted (<result> <char> [<char>...])
.\"
.\" Add `\:' within URL strings, but arguments are a splitted string.
.\"
.\" Arguments: >=2: <result> <char> [<char>...]
.\"
.de www:url_breaks_splitted
2005-10-20 10:45:19 +00:00
. nr \\$0:min 5 \" minimal number of characters for next line
2003-05-01 13:09:50 +00:00
. if (\\n[.$] < 2) \
. www:error .\\$0 expects at least 2 arguments.
. ds \\$0:res \\$1\"
. shift
. ds \\$0:s\"
. nr \\$0:done 0
. while !\\n[\\$0:done] \{\
. if (\\n[.$] <= 0) \{\
. nr \\$0:done 1
. break
. \}
. if '\\$1'space' \{\
. as \\$0:s " \""
. shift
. continue
. \}
. if (\\n[.$] < \\n[\\$0:min]) \{\
. as \\$0:s "\\$1\""
. shift
. continue
. \}
. if !'\\$1'/' \{\
. as \\$0:s "\\$1\""
. shift
. continue
. \}
. \" we are at a `/' character
. while '\\$1'/' \{\
. as \\$0:s /\"
. if (\\n[.$] == 0) \{\
. nr \\$0:done 1
. break
. \}
. shift
. \}
. if \\n[\\$0:done] \
. break
. if (\\n[.$] < \\n[\\$0:min]) \
. continue
. if '\\$1'\:' \
. shift
. as \\$0:s \:\"
. \}
. ds \\*[\\$0:res] \\*[\\$0:s]\"
. rm \\$0:res
. rm \\$0:s
..
.\" --------------------------------------------------------------------
.\" User Interface
.\" --------------------------------------------------------------------
.
.\" --------------------------------------------------------------------
2005-10-20 10:45:19 +00:00
.\" HTML
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.\" the main auxiliary macro for the HTML interface
2001-04-17 12:12:05 +00:00
.\"
.de HTML
. if \\n[www-html] \{\
2005-10-20 10:45:19 +00:00
. \" was implemented via .nop \&\X^html:\\$*^ but
. \" is now implemented using HTML-NS to utilize code factoring.
. \"
. \" the `\&' makes the vertical mode leave, so to say
. \"
. nop \&\c
. HTML-NS \\$*
2002-10-11 08:52:17 +00:00
. nop \&
2001-04-17 12:12:05 +00:00
. \}
..
2002-10-11 08:52:17 +00:00
.\"
.\" an auxiliary macro for HTML (without following space)
.\"
.de HTML-NS
2005-10-20 10:45:19 +00:00
. nop \X^html:\\$*^\c
..
.\"
.\" emit a HTML tag after shutting down a (possibly open) paragraph
.\"
.de HTML</p>
. if \\n[www-html] \{\
. \" the `\&' makes the vertical mode leave, so to say
. nop \&\X^html</p>:\\$*^
. \}
2002-10-11 08:52:17 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" HX n
.\"
.\" Automatic heading level cut off.
.\"
.\" N is the depth limit of automatically linked headings. So a depth
2003-05-01 13:09:50 +00:00
.\" of 2 would cause grohtml to generate a list of links for `.NH 1'
.\" and `.NH 2' but not for `.NH 3'.
2002-10-11 08:52:17 +00:00
.\"
.de HX
. if \\n[www-html] \
. nop \X^index:\\$*^
2001-04-17 12:12:05 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" BCL foreground background active not-visited visited
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.de BCL
2001-04-17 12:12:05 +00:00
. HTML <body text=\\$1 bgcolor=\\$2 link=\\$3 alink=\\$4 vlink=\\$5>
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" BGIMG imagefile
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.de BGIMG
2001-04-17 12:12:05 +00:00
. HTML <body background=\\$1>
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
.\" URL url [description] [after]
.\" if description is absent then the url becomes the anchor text
2001-04-17 12:12:05 +00:00
.\"
.de URL
2005-10-20 10:45:19 +00:00
. ie !'\\$1'' \{\
. ds \\$0:adr \\$1\"
. www:url_breaks \\$0:adr
. \}
2003-05-01 13:09:50 +00:00
. ie \\n[www-html] \{\
2005-10-20 10:45:19 +00:00
. ie '\\$3'' \
. ds \\$0:after \&
. el \
. ds \\$0:after \&\\$3
2003-05-01 13:09:50 +00:00
. ie '\\$2'' \
2005-10-20 10:45:19 +00:00
. HTML-NS <a href="\\$1">\\$1</a>
2003-05-01 13:09:50 +00:00
. el \
2005-10-20 10:45:19 +00:00
. HTML-NS <a href="\\$1">\\$2</a>
. nop \\*[\\$0:after]
. rm \\$0:after
2003-05-01 13:09:50 +00:00
. \}
. el \{\
. if !r ps4html .ad l
2005-10-20 10:45:19 +00:00
. ie '\\$2'' \{\
. ie '\\$1'' \{\
. ie !'\\$3'' \
. nop \\$3
. \}
. el \{\
. ie \\n[.color] \
. nop \%\[la]\m[blue]\f[C]\\*[\\$0:adr]\f[]\m[]\[ra]\\$3
. el \
. nop \%\[la]\f[CB]\\*[\\$0:adr]\f[]\[ra]\\$3
. \}
. \}
. el \{\
. ie '\\$1'' \{\
. ie \\n[.color] \
. nop \m[blue]\\$2\m[]\\$3
. el \
. nop \f[B]\\$2\f[]\\$3
. \}
. el \{\
. ie \\n[.color] \
. nop \m[blue]\\$2\m[] \%\[la]\f[C]\\*[\\$0:adr]\f[]\[ra]\\$3
. el \
. nop \f[B]\\$2\f[] \%\[la]\f[C]\\*[\\$0:adr]\f[]\[ra]\\$3
. \}
. \}
2003-05-01 13:09:50 +00:00
. if !r ps4html .ad
. \}
. rm \\$0:adr
2002-10-11 08:52:17 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" FTP url description [after]
.\"
2003-05-01 13:09:50 +00:00
.\" Same as URL.
2002-10-11 08:52:17 +00:00
.\"
.als FTP URL
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" MTO address description [after]
.\"
.\" ADDRESS is the email address (without the `mailto:' prefix).
.\"
.\" DESCRIPTION is the optional name. If an empty argument is given,
.\" ADDRESS is used instead.
.\"
.\" AFTER is optional stuff printed immediately after ADDRESS
.\" (resp. DESCRIPTION).
.\"
.\" Example:
.\"
.\" Foobar has been written by
.\" .MTO fred@foo.bar "Fredrick Bloggs" .
.\"
.de MTO
2001-04-17 12:12:05 +00:00
. ie \\n[www-html] \{\
2002-10-11 08:52:17 +00:00
. ie '\\$2'' \
. URL mailto:\\$1 \\$1 "\\$3"
. el \
. URL mailto:\\$1 "\\$2" "\\$3"
2001-04-17 12:12:05 +00:00
. \}
. el \{\
2005-10-20 10:45:19 +00:00
. ie '\\$2'' \{\
. ie '\\$1'' \{\
. ie !'\\$3'' \
. nop \\$3
. \}
. el \{\
. ie \\n[.color] \
. nop \%\m[blue]\f[C]\\$1\f[]\m[]\\$3
. el \
. nop \%\f[CB]\\$1\f[]\\$3
. \}
. \}
. el \{\
. ie '\\$1'' \{\
. ie \\n[.color] \
. nop \m[blue]\\$2\m[]\\$3
. el \
. nop \f[B]\\$2\f[]\\$3
. \}
. el \{\
. ie \\n[.color] \
. nop \m[blue]\\$2\m[] \%\[la]\f[C]\\$1\f[]\[ra]\\$3
. el
. nop \f[B]\\$2\f[] \%\[la]\f[C]\\$1\f[]\[ra]\\$3
. \}
. \}
2001-04-17 12:12:05 +00:00
. \}
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" TAG name
.\"
.\" Generate an html name NAME.
.\"
.de TAG
. HTML <a name="\\$1"></a>
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" IMG [-R|-L|-C] filename [width] [height]
.\"
.\" Include an image of any type (will only work for -Thtml).
.\"
.\" Alignment is centered by default (-C).
.\" Default value for WIDTH is 1i.
.\" If HEIGHT is not given, WIDTH is used as the height.
.\"
.de IMG
2001-04-17 12:12:05 +00:00
. ie \\n[www-html] \{\
2002-10-11 08:52:17 +00:00
. ie '\\$2'-R' \
2005-10-20 10:45:19 +00:00
. DEVTAG ".right-image"
2002-10-11 08:52:17 +00:00
. el \{\
. ie '\\$2'-L' \
2005-10-20 10:45:19 +00:00
. DEVTAG ".left-image"
2002-10-11 08:52:17 +00:00
. el \
2005-10-20 10:45:19 +00:00
. DEVTAG ".centered-image"
2002-10-11 08:52:17 +00:00
. \}
. nr www-width 100
. if !'\\$3'' \
. nr www-width \\$3
. nr www-height \\n[www-width]
. if !'\\$4'' \
. nr www-height \\$4
2005-10-20 10:45:19 +00:00
. HTML <img src="\\$1" alt="Image \\$1" \
width=\\n[www-width] height=\\n[www-height]>
2001-04-17 12:12:05 +00:00
. \}
2002-10-11 08:52:17 +00:00
. el \
. nop \[la]\f[C]\\$1\f[]\[ra]
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" PIMG [-R|-L|-C] filename [width] [height]
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.\" Include a png image. It will work for -Tps and -Thtml.
.\" The default value for WIDTH and HEIGHT is zero; the default
.\" alignment is centering (-C).
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.\" Note: This macro can only be used with the `-U' option of groff,
.\" activating unsafe mode, if not used with -Thtml; the PNG image
.\" is then converted to the EPS format using netpbm utilities.
.\"
.de PIMG
2001-04-17 12:12:05 +00:00
. ie \\n[www-html] \{\
2002-10-11 08:52:17 +00:00
. ie '\\$1'-R' \
2005-10-20 10:45:19 +00:00
. DEVTAG ".right-image"
2002-10-11 08:52:17 +00:00
. el \{\
. ie '\\$1'-L' \
2005-10-20 10:45:19 +00:00
. DEVTAG ".left-image"
2002-10-11 08:52:17 +00:00
. el \
2005-10-20 10:45:19 +00:00
. DEVTAG ".centered-image"
2002-10-11 08:52:17 +00:00
. \}
. nr www-width 0
. nr www-height 0
. if !'\\$3'' \
. nr www-width (\\$3 * 100 / 240)
. if !'\\$4'' \
. nr www-height (\\$4 * 100 / 240)
. ie (\\n[www-width] == 0) \{\
. ie (\\n[www-height] == 0) \
2005-10-20 10:45:19 +00:00
. HTML <img src="\\$2" alt="Image \\$2">
2002-10-11 08:52:17 +00:00
. el \
2005-10-20 10:45:19 +00:00
. HTML <img src="\\$1" alt="Image \\$2" height=\\n[www-height]>
2001-04-17 12:12:05 +00:00
. \}
. el \{\
2002-10-11 08:52:17 +00:00
. ie (\\n[www-height] == 0) \
2005-10-20 10:45:19 +00:00
. HTML <img src="\\$2" alt="Image \\$2" width=\\n[www-width]>
2002-10-11 08:52:17 +00:00
. el \
2005-10-20 10:45:19 +00:00
. HTML <img src="\\$2" alt="Image \\$2" width=\\n[www-width] \
height=\\n[www-height]>
2001-04-17 12:12:05 +00:00
. \}
. \}
. el \{\
2002-10-11 08:52:17 +00:00
. if !r ps4html \{\
. www-make-unique-name
2003-05-01 13:09:50 +00:00
. sy pngtopnm \\$2 | pnmcrop -white | @PNMTOPS_NOSETPAGE@ -noturn > \\*[www-unique-name].eps
2002-10-11 08:52:17 +00:00
. ie '\\$1'-C' \
. PSPIC \\*[www-unique-name].eps \\$3 \\$4
. el \
. PSPIC \\$1 \\*[www-unique-name].eps \\$3 \\$4
2001-04-17 12:12:05 +00:00
. \}
2002-10-11 08:52:17 +00:00
. \}
..
.
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
.\" auxiliary definitions for MPIMG
.\"
2002-10-11 08:52:17 +00:00
.nr www-left-ll-trap 0
.nr www-left-po-trap 0
.nr www-right-ll-trap 0
.
.de www-finish-left-po
2005-10-20 10:45:19 +00:00
. po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
2002-10-11 08:52:17 +00:00
. wh \\n[www-left-po-trap]u
. nr www-left-indent 0
..
.
2005-10-20 10:45:19 +00:00
.\" called when the -R picture is finished
2002-10-11 08:52:17 +00:00
.de www-finish-right-ll
2005-10-20 10:45:19 +00:00
. ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
2002-10-11 08:52:17 +00:00
. \" now see whether we need to inline www-finish-left-ll
. if (\\n[www-left-ll-trap]u > 0) \
. if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
. mk www-left-po-trap
. nr www-left-po-trap +1v
. wh \\n[www-left-po-trap]u www-finish-left-po
. ll +\\n[www-left-indent]u
. wh \\n[www-left-ll-trap]u
. nr www-left-ll-trap 0
. \}
. \" and see whether we need to inline www-finish-left-po
. if (\\n[www-left-po-trap]u > 0) \
. if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
. po -\\n[www-left-indent]u
. wh \\n[www-left-po-trap]u
. nr www-left-indent 0
. \}
. wh \\n[www-right-ll-trap]u
. nr www-right-ll-trap 0
..
.
.de www-finish-left-ll
. if (\\n[www-right-ll-trap] > 0) \
. if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
. ll +\\n[www-right-indent]u
. nr www-right-ll-trap 0
. \}
. mk www-left-po-trap
. nr www-left-po-trap +1v
. wh \\n[www-left-po-trap]u www-finish-left-po
2005-10-20 10:45:19 +00:00
. ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
2002-10-11 08:52:17 +00:00
. wh \\n[www-left-ll-trap]u
. nr www-left-ll-trap 0
..
2005-10-20 10:45:19 +00:00
.
.\" www-handle-percent arg N1 N2 S1
.\" arg - input string (number or number%)
.\" output parameters:
.\" N1 - name of number register 1=absolute 0=percentage
.\" N2 - number register name for absolute value
.\" S1 - string register name for percentage value
.
.de www-handle-percent
. ds www-percent \\$1\"
. substring www-percent -1 -1
.
. ie '\\*[www-percent]'%' \{\
. ds www-abs \\$1\"
. substring www-abs 0 -2
. nr \\$2 0
. nr \\$3 \\*[www-abs]
. ds \\$4 \\$1\"
. \}
. el \{\
. nr \\$2 1
. nr \\$3 \\$1
. ds \\$4 none\"
. \}
..
.
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2005-10-20 10:45:19 +00:00
.\" MPIMG [-R|-L] [-G gap] filename [width [height]]
2002-10-11 08:52:17 +00:00
.\"
.\" Include a png image and wrap text around it. It will work for
.\" -Tps and -Thtml. The default value for WIDTH is 1i; default value
.\" for HEIGHT is WIDTH; the default alignment is left (-L).
2005-10-20 10:45:19 +00:00
.\" -G is used to insert a gap between the text and the image.
.\" The height and width can also be given as a percentage.
.\" The PostScript device converts the percentage width into an
.\" absolute value by using \\n[.l], and the height by using \\n[.p].
.\"
2002-10-11 08:52:17 +00:00
.\"
.\" Note: This macro can only be used with the `-U' option of groff,
.\" activating unsafe mode, if not used with -Thtml; the PNG image
.\" is then converted to the EPS format using netpbm utilities.
.\"
2005-10-20 10:45:19 +00:00
.
.nr www-htmlimage-gap 0
.
2002-10-11 08:52:17 +00:00
.de MPIMG
2005-10-20 10:45:19 +00:00
. nr www-image-just 1
. nr www-image-gap 0
. while (\\n[.$] > 0) \{\
. if '-L'\\$1' \{\
. nr www-image-just 1
. shift
. continue
. \}
. if '-R'\\$1' \{\
. nr www-image-just 0
. shift
. continue
. \}
. if '-G'\\$1' \{\
. nr www-image-gap \\$2
. nr www-htmlimage-gap (\\$2 * 100 / 240)
. shift 2
. continue
. \}
. break
. \}
.
2002-10-11 08:52:17 +00:00
. nr www-width 1i
2005-10-20 10:45:19 +00:00
. nr www-height 1i
. ds www-size-specs "width=\\n[www-width] height=\\n[www-height]\"
. ie !'\\$2'' \{\
. nr www-is-absolute 0
. nr www-absolute 0
. ds www-percentage none\"
. www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
. ie !\\n[www-is-absolute] \{\
. \" percentage of linelength requested
. nr www-width (\\n[www-absolute] * \\n[.l] / 100)
. if \\n[www-html] \
. nr www-width (\\n[www-width] * 100 / 240)
. ds www-size-specs "width=\\*[www-percentage]\"
. \}
. el \{\
. nr www-width \\n[www-absolute]
. if \\n[www-html] \
. nr www-width (\\n[www-width] * 100 / 240)
. ds www-size-specs "width=\\n[www-width]\"
. \}
.
. nr www-height \\n[www-width]
. ie !'\\$3'' \{\
. nr www-is-absolute 0
. nr www-absolute 0
. ds www-percentage none\"
. www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
. ie !\\n[www-is-absolute] \{\
. \" percentage of pagelength requested
. nr www-height (\\n[www-absolute] * \\n[.p] / 100)
. if \\n[www-html] \
. nr www-height (\\n[www-height] * 100 / 240)
. ds www-size-specs "\\*[www-size-specs] height=\\*[www-percentage]\"
. \}
. el \{\
. nr www-height \\n[www-absolute]
. if \\n[www-html] \
. nr www-height (\\n[www-height] * 100 / 240)
. ds www-size-specs "\\*[www-size-specs] height=\\*[www-height]\"
. \}
. \}
. \}
. el \{\
. \" height not specified; use width value
. ie !\\n[www-is-absolute] \{\
. \" percentage value
. ds www-size-specs "\\*[www-size-specs] height=\\*[www-percentage]\"
. nr www-height \\n[www-width]
. \}
. el \{\
. ds www-size-specs "\\*[www-size-specs] height=\\*[www-width]\"
. nr www-height \\n[www-width]
. \}
. \}
.
2002-10-11 08:52:17 +00:00
. ie \\n[www-html] \{\
2005-10-20 10:45:19 +00:00
. ie !\\n[www-image-just] \
. HTML <img src="\\$1" alt="Image \\$1" hspace=\\n[www-htmlimage-gap] \
align=right \\*[www-size-specs]>
2002-10-11 08:52:17 +00:00
. el \
2005-10-20 10:45:19 +00:00
. HTML <img src="\\$1" alt="Image \\$1" hspace=\\n[www-htmlimage-gap] \
align=left \\*[www-size-specs]>
2002-10-11 08:52:17 +00:00
. \}
. el \{\
2005-10-20 10:45:19 +00:00
. tm www-width is \\n[www-width]
. tm www-height is \\n[www-height]
2002-10-11 08:52:17 +00:00
. if !r ps4html \{\
. www-make-unique-name
2005-10-20 10:45:19 +00:00
. sy pngtopnm \\$1 | pnmcrop -white | @PNMTOPS_NOSETPAGE@ -noturn > \\*[www-unique-name].eps
. ie !\\n[www-image-just] \{\
2002-10-11 08:52:17 +00:00
. \" we must now disable a possible left image trap
. sp -1
. if (\\n[www-left-ll-trap] > 0) \
. wh \\n[www-left-ll-trap]u
. if (\\n[www-left-po-trap] > 0) \
. wh \\n[www-left-po-trap]u
2005-10-20 10:45:19 +00:00
. PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
2002-10-11 08:52:17 +00:00
. sp -\\n[ps-desht]u
. nr www-right-indent \\n[ps-deswid]u
2005-10-20 10:45:19 +00:00
. \" we want to have some space between text and image,
. \" so the line length must be shorter
. ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
2002-10-11 08:52:17 +00:00
. mk www-right-ll-trap
. nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
. wh \\n[www-right-ll-trap]u www-finish-right-ll
. \" now restore possible left trap
. if (\\n[www-left-ll-trap] > 0) \
. wh \\n[www-left-ll-trap]u www-finish-left-ll
. if (\\n[www-left-po-trap] > 0) \
. wh \\n[www-left-po-trap]u
. \}
. el \{\
. \" we must now disable a possible right image trap
. if (\\n[www-right-ll-trap] > 0) \
. wh \\n[www-right-ll-trap]u
2005-10-20 10:45:19 +00:00
. PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
2002-10-11 08:52:17 +00:00
. sp -\\n[ps-desht]u
. nr www-left-indent \\n[ps-deswid]u
2005-10-20 10:45:19 +00:00
. \" increase offset by gap
. po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
. \" decrease line length by gap
. ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
2002-10-11 08:52:17 +00:00
. mk www-left-ll-trap
. nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
. wh \\n[www-left-ll-trap]u www-finish-left-ll
. \" now restore possible right trap
. if (\\n[www-right-ll-trap] > 0) \
. wh \\n[www-right-ll-trap]u www-finish-right-ll
. \}
2001-04-17 12:12:05 +00:00
. \}
. \}
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" HnS n
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.\" Begin heading. Heading level is N.
.\"
.\" HnE
.\"
.\" End heading.
.\"
.\" If your heading contains URL, FTP, MTO macros you might wish to
.\" disable automatic links to headings. This can be done via `-P-l'
.\" from the command line or by using a cakk to `.HX 0'.
.\"
.nr www-heading-no -1
.
.de HnS
. ie '\\$1'' \
. nr www-heading-no 1
. el \
. nr www-heading-no \\$1
2005-10-20 10:45:19 +00:00
. DEVTAG-NH \\n[www-heading-no]
2002-10-11 08:52:17 +00:00
..
.
.de HnE
. if (\\n[www-heading-no] == -1) \
. www-error "HnE found without a corresponding HnS"
2005-10-20 10:45:19 +00:00
. DEVTAG-EO-H
2002-10-11 08:52:17 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" LK
.\"
.\" Emit the automatically collected links derived from
.\" section/numbered headings at this position.
.\"
.de LK
2005-10-20 10:45:19 +00:00
. DEVTAG ".links"
2001-04-17 12:12:05 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" HR
.\"
2005-10-20 10:45:19 +00:00
.\" Produce a horizontal line.
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.de HR
2005-10-20 10:45:19 +00:00
. HTML</p> "<hr>"
2002-10-11 08:52:17 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" NHR
.\"
.\" Suppresses the generation of the top and bottom rules which grohtml
.\" emits by default.
.\"
.de NHR
2005-10-20 10:45:19 +00:00
. DEVTAG ".no-auto-rule"
2002-10-11 08:52:17 +00:00
..
.\"
.\" www-end-nowhere - end of input trap called to finish diversion.
.\"
.de www-end-nowhere
2005-10-20 10:45:19 +00:00
. if !\\n[www-html] \
. di
. DEVTAG-EO-TL
2002-10-11 08:52:17 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" HTL
.\"
.\" Generate an HTML title only. This differs from the -ms .TL macro
2005-10-20 10:45:19 +00:00
.\" which generates both an HTML title and an H1 heading.
2002-10-11 08:52:17 +00:00
.\"
.\" This is useful when an author wishes to use a HTML title as search
.\" engine fodder but a graphic title in the document.
.\"
.\" The macro terminates when a space or break is seen (.sp, .br).
.\"
.de HTL
2005-10-20 10:45:19 +00:00
. DEVTAG ".html-tl"
. if !\\n[www-html] \
2002-10-11 08:52:17 +00:00
. di www-nowhere
2005-10-20 10:45:19 +00:00
. it 2 www-end-nowhere
2002-10-11 08:52:17 +00:00
..
.
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2005-10-20 10:45:19 +00:00
.\" auxiliary definitions for lists
.\"
.ds www-ul-level1 \[bu]\ \ \"
.ds www-ul-level2 \[sq]\ \ \"
.ds www-ul-level3 \[ci]\ \ \"
.nr www-ul-level 0
.
.ds www-ol-level1 decimal\"
.ds www-ol-level2 lower-alpha\"
.ds www-ol-level3 lower-roman\"
.ds www-ol-tmp 00\ \ \"
.nr www-ol-ctr1 0 1
.nr www-ol-ctr2 0 1
.nr www-ol-ctr3 0 1
.af www-ol-ctr2 a
.af www-ol-ctr3 i
.nr www-ol-level 0
.
.nr www-dl-level 0
.nr www-dl-shift 5n
.
.\"
.\" allow nested lists
2003-05-01 13:09:50 +00:00
.\"
2002-10-11 08:52:17 +00:00
.nr www-depth 0
2005-10-20 10:45:19 +00:00
.nr www-li-indent \n[.i]
.ds www-level0 nop\"
.ds www-level1
.ds www-level2
.ds www-level3
.ds www-level4
.ds www-level5
.ds www-level6
.ds www-level7
.ds www-level8
.ds www-level9
.
.\" which macro to use for LI
.de www-push-li
. nr www-depth +1
. ds www-level\\n[www-depth] \\$1\"
. als LI \\$1
..
.
.de www-pop-li
. nr www-depth -1
. als LI \\*[www-level\\n[www-depth]]
..
2002-10-11 08:52:17 +00:00
.
.\"
.\" Auxiliary macro for ULS.
.\"
2005-10-20 10:45:19 +00:00
.de www-push-ul-level
. nr www-ul-level +1
. if (\\n[www-ul-level] > 3) \
. www-error "ULS: too many levels of indentation (\\n[www-ul-level])"
2002-10-11 08:52:17 +00:00
..
.\"
.\" Auxiliary macro for ULE.
.\"
2005-10-20 10:45:19 +00:00
.de www-pop-ul-level
. if !\\n[www-ul-level] \
. www-error "ULE: trying to terminate a list which does not exist"
. nr www-ul-level -1
..
.
.\"
.\" Auxiliary macro for OLS.
.\"
.de www-push-ol-level
. nr www-ol-level +1
. if (\\n[www-ol-level] > 3) \
. www-error "OLS: too many levels of indentation (\\n[www-ol-level])"
..
.\"
.\" Auxiliary macro for OLE.
.\"
.de www-pop-ol-level
. if !\\n[www-ol-level] \
. www-error "OLE: trying to terminate a list which does not exist"
. nr www-ol-level -1
2002-10-11 08:52:17 +00:00
..
2005-10-20 10:45:19 +00:00
.
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" ULS
.\"
.\" Start an unordered list.
.\"
.de ULS
2005-10-20 10:45:19 +00:00
. www-push-li www-li-ul
. www-push-ul-level
2002-10-11 08:52:17 +00:00
. ie \\n[www-html] \
2005-10-20 10:45:19 +00:00
. HTML</p> "<ul>"
2001-04-17 12:12:05 +00:00
. el \{\
2005-10-20 10:45:19 +00:00
. nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
2001-04-17 12:12:05 +00:00
. \}
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" ULE
.\"
.\" End an unordered list.
.\"
.de ULE
. ie \\n[www-html] \
. HTML "</ul>"
. el \{\
2005-10-20 10:45:19 +00:00
. nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
. in \\n[www-li-indent]u
. \}
. www-pop-ul-level
. www-pop-li
..
.\" --------------------------------------------------------------------
.\" OLS
.\"
.\" Start an ordered list.
.\"
.de OLS
. www-push-li www-li-ol
. www-push-ol-level
. ie \\n[www-html] \
. HTML</p> "<ol style='list-style-type: \\*[www-ol-level\\n[www-ol-level]]'>"
. el \
. nr www-li-indent +\w'\\*[www-ol-tmp]'u
..
.\" --------------------------------------------------------------------
.\" OLE
.\"
.\" End an ordered list.
.\"
.de OLE
. ie \\n[www-html] \
. HTML "</ol>"
. el \{\
. nr www-li-indent -\w'\\*[www-ol-tmp]'u
. in \\n[www-li-indent]u
. nr www-ol-ctr\\n[www-ol-level] 0 1
. \}
. www-pop-ol-level
. www-pop-li
..
.\" --------------------------------------------------------------------
.\"
.\" DLS
.\" Start a definition list.
.\"
.de DLS
. www-push-li www-li-dl
. nr www-dl-level +1
. ie \\n[www-html] \
. HTML</p> "<dl>"
. el \{\
. nr www-li-indent +\\n[www-dl-shift]u
. in \\n[www-li-indent]u
. \}
..
.\" --------------------------------------------------------------------
.\"
.\" DLE
.\" End a definition list.
.\"
.de DLE
. ie \\n[www-html] \
. HTML "</dl>"
. el \{\
. nr www-li-indent -\\n[www-dl-shift]u
. in \\n[www-li-indent]u
2001-04-17 12:12:05 +00:00
. \}
2005-10-20 10:45:19 +00:00
. nr www-dl-level -1
. www-pop-li
2001-04-17 12:12:05 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" LI
.\"
.\" Insert a list item.
.\"
2005-10-20 10:45:19 +00:00
.\" ********
.\" www-li-ul - bulleted list item
.\"
.de www-li-ul
. ie \\n[www-html] \
. HTML-NS "<li>"
. el \{\
. www:paraspace
. in \\n[www-li-indent]u
. ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
. nop \\*[www-ul-level\\n[www-ul-level]]\c
. \}
..
.\" ********
.\" www-li-ol - numbered list item
.\"
.de www-li-ol
2002-10-11 08:52:17 +00:00
. ie \\n[www-html] \
2005-10-20 10:45:19 +00:00
. HTML-NS "<li>"
. el \{\
. www:paraspace
. in \\n[www-li-indent]u
. ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
. nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
. \}
..
.\" ********
.\" www-li-dl - definition list item
.\"
.de www-li-dl
. ie \\n[www-html] \{\
. HTML "<dt>\\$1</dt>"
. HTML-NS "<dd>"
. \}
2002-10-11 08:52:17 +00:00
. el \{\
2005-10-20 10:45:19 +00:00
. www:paraspace
. in \\n[www-li-indent]u
. ti -\\n[www-dl-shift]u
. nop \&\\$1
. br
2002-10-11 08:52:17 +00:00
. \}
2001-04-17 12:12:05 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" DC l text [color]
.\"
.\" L is the letter to be dropped and enlarged.
.\"
.\" TEXT is the following text whose height the first letter should not
.\" exceed.
.\"
.\" COLOR is the optional color of the dropped letter (default black).
.\"
.de DC
. ds www-dropcolor black
. if !'\\$3'' \
. ds www-dropcolor \\$3
. ie '\*(.T'html' \{\
. www-make-unique-name
2005-10-20 10:45:19 +00:00
. nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
. MPIMG -L \\*[www-unique-name].png "\\n[www-drop-width]%"
2002-10-11 08:52:17 +00:00
. \}
. el \{\
. ie r ps4html \{\
. www-make-unique-name
2003-05-01 13:09:50 +00:00
. \" To avoid interferences with another DC macro call which is located
. \" very near to the current one, we draw the glyph on a separate page.
. \" Otherwise it could theoretically happen that the dropped capital
. \" glyphs overlap.
. bp
. ev www-DC
2005-10-20 10:45:19 +00:00
. vs 320p
2002-10-11 08:52:17 +00:00
. nop \O[5i\\*[www-unique-name].png]\O[1]
2005-10-20 10:45:19 +00:00
. nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
2003-05-01 13:09:50 +00:00
. nop \O[2]\O[0]
. br
. ev
. bp
2002-10-11 08:52:17 +00:00
. \}
. el \{\
2005-10-20 10:45:19 +00:00
. ie n \
. nop \\$1\c
. el \{\
. nr dummy \w'\\$1'u
. nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
. char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
. nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
' ti \w'\\[dcap]'u
. \}
2002-10-11 08:52:17 +00:00
. \}
. \}
. nop \\$2
2001-04-17 12:12:05 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
.\" Setup around HTML-IMAGE and friends
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.\" now set up TS, TE, EQ, EN default macros
.\"
.do if !d TS .do ds TS HTML-IMAGE
.do if !d TE .do ds TE HTML-IMAGE-END
.do if !d EQ .do ds EQ HTML-IMAGE
.do if !d EN .do ds EN HTML-IMAGE-END
.\"
.\" supplementary macros used by other macro sets
2001-04-17 12:12:05 +00:00
.\"
2003-05-01 13:09:50 +00:00
.\" here are some tags specially for -Tps or -Thtml when invoked by
.\" pre-html to generate png images from postscript.
.
.\" --------------------------------------------------------------------
2001-04-17 12:12:05 +00:00
.\" HTML-DO-IMAGE - tells troff to issue an image marker which can be
.\" read back by pre-html
.\"
.de HTML-DO-IMAGE
2002-10-11 08:52:17 +00:00
. if r ps4html \
. nop \O[5\\$2\\$1.png]\O[1]\O[3]
. if \\n[www-html] \
. nop \O[5\\$2\\$1.png]\O[0]\O[3]
2001-04-17 12:12:05 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2001-04-17 12:12:05 +00:00
.\" HTML-IMAGE-END - terminates an image for html
.\"
.de HTML-IMAGE-END
2002-10-11 08:52:17 +00:00
. if r ps4html \
. nop \O[4]\O[2]\O[0]
. if \\n[www-html] \
. nop \O[4]\O[2]\O[1]
2001-04-17 12:12:05 +00:00
..
2002-10-11 08:52:17 +00:00
.
.nr www-png-no 0
.
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" www-make-unique-name - generates another unique name in string
.\" `www-unique-name'
2001-04-17 12:12:05 +00:00
.\"
2002-10-11 08:52:17 +00:00
.de www-make-unique-name
. nr www-png-no +1
. ds www-unique-name \\*[www-image-template]\\n[www-png-no]
2001-04-17 12:12:05 +00:00
..
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2002-10-11 08:52:17 +00:00
.\" HTML-IMAGE and friends tell grohtml that this region of text needs
.\" to be rendered as an image.
2001-04-17 12:12:05 +00:00
.\"
.de HTML-IMAGE
2002-10-11 08:52:17 +00:00
. \" generates a centered image
. www-make-unique-name
. HTML-DO-IMAGE \\*[www-unique-name] c
2001-04-17 12:12:05 +00:00
..
2002-10-11 08:52:17 +00:00
.
2001-04-17 12:12:05 +00:00
.de HTML-IMAGE-RIGHT
2002-10-11 08:52:17 +00:00
. www-make-unique-name
. HTML-DO-IMAGE \\*[www-unique-name] r
2001-04-17 12:12:05 +00:00
..
2002-10-11 08:52:17 +00:00
.
2001-04-17 12:12:05 +00:00
.de HTML-IMAGE-LEFT
2002-10-11 08:52:17 +00:00
. www-make-unique-name
. HTML-DO-IMAGE \\*[www-unique-name] l
2001-04-17 12:12:05 +00:00
..
2002-10-11 08:52:17 +00:00
.
2001-04-17 12:12:05 +00:00
.de HTML-IMAGE-INLINE
2002-10-11 08:52:17 +00:00
. www-make-unique-name
. HTML-DO-IMAGE \\*[www-unique-name] i
2001-04-17 12:12:05 +00:00
..
2002-10-11 08:52:17 +00:00
.
2003-05-01 13:09:50 +00:00
.\" --------------------------------------------------------------------
2005-10-20 10:45:19 +00:00
.\" JOBNAME
.\"
.\" Generate multiple output files containing the html.
.\" A file is split whenever a .SH or .NH 1 is encountered.
.\" The argument to JOBNAME is the file stem for future output files.
.\"
.de JOBNAME
. DEVTAG .job-name \\$1
..
.\" --------------------------------------------------------------------
.\" HEAD
.\"
.\" Adds information to the <head> </head> section of the html
.\" document
.\" --------------------------------------------------------------------
.de HEAD
. DEVTAG .head "\\$*"
..
.\" --------------------------------------------------------------------
2003-05-01 13:09:50 +00:00
.\" Final Setup
.\" --------------------------------------------------------------------
.
2001-07-10 17:09:00 +00:00
.if \n[www-html] \{\
. nh
. nr HY 0
.\}
2003-05-01 13:09:50 +00:00
.
.\"
.\" start of some code
.\"
.
.de CDS
.ft C
.nf
..
.\"
.\" end of some code
.\"
.
.de CDE
.fi
.ft P
..
.
2002-10-11 08:52:17 +00:00
.if r ps4html .nop \O[0]
2001-04-17 12:12:05 +00:00
.cp \n(_C
2002-10-11 08:52:17 +00:00
.
2003-05-01 13:09:50 +00:00
.\" now set
.
.\" --------------------------------------------------------------------
.\" Emacs settings
.\" --------------------------------------------------------------------
.
.\" Local Variables:
.\" mode: nroff
.\" End:
2002-10-11 08:52:17 +00:00
.\" EOF