diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | tmac/www.tmac | 35 |
2 files changed, 45 insertions, 4 deletions
@@ -1,3 +1,17 @@ +2008-04-05 Dorai Sitaram <ds26gte@yahoo.com> + + Add better support for `.TAG #<label>' in non-HTML documents: In + case of a forward reference in a call to .URL, write `(see below)'. + In case of a backwards reference use the page number instead. The + reference gets stored in a string `TAG_<label>' and can be + overridden while calling `.TAG' with its new optional argument -- + this is useful for a second-pass system which resolves forward + references. + + * tmac/www.tmac (www:url_check_tag): New function. + (URL): Use it. + (TAG): Add optional argument to define string `TAG_<label>. + 2008-03-24 Werner LEMBERG <wl@gnu.org> * tmac/trace.tmac (so, mso): Added. diff --git a/tmac/www.tmac b/tmac/www.tmac index cd6feadf..9533a62b 100644 --- a/tmac/www.tmac +++ b/tmac/www.tmac @@ -354,14 +354,34 @@ HTML always denotes XHTML also. . HTML <body background=\\$1> .. . +.\" www:url_check_tag str +.\" If url named by \*[str] is internal (starts with #), +.\" redefine \*[str] to be the value of the string TAG_url. +. +.de www:url_check_tag +. ds \\$0:tmp \\*[\\$1]\" +. substring \\$0:tmp 0 0 +. if '\\*[\\$0:tmp]'#' \{\ +. ds \\$0:tmp \\*[\\$1]\" +. substring \\$0:tmp 1 +. ds \\$0:tmp TAG_\\*[\\$0:tmp]\" +. ie !'\\*[\\*[\\$0:tmp]]'' \ +. ds \\$1 \\*[\\*[\\$0:tmp]]\" +. el \ +. ds \\$1 see below\" +. \} +. rm \\$0:tmp +.. +. .\" -------------------------------------------------------------------- .\" URL url [description] [after] .\" if description is absent then the url becomes the anchor text .\" .de URL -. ie !'\\$1'' \{\ +. if !'\\$1'' \{\ . ds \\$0:adr \\$1\" -. www:url_breaks \\$0:adr +. www:url_check_tag \\$0:adr +. if !\\n[www-html] .www:url_breaks \\$0:adr . \} . ie \\n[www-html] \{\ . ie '\\$3'' \ @@ -369,7 +389,7 @@ HTML always denotes XHTML also. . el \ . ds \\$0:after \&\\$3\" . ie '\\$2'' \ -. HTML-NS <a "href=""\\$1"">\\$1</a>" +. HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>" . el \ . HTML-NS <a "href=""\\$1"">\\$2</a>" . nop \\*[\\$0:after] @@ -477,12 +497,19 @@ HTML always denotes XHTML also. .. . .\" -------------------------------------------------------------------- -.\" TAG name +.\" TAG name [text] .\" .\" Generate an html name NAME. +.\" Define string TAG_NAME to TEXT, if present, +.\" otherwise to \n[PN]. +.\" .\" .de TAG . HTML <a "name=""\\$1""></a>" +. ie '\\$2'' \ +. ds TAG_\\$1 \\n[PN] +. el \ +. ds TAG_\\$1 \\$2\" .. . .\" -------------------------------------------------------------------- |