1 .\" $Id: mandoc_html.3,v 1.1 2014/07/23 18:13:09 schwarze Exp $
3 .\" Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: July 23 2014 $
22 .Nd internals of the mandoc HTML formatter
26 .Fn print_gen_decls "struct html *h"
28 .Fn print_gen_head "struct html *h"
32 .Fa "enum htmltag tag"
34 .Fa "const struct htmlpair *p"
39 .Fa "const struct tag *until"
44 .Fa "const struct tag *suntil"
49 .Fa "const char *word"
52 The mandoc HTML formatter is not a formal library.
53 However, as it is compiled into more than one program, in particular
57 and because it may be security-critical in some contexts,
58 some documentation is useful to help to use it correctly and
59 to prevent XSS vulnerabilities.
61 The formatter produces HTML output on the standard output.
62 Since proper escaping is usually required and best taken care of
63 at one central place, the language-specific formatters
69 are not supposed to print directly to
77 Instead, they are expected to use the output functions declared in
79 and implemented as part of the main HTML formatting engine in
82 These structures are declared in
86 Internal state of the HTML formatter.
87 .It Vt struct htmlpair
88 Holds one HTML attribute.
90 .Fa "enum htmlattr key"
92 .Fa "const char *val" .
95 are provided to support initialization of such structures.
97 One entry for the LIFO stack of HTML elements.
99 .Fa "enum htmltag tag"
101 .Fa "struct tag *next" .
103 .Ss Private interface functions
107 .Ao Pf \&? Ic xml ? Ac
109 .Aq Pf \&! Ic DOCTYPE
110 declarations required for the current document type.
118 elements for the document
128 which takes care of properly encoding attributes,
129 which is relevant for the
135 prints the start tag of an HTML element with the name
139 attributes that can optionally be provided in the
142 It uses the private function
144 which in turn uses the private function
146 to take care of HTML encoding.
147 If required by the element type, it remembers in
149 that the element is open.
152 is used to close out all open elements up to and including
155 is a variant to close out all open elements up to but excluding
160 prints HTML element content.
161 It uses the private function
163 to take care of HTML encoding.
164 If the document has requested a non-standard font, for example using a
167 font escape sequence,
171 in an HTML font selection element using the
182 do not directly produce output but buffer text in the
186 They are not used internally by
188 but intended for use by the language-specific formatters
189 to ease preparation of strings for the
197 Consequently, these functions do not do any HTML encoding.
205 are not yet documented.
207 .Bl -tag -width mandoc_aux.c -compact
209 declarations of public functions for use by the main program,
212 declarations of data types and private functions
213 for use by language-specific HTML formatters
215 main HTML formatting engine and utility functions
229 declarations of data types and private functions
230 for shared use by all mandoc formatters,
233 private functions for shared use by all mandoc formatters
235 declarations of common mandoc utility functions, see
238 implementation of common mandoc utility functions
246 The mandoc HTML formatter was written by
247 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
248 This manual was written by
249 .An Ingo Schwarze Aq Mt schwarze@openbsd.org .