html.h (cec8643b41ebefad6c677010fc784dc4bb0550f3) | html.h (4d131170e62381276a07ffc0aeb1b62e527d940c) |
---|---|
1/* $Id: html.h,v 1.102 2019/03/01 10:57:18 schwarze Exp $ */ | 1/* $Id: html.h,v 1.109 2021/09/09 14:47:24 schwarze Exp $ */ |
2/* | 2/* |
3 * Copyright (c) 2017, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org> |
|
3 * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> | 4 * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
4 * Copyright (c) 2017, 2018, 2019 Ingo Schwarze <schwarze@openbsd.org> | |
5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 * 18 * Internal interfaces for mandoc(1) HTML formatters. 19 * For use by the individual HTML formatters only. |
|
17 */ 18 19enum htmltag { 20 TAG_HTML, 21 TAG_HEAD, | 20 */ 21 22enum htmltag { 23 TAG_HTML, 24 TAG_HEAD, |
22 TAG_BODY, | |
23 TAG_META, | 25 TAG_META, |
26 TAG_LINK, 27 TAG_STYLE, |
|
24 TAG_TITLE, | 28 TAG_TITLE, |
29 TAG_BODY, |
|
25 TAG_DIV, | 30 TAG_DIV, |
26 TAG_IDIV, | |
27 TAG_SECTION, | 31 TAG_SECTION, |
28 TAG_H1, 29 TAG_H2, 30 TAG_SPAN, 31 TAG_LINK, 32 TAG_BR, 33 TAG_A, | |
34 TAG_TABLE, 35 TAG_TR, 36 TAG_TD, 37 TAG_LI, 38 TAG_UL, 39 TAG_OL, 40 TAG_DL, 41 TAG_DT, 42 TAG_DD, | 32 TAG_TABLE, 33 TAG_TR, 34 TAG_TD, 35 TAG_LI, 36 TAG_UL, 37 TAG_OL, 38 TAG_DL, 39 TAG_DT, 40 TAG_DD, |
41 TAG_H1, 42 TAG_H2, |
|
43 TAG_P, 44 TAG_PRE, | 43 TAG_P, 44 TAG_PRE, |
45 TAG_VAR, 46 TAG_CITE, | 45 TAG_A, |
47 TAG_B, | 46 TAG_B, |
48 TAG_I, | 47 TAG_CITE, |
49 TAG_CODE, | 48 TAG_CODE, |
49 TAG_I, |
|
50 TAG_SMALL, | 50 TAG_SMALL, |
51 TAG_STYLE, | 51 TAG_SPAN, 52 TAG_VAR, 53 TAG_BR, 54 TAG_HR, 55 TAG_MARK, |
52 TAG_MATH, 53 TAG_MROW, 54 TAG_MI, 55 TAG_MN, 56 TAG_MO, 57 TAG_MSUP, 58 TAG_MSUB, 59 TAG_MSUBSUP, --- 4 unchanged lines hidden (view full) --- 64 TAG_MTR, 65 TAG_MTD, 66 TAG_MUNDEROVER, 67 TAG_MUNDER, 68 TAG_MOVER, 69 TAG_MAX 70}; 71 | 56 TAG_MATH, 57 TAG_MROW, 58 TAG_MI, 59 TAG_MN, 60 TAG_MO, 61 TAG_MSUP, 62 TAG_MSUB, 63 TAG_MSUBSUP, --- 4 unchanged lines hidden (view full) --- 68 TAG_MTR, 69 TAG_MTD, 70 TAG_MUNDEROVER, 71 TAG_MUNDER, 72 TAG_MOVER, 73 TAG_MAX 74}; 75 |
72enum htmlfont { 73 HTMLFONT_NONE = 0, 74 HTMLFONT_BOLD, 75 HTMLFONT_ITALIC, 76 HTMLFONT_BI, 77 HTMLFONT_CW, 78 HTMLFONT_MAX 79}; 80 | |
81struct tag { 82 struct tag *next; 83 int refcnt; 84 int closed; 85 enum htmltag tag; 86}; 87 88struct html { --- 17 unchanged lines hidden (view full) --- 106 struct tag *tag; /* last open tag */ 107 struct rofftbl tbl; /* current table */ 108 struct tag *tblt; /* current open table scope */ 109 char *base_man1; /* bases for manpage href */ 110 char *base_man2; 111 char *base_includes; /* base for include href */ 112 char *style; /* style-sheet URI */ 113 struct tag *metaf; /* current open font scope */ | 76struct tag { 77 struct tag *next; 78 int refcnt; 79 int closed; 80 enum htmltag tag; 81}; 82 83struct html { --- 17 unchanged lines hidden (view full) --- 101 struct tag *tag; /* last open tag */ 102 struct rofftbl tbl; /* current table */ 103 struct tag *tblt; /* current open table scope */ 104 char *base_man1; /* bases for manpage href */ 105 char *base_man2; 106 char *base_includes; /* base for include href */ 107 char *style; /* style-sheet URI */ 108 struct tag *metaf; /* current open font scope */ |
114 enum htmlfont metal; /* last used font */ 115 enum htmlfont metac; /* current font mode */ | 109 enum mandoc_esc metal; /* last used font */ 110 enum mandoc_esc metac; /* current font mode */ |
116 int oflags; /* output options */ 117#define HTML_FRAGMENT (1 << 0) /* don't emit HTML/HEAD/BODY */ 118#define HTML_TOC (1 << 1) /* emit a table of contents */ 119}; 120 121 122struct roff_node; 123struct tbl_span; 124struct eqn_box; 125 126void roff_html_pre(struct html *, const struct roff_node *); 127 128void print_gen_comment(struct html *, struct roff_node *); 129void print_gen_decls(struct html *); 130void print_gen_head(struct html *); | 111 int oflags; /* output options */ 112#define HTML_FRAGMENT (1 << 0) /* don't emit HTML/HEAD/BODY */ 113#define HTML_TOC (1 << 1) /* emit a table of contents */ 114}; 115 116 117struct roff_node; 118struct tbl_span; 119struct eqn_box; 120 121void roff_html_pre(struct html *, const struct roff_node *); 122 123void print_gen_comment(struct html *, struct roff_node *); 124void print_gen_decls(struct html *); 125void print_gen_head(struct html *); |
131void print_metaf(struct html *, enum mandoc_esc); | |
132struct tag *print_otag(struct html *, enum htmltag, const char *, ...); | 126struct tag *print_otag(struct html *, enum htmltag, const char *, ...); |
127struct tag *print_otag_id(struct html *, enum htmltag, const char *, 128 struct roff_node *); |
|
133void print_tagq(struct html *, const struct tag *); 134void print_stagq(struct html *, const struct tag *); | 129void print_tagq(struct html *, const struct tag *); 130void print_stagq(struct html *, const struct tag *); |
131void print_tagged_text(struct html *, const char *, 132 struct roff_node *); |
|
135void print_text(struct html *, const char *); 136void print_tblclose(struct html *); 137void print_tbl(struct html *, const struct tbl_span *); 138void print_eqn(struct html *, const struct eqn_box *); 139void print_endline(struct html *); 140 141void html_close_paragraph(struct html *); 142enum roff_tok html_fillmode(struct html *, enum roff_tok); 143char *html_make_id(const struct roff_node *, int); | 133void print_text(struct html *, const char *); 134void print_tblclose(struct html *); 135void print_tbl(struct html *, const struct tbl_span *); 136void print_eqn(struct html *, const struct eqn_box *); 137void print_endline(struct html *); 138 139void html_close_paragraph(struct html *); 140enum roff_tok html_fillmode(struct html *, enum roff_tok); 141char *html_make_id(const struct roff_node *, int); |
142int html_setfont(struct html *, enum mandoc_esc); |
|