Print this page
Update to 1.12.3.
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/mandoc/html.h
+++ new/usr/src/cmd/mandoc/html.h
1 -/* $Id: html.h,v 1.47 2011/10/05 21:35:17 kristaps Exp $ */
1 +/* $Id: html.h,v 1.49 2013/08/08 20:07:47 schwarze Exp $ */
2 2 /*
3 3 * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 4 *
5 5 * Permission to use, copy, modify, and distribute this software for any
6 6 * purpose with or without fee is hereby granted, provided that the above
7 7 * copyright notice and this permission notice appear in all copies.
8 8 *
9 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 16 */
17 17 #ifndef HTML_H
18 18 #define HTML_H
19 19
20 20 __BEGIN_DECLS
21 21
22 22 enum htmltag {
23 23 TAG_HTML,
24 24 TAG_HEAD,
25 25 TAG_BODY,
26 26 TAG_META,
27 27 TAG_TITLE,
28 28 TAG_DIV,
29 29 TAG_H1,
30 30 TAG_H2,
31 31 TAG_SPAN,
32 32 TAG_LINK,
33 33 TAG_BR,
34 34 TAG_A,
35 35 TAG_TABLE,
36 36 TAG_TBODY,
37 37 TAG_COL,
38 38 TAG_TR,
39 39 TAG_TD,
40 40 TAG_LI,
41 41 TAG_UL,
42 42 TAG_OL,
43 43 TAG_DL,
44 44 TAG_DT,
45 45 TAG_DD,
46 46 TAG_BLOCKQUOTE,
47 47 TAG_P,
48 48 TAG_PRE,
49 49 TAG_B,
50 50 TAG_I,
51 51 TAG_CODE,
52 52 TAG_SMALL,
53 53 TAG_MAX
54 54 };
55 55
56 56 enum htmlattr {
57 57 ATTR_HTTPEQUIV,
58 58 ATTR_CONTENT,
59 59 ATTR_NAME,
60 60 ATTR_REL,
61 61 ATTR_HREF,
62 62 ATTR_TYPE,
63 63 ATTR_MEDIA,
64 64 ATTR_CLASS,
65 65 ATTR_STYLE,
66 66 ATTR_WIDTH,
67 67 ATTR_ID,
↓ open down ↓ |
56 lines elided |
↑ open up ↑ |
68 68 ATTR_SUMMARY,
69 69 ATTR_ALIGN,
70 70 ATTR_COLSPAN,
71 71 ATTR_MAX
72 72 };
73 73
74 74 enum htmlfont {
75 75 HTMLFONT_NONE = 0,
76 76 HTMLFONT_BOLD,
77 77 HTMLFONT_ITALIC,
78 + HTMLFONT_BI,
78 79 HTMLFONT_MAX
79 80 };
80 81
81 82 struct tag {
82 83 struct tag *next;
83 84 enum htmltag tag;
84 85 };
85 86
86 87 struct tagq {
87 88 struct tag *head;
88 89 };
89 90
90 91 struct htmlpair {
91 92 enum htmlattr key;
92 93 const char *val;
93 94 };
94 95
95 96 #define PAIR_INIT(p, t, v) \
96 97 do { \
97 98 (p)->key = (t); \
98 99 (p)->val = (v); \
99 100 } while (/* CONSTCOND */ 0)
100 101
101 102 #define PAIR_ID_INIT(p, v) PAIR_INIT(p, ATTR_ID, v)
102 103 #define PAIR_CLASS_INIT(p, v) PAIR_INIT(p, ATTR_CLASS, v)
103 104 #define PAIR_HREF_INIT(p, v) PAIR_INIT(p, ATTR_HREF, v)
104 105 #define PAIR_STYLE_INIT(p, h) PAIR_INIT(p, ATTR_STYLE, (h)->buf)
105 106 #define PAIR_SUMMARY_INIT(p, v) PAIR_INIT(p, ATTR_SUMMARY, v)
106 107
107 108 enum htmltype {
108 109 HTML_HTML_4_01_STRICT,
109 110 HTML_XHTML_1_0_STRICT
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
110 111 };
111 112
112 113 struct html {
113 114 int flags;
114 115 #define HTML_NOSPACE (1 << 0) /* suppress next space */
115 116 #define HTML_IGNDELIM (1 << 1)
116 117 #define HTML_KEEP (1 << 2)
117 118 #define HTML_PREKEEP (1 << 3)
118 119 #define HTML_NONOSPACE (1 << 4) /* never add spaces */
119 120 #define HTML_LITERAL (1 << 5) /* literal (e.g., <PRE>) context */
121 +#define HTML_SKIPCHAR (1 << 6) /* skip the next character */
120 122 struct tagq tags; /* stack of open tags */
121 123 struct rofftbl tbl; /* current table */
122 124 struct tag *tblt; /* current open table scope */
123 125 struct mchars *symtab; /* character-escapes */
124 126 char *base_man; /* base for manpage href */
125 127 char *base_includes; /* base for include href */
126 128 char *style; /* style-sheet URI */
127 129 char buf[BUFSIZ]; /* see bufcat and friends */
128 130 size_t buflen;
129 131 struct tag *metaf; /* current open font scope */
130 132 enum htmlfont metal; /* last used font */
131 133 enum htmlfont metac; /* current font mode */
132 134 enum htmltype type; /* output media type */
133 135 int oflags; /* output options */
134 136 #define HTML_FRAGMENT (1 << 0) /* don't emit HTML/HEAD/BODY */
135 137 };
136 138
137 139 void print_gen_decls(struct html *);
138 140 void print_gen_head(struct html *);
139 141 struct tag *print_otag(struct html *, enum htmltag,
140 142 int, const struct htmlpair *);
141 143 void print_tagq(struct html *, const struct tag *);
142 144 void print_stagq(struct html *, const struct tag *);
143 145 void print_text(struct html *, const char *);
144 146 void print_tblclose(struct html *);
145 147 void print_tbl(struct html *, const struct tbl_span *);
146 148 void print_eqn(struct html *, const struct eqn *);
147 149
148 150 void bufcat_fmt(struct html *, const char *, ...);
149 151 void bufcat(struct html *, const char *);
150 152 void bufcat_id(struct html *, const char *);
151 153 void bufcat_style(struct html *,
152 154 const char *, const char *);
153 155 void bufcat_su(struct html *, const char *,
154 156 const struct roffsu *);
155 157 void bufinit(struct html *);
156 158 void buffmt_man(struct html *,
157 159 const char *, const char *);
158 160 void buffmt_includes(struct html *, const char *);
159 161
160 162 int html_strlen(const char *);
161 163
162 164 __END_DECLS
163 165
164 166 #endif /*!HTML_H*/
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX