aboutsummaryrefslogtreecommitdiff
path: root/texinfo/makeinfo/macros/html.texi
blob: 60760825c6853ce48ad6e586d859e49cfe81c14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
@c  html.texi: -*- Texinfo -*- Macros which support HTML output.

@c  Copyright (c) 1995 Brian Fox (bfox@ai.mit.edu)
@c  Author: Brian J. Fox (bfox@ai.mit.edu) Sat Apr  1 20:30:54 1995.
@c
@c I didn't want to write this myself, because I wanted some HTML wizard
@c to get everything exactly right.  However, rms continues to believe
@c that the macro system is not a good idea.  I couldn't disagree more,
@c so I am writing this as an example of how useful such macros can be.

@macro html
@set html
<html>
@end macro

@c
@c The first step is to define the macros which really only have meaning
@c when producing output for HTML.

@c
@c @anchor{Brian Fox, http://www.ua.com/users/bfox/}
@c
@macro anchor{text, link}
@ifset html
<a href="\link\">\text\</a>
@end ifset
@ifclear html
\text\
@end ifclear
@end macro

@macro pre{}
@ifset html
<pre>
@end ifset
@end macro

@macro endpre{}
@ifset html
</pre>
@end ifset
@end macro

@macro TeX
@ifset html
<i>T</i>e<i>X</i>
@end ifset
@ifclear html
@TeX{}
@end ifclear
@end macro

@macro paragraph{}
@ifset html
<p>
@end ifset
@end macro

@c
@c @email{bfox@@ai.mit.edu}
@c
@macro email{address}
@anchor{mailto:\address\, \address\}
@end macro

@c
@c Redefine the TeXinfo commands which have direct HTML counterparts.
@c 

@macro html-define-0arg{command, html-insertion}
@macro \command\
@ifset html
\html-insertion\
@end ifset
@ifclear html
@\command\
@end ifclear
@end macro
@end macro

@macro html-define-1arg{command, html-insertion}
@macro \command\{arg}
@ifset html
\html-insertion\
@end ifset
@ifclear html
@\command\{\arg\}
@end ifclear
@end macro
@end macro

@macro html-define-line{command, html-insertion}
@macro \command\{line}
@ifset html
\html-insertion\
@end ifset
@ifclear html
@\command\ \line\
@end ifclear
@end macro
@end macro

@html-define-0arg{*, <br>}
@html-define-1arg{b, <b>\\arg\\</b>}
@html-define-1arg{code, <tt><b>\\arg\\</b></tt>}
@html-define-line{itemize, <ul>}
@html-define-line{item,<p><li>}
@html-define-line{heading,<h1>\\line\\</h1>}
@html-define-0arg{bye, </html>}

@c 
@c Define into nothing the macros which do nothing in html.
@c 
@html-define-line{group,}

@c
@c Define a macro which is used to define other macros.  This one makes
@c a macro which creates an HTML header line.  No sectioning commands
@c are used.  This takes advantage of the non-recursion feature of
@c macro execution.
@macro node_define{orig-name, header-style}
@macro \orig-name\{title}
@ifset html
@node \title\
<a name="\title\"><\header-style\>\title\</\header-style\></a>
@end ifset
@ifclear html
@\orig-name\ \title\
@end ifclear
@end macro
@end macro

@c
@c The same as NODE_DEFINE, but italicized.
@macro inode_define{orig-name, header-style}
@macro \orig-name\{title}
@ifset html
@node \title\
<a name="\title\"><\header-style\><i>\title\</i></\header-style\></a>
@end ifset
@ifclear html
@\orig-name\ \title\
@end ifclear
@end macro
@end macro

@c Ignore @node commands.
@html-define-line{node,}

@c Here is a special one for "@top".
@macro top{title}
@end macro

@c Now actually define a new set of sectioning commands.
@node_define {appendix, h1}
@node_define {appendixsec, h2}
@node_define {appendixsubsec, h3}
@node_define {appendixsubsubsec, h4}
@node_define {chapter, h1}
@node_define {section, h2}
@node_define {subsection, h3}
@node_define {subsubsec, h4}
@node_define {unnumbered, h1}
@node_define {unnumberedsec, h2}
@node_define {unnumberedsubsec, h3}
@node_define {unnumberedsubsubsec, h4}

@c The italicized analogues.
@inode_define {iappendix, h1}
@inode_define {iappendixsec, h2}
@inode_define {iappendixsubsec, h3}
@inode_define {iappendixsubsubsec, h4}
@inode_define {ichapter, h1}
@inode_define {isection, h2}
@inode_define {isubsection, h3}
@inode_define {isubsubsec, h4}
@inode_define {iunnumbered, h1}
@inode_define {iunnumberedsec, h2}
@inode_define {iunnumberedsubsec, h3}
@inode_define {iunnumberedsubsubsec, h4}

@c Manual starter:
@c 
@c Pass arguments of TITLE, AUTHOR, and a short DESCRIPTION.
@c Immediately following, insert the Top node's menu.
@c 
@c Typical usage:
@c 
@c @document{Makeinfo, Brian J. Fox, This file documents the use of the
@c @code{makeinfo} program\, versions 1.61 and later.}
@c 
@c @menu
@c * What is @makeinfo{}?::
@c @end menu
@macro document{title, author, description}
@ifinfo
\description\

Copyright @copyright{} 1995 \author\
Copyright @copyright{} 1995 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

Permission is granted to process this file through TeX and print the
results, provided the printed document carries copying permission
notice identical to this one except for the removal of this paragraph
(this paragraph not being relevant to the printed manual).

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the copyright holders.
@end ifinfo

@titlepage
@title \title\
@author \author\

@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1995 \author\
Copyright @copyright{} 1995 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the copyright holders.
@end titlepage

@top{\title\}

\description\
@end macro

@html-define-line{end,
@ifeq{"\\line\\"\, "ifinfo"\, @end ifinfo}
@ifeq{"\\line\\"\, "ifset"\, @end ifset}
@ifeq{"\\line\\"\, "ifclear"\, @end ifclear}
@ifeq{"\\line\\"\, "cartouche"\, @end cartouche}
@ifeq{"\\line\\"\, "menu"\, @end menu}
@ifeq{"\\line\\"\, "itemize"\, </ul>}
@ifeq{"\\line\\"\, "enumerate"\, </ul>}
@ifeq{"\\line\\"\, "table"\, </ul>}
@ifeq{"\\line\\"\, "ftable"\, </ul>}
@ifeq{"\\line\\"\, "vtable"\, </ul>}
@ifeq{"\\line\\"\, "menu"\, xxx}
@ifeq{"\\line\\"\, "quotation"\, </pre>}
@ifeq{"\\line\\"\, "example"\, </tt></pre>}
@ifeq{"\\line\\"\, "smallexample"\, </tt></pre>}
@ifeq{"\\line\\"\, "lisp"\, </tt></pre>}
@ifeq{"\\line\\"\, "format"\, </tt></pre>}
@ifeq{"\\line\\"\, "display"\, </tt></pre>}
@ifeq{"\\line\\"\, "group"}}