groff before CVS: release 1.15
[s-roff.git] / tmac / tmac.arkup
blobb8c94df257a9454ec734dd4b37ddabbf85cb2c1e
1 .\"
2 .\"  a simple set of macros to provide HTML documents with basic www functionality
3 .\"
4 .\"  please can someone with more skill at creating macros improve on this
5 .\"  many thanks - Gaius
6 .\"
7 .\"  suggestion: maybe when run with non -Thtml all the urls should appear as
8 .\"  references.
9 .\"
10 .\" some simple html additions to any macro set
11 .\"
12 .de HTML
13 .if '\*(.T'html' \X^html:\\$*^
15 .de HTMLINDEX
16 .if '\*(.T'html' \X^index:\\$*^
18 .\"
19 .\"  BODYCOLOR - $1 is foreground color
20 .\"              $2 is background color
21 .\"              $3 is the color of an active hypertext link
22 .\"              $4 is the color of a hypertext link not yet visited
23 .\"              $5 is the color of a visited hypertext link
24 .\"
25 .de BODYCOLOR
26 .   HTML <body text=\\$1 bgcolor=\\$2 link=\\$3 alink=\\$4 vlink=\\$5>
28 .\"
29 .\" BACKGROUND - $1 is the background image file
30 .\"
31 .de BACKGROUND
32 .   HTML <body background=\\$1>
34 .\"
35 .\"  URL - $1 is the classical underlined blue text
36 .\"        $2 is the url
37 .\"
38 .de URL
39 .   ie '\*(.T'html' \{\
40 .        HTML <a href="\\$2">\\$1</a>
41 .   \}
42 .   el \{\
43 \\$1 (<url: \\$2>)
44 .   \}
46 .\"
47 .\"  LINK - $1 is the classical underlined blue text
48 .\"         $2 is the URL *with* the textual reference within a document
49 .\"
50 .\"         example:  .LINK "a nice heading" "#heading123"
51 .\"
52 .\"                    provides a link from "a nice heading" to the
53 .\"                    textual name reference "heading123"
54 .\"
55 .\"                   .LINK "The GNU FSF" "" "www.gnu.org"
56 .\"
57 .\"                    deprecated - use the URL macro instead
58 .\"         
59 .\"
60 .de LINK
61 .   ie !'\\$3'' \{\
62 .      @error the LINK macro has changed, use the URL (or FTP if appropriate) macro here
63 .      @error you are advised to replace with URL or FTP macro "\\$1" "\\$3#\\$2"
64 .      URL  "\\$1" "\\$3#\\$2"
65 .   \}
66 .   el \{\
67 .      ie '\*(.T'html' \{\
68 .          HTML <a href=\\$2>\\$1</a>
69 .      \}
70 .      el \{\
71 .          URL "\\$1" "\\$2"
72 .      \}          
73 .   \}
75 .\"
76 .\"  FTP - $1 is the classical underlined blue text
77 .\"        $2 is the ftp url
78 .de FTP
79 .   ie '\*(.T'html' \{\
80 .        HTML <a href=\\$2>\\$1</a>
81 .   \}
82 .   el \{\
83 $1 (<ftp:\\$2>)
84 .   \}
86 .\"
87 .\" MAILTO - generate html email reference
88 .\"          $1 is the email address
89 .\"          $2 is the optional name
90 .\"
91 .\"          example .MAILTO fred@foo.bar "Fredrick Bloggs"
92 .\"
93 .de MAILTO
94 .\"
95 .\" force reset after a potential heading by performing some motion..
96 .\" how do we do this --fixme--
97 .\"  \h'\w' ''\h'-\w' '' doesn't work..
98 .   ie '\*(.T'html' \{\
99 .        ie '\\$2'' \{\
100 .            HTML "<a href=mailto:\\$1>\\$1</a>"
101 .        \}
102 .        el \{\
103 .            HTML "<a href=mailto:\\$1>\\$2</a>"
104 .        \}
105 .   \}
106 .   el \{\
107 \s-2\fB<email:\\$1>\fP\s+2
108 .   \}
112 .\" TAG - generate an html name $1
114 .de TAG
115 .HTML <a name="\\$1"></a>
118 .\" IMAGE - reference an image
119 .\"         $1 is the image file
120 .\"         $2 is the x width (default if absent 400 pixels)
121 .\"         $3 is the y width (default if absent is the x value)
123 .de IMAGE
124 .   ie '\*(.T'html' \{\
125 .      nr HTMLWIDTH 400
126 .      if '\\$2'' \{\
127 .         nr HTMLWIDTH \\$2
128 .      \}
129 .      nr HTMLHEIGHT \\n[HTMLWIDTH]
130 .      if '\\$3'' \{\
131 .         nr HTMLHEIGHT \\$3
132 .      \}
133 .      HTML <img src="\\$1" width=\\n[HTMLWIDTH height=\\n[HTMLHEIGHT]>
134 .   \}
135 .   el \{\
136 .      B1
137 \fB\s-2<img src=\\$1>\fP\s+2
138 .      B2
139 .   \}
142 .\" CDFTP - if we are processing this on machine \\$1 then we create a
143 .\"         FTP reference using \\$2 --> \\$3
145 .\"         otherwise we create a URL from \\$2 --> \\$4
147 .\"         example:
149 .\"         .CDFTP "foobar" "somegnusoftware.tar.gz" \
150 .\"                "ftp://ftp.gnu.org/gnu/somegnusoftware.tar.gz" \
151 .\"                "../../../TARGZ/somegnusoftware.tar.gz"
153 .\"         meaning if we are on machine foobar then generate an ftp url
154 .\"         to the GNU anonymous ftp server otherwise generate a file url
155 .\"         to a local copy (cdrom maybe)
157 .\"         Useful when one machine is designated as a cdrom burner and another
158 .\"         designated as an appache server.
159 .\"         The same source for web pages can be burnt onto a CD and also
160 .\"         served across the network. It doesn't solve the problem of one
161 .\"         machine doing both though :-(
162 .\"         
164 .de CDFTP 
165 .   sy /bin/rm -f /tmp/tmac.n
166 .   sy /bin/echo ".ds HOSTNAME `hostname --short`" > /tmp/tmac.n
167 .   so /tmp/tmac.n
168 .   sy /bin/rm -f /tmp/tmac.n
169 .   ie '\\*[HOSTNAME]'\\$1' \{\
170 .      FTP "\\$2"  "\\$3"
171 .   \}
172 .   el \{\
173 .      URL  "\\$2" "\\$4"
174 .   \}
176 .\" it doesn't make sense to use hyphenation with html, so we turn it off.
177 .hy 0
178 .nr HY 0