mandoc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +7 -0
- data/COPYING +674 -0
- data/README.md +117 -0
- data/ext/mandoc/extconf.rb +59 -0
- data/ext/mandoc/rb_mandoc.c +548 -0
- data/ext/mandoc/rb_mandoc.h +22 -0
- data/lib/mandoc/version.rb +19 -0
- data/lib/mandoc.rb +26 -0
- data/mandoc-1.14.6/LICENSE +55 -0
- data/mandoc-1.14.6/arch.c +54 -0
- data/mandoc-1.14.6/att.c +49 -0
- data/mandoc-1.14.6/catman.c +260 -0
- data/mandoc-1.14.6/cgi.c +1279 -0
- data/mandoc-1.14.6/chars.c +507 -0
- data/mandoc-1.14.6/compat_err.c +103 -0
- data/mandoc-1.14.6/compat_fts.c +696 -0
- data/mandoc-1.14.6/compat_fts.h +106 -0
- data/mandoc-1.14.6/compat_getline.c +59 -0
- data/mandoc-1.14.6/compat_getsubopt.c +87 -0
- data/mandoc-1.14.6/compat_isblank.c +23 -0
- data/mandoc-1.14.6/compat_mkdtemp.c +50 -0
- data/mandoc-1.14.6/compat_mkstemps.c +63 -0
- data/mandoc-1.14.6/compat_ohash.c +330 -0
- data/mandoc-1.14.6/compat_ohash.h +72 -0
- data/mandoc-1.14.6/compat_progname.c +31 -0
- data/mandoc-1.14.6/compat_reallocarray.c +40 -0
- data/mandoc-1.14.6/compat_recallocarray.c +99 -0
- data/mandoc-1.14.6/compat_strcasestr.c +64 -0
- data/mandoc-1.14.6/compat_stringlist.c +135 -0
- data/mandoc-1.14.6/compat_stringlist.h +48 -0
- data/mandoc-1.14.6/compat_strlcat.c +57 -0
- data/mandoc-1.14.6/compat_strlcpy.c +52 -0
- data/mandoc-1.14.6/compat_strndup.c +42 -0
- data/mandoc-1.14.6/compat_strsep.c +70 -0
- data/mandoc-1.14.6/compat_strtonum.c +67 -0
- data/mandoc-1.14.6/compat_vasprintf.c +47 -0
- data/mandoc-1.14.6/config.h +52 -0
- data/mandoc-1.14.6/dba.c +508 -0
- data/mandoc-1.14.6/dba.h +50 -0
- data/mandoc-1.14.6/dba_array.c +190 -0
- data/mandoc-1.14.6/dba_array.h +47 -0
- data/mandoc-1.14.6/dba_read.c +74 -0
- data/mandoc-1.14.6/dba_write.c +127 -0
- data/mandoc-1.14.6/dba_write.h +30 -0
- data/mandoc-1.14.6/dbm.c +480 -0
- data/mandoc-1.14.6/dbm.h +68 -0
- data/mandoc-1.14.6/dbm_map.c +194 -0
- data/mandoc-1.14.6/dbm_map.h +29 -0
- data/mandoc-1.14.6/demandoc.c +260 -0
- data/mandoc-1.14.6/eqn.c +1132 -0
- data/mandoc-1.14.6/eqn.h +72 -0
- data/mandoc-1.14.6/eqn_html.c +246 -0
- data/mandoc-1.14.6/eqn_parse.h +48 -0
- data/mandoc-1.14.6/eqn_term.c +174 -0
- data/mandoc-1.14.6/html.c +1102 -0
- data/mandoc-1.14.6/html.h +142 -0
- data/mandoc-1.14.6/lib.c +35 -0
- data/mandoc-1.14.6/libman.h +42 -0
- data/mandoc-1.14.6/libmandoc.h +85 -0
- data/mandoc-1.14.6/libmdoc.h +87 -0
- data/mandoc-1.14.6/main.c +1375 -0
- data/mandoc-1.14.6/main.h +53 -0
- data/mandoc-1.14.6/man.c +345 -0
- data/mandoc-1.14.6/man.h +21 -0
- data/mandoc-1.14.6/man_html.c +640 -0
- data/mandoc-1.14.6/man_macro.c +470 -0
- data/mandoc-1.14.6/man_term.c +1143 -0
- data/mandoc-1.14.6/man_validate.c +660 -0
- data/mandoc-1.14.6/manconf.h +58 -0
- data/mandoc-1.14.6/mandoc.c +669 -0
- data/mandoc-1.14.6/mandoc.h +329 -0
- data/mandoc-1.14.6/mandoc_aux.c +118 -0
- data/mandoc-1.14.6/mandoc_aux.h +27 -0
- data/mandoc-1.14.6/mandoc_msg.c +375 -0
- data/mandoc-1.14.6/mandoc_ohash.c +65 -0
- data/mandoc-1.14.6/mandoc_ohash.h +23 -0
- data/mandoc-1.14.6/mandoc_parse.h +44 -0
- data/mandoc-1.14.6/mandoc_xr.c +123 -0
- data/mandoc-1.14.6/mandoc_xr.h +31 -0
- data/mandoc-1.14.6/mandocd.c +282 -0
- data/mandoc-1.14.6/mandocdb.c +2448 -0
- data/mandoc-1.14.6/manpath.c +363 -0
- data/mandoc-1.14.6/mansearch.c +851 -0
- data/mandoc-1.14.6/mansearch.h +118 -0
- data/mandoc-1.14.6/mdoc.c +433 -0
- data/mandoc-1.14.6/mdoc.h +158 -0
- data/mandoc-1.14.6/mdoc_argv.c +682 -0
- data/mandoc-1.14.6/mdoc_html.c +1762 -0
- data/mandoc-1.14.6/mdoc_macro.c +1600 -0
- data/mandoc-1.14.6/mdoc_man.c +1850 -0
- data/mandoc-1.14.6/mdoc_markdown.c +1610 -0
- data/mandoc-1.14.6/mdoc_state.c +256 -0
- data/mandoc-1.14.6/mdoc_term.c +1964 -0
- data/mandoc-1.14.6/mdoc_validate.c +3062 -0
- data/mandoc-1.14.6/msec.c +37 -0
- data/mandoc-1.14.6/out.c +544 -0
- data/mandoc-1.14.6/out.h +70 -0
- data/mandoc-1.14.6/preconv.c +179 -0
- data/mandoc-1.14.6/read.c +732 -0
- data/mandoc-1.14.6/roff.c +4390 -0
- data/mandoc-1.14.6/roff.h +561 -0
- data/mandoc-1.14.6/roff_html.c +119 -0
- data/mandoc-1.14.6/roff_int.h +94 -0
- data/mandoc-1.14.6/roff_term.c +266 -0
- data/mandoc-1.14.6/roff_validate.c +151 -0
- data/mandoc-1.14.6/soelim.c +182 -0
- data/mandoc-1.14.6/st.c +82 -0
- data/mandoc-1.14.6/tag.c +327 -0
- data/mandoc-1.14.6/tag.h +35 -0
- data/mandoc-1.14.6/tbl.c +183 -0
- data/mandoc-1.14.6/tbl.h +121 -0
- data/mandoc-1.14.6/tbl_data.c +323 -0
- data/mandoc-1.14.6/tbl_html.c +293 -0
- data/mandoc-1.14.6/tbl_int.h +47 -0
- data/mandoc-1.14.6/tbl_layout.c +376 -0
- data/mandoc-1.14.6/tbl_opts.c +173 -0
- data/mandoc-1.14.6/tbl_parse.h +30 -0
- data/mandoc-1.14.6/tbl_term.c +948 -0
- data/mandoc-1.14.6/term.c +1113 -0
- data/mandoc-1.14.6/term.h +158 -0
- data/mandoc-1.14.6/term_ascii.c +424 -0
- data/mandoc-1.14.6/term_ps.c +1362 -0
- data/mandoc-1.14.6/term_tab.c +130 -0
- data/mandoc-1.14.6/term_tag.c +227 -0
- data/mandoc-1.14.6/term_tag.h +34 -0
- data/mandoc-1.14.6/tree.c +536 -0
- metadata +170 -0
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
/* $Id: roff.h,v 1.74 2020/04/08 11:56:03 schwarze Exp $ */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
|
|
4
|
+
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
|
|
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 AUTHORS DISCLAIM ALL WARRANTIES
|
|
11
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
12
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS 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
|
+
* Common data types for all syntax trees and related functions.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
struct ohash;
|
|
22
|
+
struct mdoc_arg;
|
|
23
|
+
union mdoc_data;
|
|
24
|
+
struct tbl_span;
|
|
25
|
+
struct eqn_box;
|
|
26
|
+
|
|
27
|
+
enum roff_macroset {
|
|
28
|
+
MACROSET_NONE = 0,
|
|
29
|
+
MACROSET_MDOC,
|
|
30
|
+
MACROSET_MAN
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
enum roff_sec {
|
|
34
|
+
SEC_NONE = 0,
|
|
35
|
+
SEC_NAME,
|
|
36
|
+
SEC_LIBRARY,
|
|
37
|
+
SEC_SYNOPSIS,
|
|
38
|
+
SEC_DESCRIPTION,
|
|
39
|
+
SEC_CONTEXT,
|
|
40
|
+
SEC_IMPLEMENTATION, /* IMPLEMENTATION NOTES */
|
|
41
|
+
SEC_RETURN_VALUES,
|
|
42
|
+
SEC_ENVIRONMENT,
|
|
43
|
+
SEC_FILES,
|
|
44
|
+
SEC_EXIT_STATUS,
|
|
45
|
+
SEC_EXAMPLES,
|
|
46
|
+
SEC_DIAGNOSTICS,
|
|
47
|
+
SEC_COMPATIBILITY,
|
|
48
|
+
SEC_ERRORS,
|
|
49
|
+
SEC_SEE_ALSO,
|
|
50
|
+
SEC_STANDARDS,
|
|
51
|
+
SEC_HISTORY,
|
|
52
|
+
SEC_AUTHORS,
|
|
53
|
+
SEC_CAVEATS,
|
|
54
|
+
SEC_BUGS,
|
|
55
|
+
SEC_SECURITY,
|
|
56
|
+
SEC_CUSTOM,
|
|
57
|
+
SEC__MAX
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
enum roff_type {
|
|
61
|
+
ROFFT_ROOT,
|
|
62
|
+
ROFFT_BLOCK,
|
|
63
|
+
ROFFT_HEAD,
|
|
64
|
+
ROFFT_BODY,
|
|
65
|
+
ROFFT_TAIL,
|
|
66
|
+
ROFFT_ELEM,
|
|
67
|
+
ROFFT_TEXT,
|
|
68
|
+
ROFFT_COMMENT,
|
|
69
|
+
ROFFT_TBL,
|
|
70
|
+
ROFFT_EQN
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
enum roff_tok {
|
|
74
|
+
ROFF_br = 0,
|
|
75
|
+
ROFF_ce,
|
|
76
|
+
ROFF_fi,
|
|
77
|
+
ROFF_ft,
|
|
78
|
+
ROFF_ll,
|
|
79
|
+
ROFF_mc,
|
|
80
|
+
ROFF_nf,
|
|
81
|
+
ROFF_po,
|
|
82
|
+
ROFF_rj,
|
|
83
|
+
ROFF_sp,
|
|
84
|
+
ROFF_ta,
|
|
85
|
+
ROFF_ti,
|
|
86
|
+
ROFF_MAX,
|
|
87
|
+
ROFF_ab,
|
|
88
|
+
ROFF_ad,
|
|
89
|
+
ROFF_af,
|
|
90
|
+
ROFF_aln,
|
|
91
|
+
ROFF_als,
|
|
92
|
+
ROFF_am,
|
|
93
|
+
ROFF_am1,
|
|
94
|
+
ROFF_ami,
|
|
95
|
+
ROFF_ami1,
|
|
96
|
+
ROFF_as,
|
|
97
|
+
ROFF_as1,
|
|
98
|
+
ROFF_asciify,
|
|
99
|
+
ROFF_backtrace,
|
|
100
|
+
ROFF_bd,
|
|
101
|
+
ROFF_bleedat,
|
|
102
|
+
ROFF_blm,
|
|
103
|
+
ROFF_box,
|
|
104
|
+
ROFF_boxa,
|
|
105
|
+
ROFF_bp,
|
|
106
|
+
ROFF_BP,
|
|
107
|
+
ROFF_break,
|
|
108
|
+
ROFF_breakchar,
|
|
109
|
+
ROFF_brnl,
|
|
110
|
+
ROFF_brp,
|
|
111
|
+
ROFF_brpnl,
|
|
112
|
+
ROFF_c2,
|
|
113
|
+
ROFF_cc,
|
|
114
|
+
ROFF_cf,
|
|
115
|
+
ROFF_cflags,
|
|
116
|
+
ROFF_ch,
|
|
117
|
+
ROFF_char,
|
|
118
|
+
ROFF_chop,
|
|
119
|
+
ROFF_class,
|
|
120
|
+
ROFF_close,
|
|
121
|
+
ROFF_CL,
|
|
122
|
+
ROFF_color,
|
|
123
|
+
ROFF_composite,
|
|
124
|
+
ROFF_continue,
|
|
125
|
+
ROFF_cp,
|
|
126
|
+
ROFF_cropat,
|
|
127
|
+
ROFF_cs,
|
|
128
|
+
ROFF_cu,
|
|
129
|
+
ROFF_da,
|
|
130
|
+
ROFF_dch,
|
|
131
|
+
ROFF_Dd,
|
|
132
|
+
ROFF_de,
|
|
133
|
+
ROFF_de1,
|
|
134
|
+
ROFF_defcolor,
|
|
135
|
+
ROFF_dei,
|
|
136
|
+
ROFF_dei1,
|
|
137
|
+
ROFF_device,
|
|
138
|
+
ROFF_devicem,
|
|
139
|
+
ROFF_di,
|
|
140
|
+
ROFF_do,
|
|
141
|
+
ROFF_ds,
|
|
142
|
+
ROFF_ds1,
|
|
143
|
+
ROFF_dwh,
|
|
144
|
+
ROFF_dt,
|
|
145
|
+
ROFF_ec,
|
|
146
|
+
ROFF_ecr,
|
|
147
|
+
ROFF_ecs,
|
|
148
|
+
ROFF_el,
|
|
149
|
+
ROFF_em,
|
|
150
|
+
ROFF_EN,
|
|
151
|
+
ROFF_eo,
|
|
152
|
+
ROFF_EP,
|
|
153
|
+
ROFF_EQ,
|
|
154
|
+
ROFF_errprint,
|
|
155
|
+
ROFF_ev,
|
|
156
|
+
ROFF_evc,
|
|
157
|
+
ROFF_ex,
|
|
158
|
+
ROFF_fallback,
|
|
159
|
+
ROFF_fam,
|
|
160
|
+
ROFF_fc,
|
|
161
|
+
ROFF_fchar,
|
|
162
|
+
ROFF_fcolor,
|
|
163
|
+
ROFF_fdeferlig,
|
|
164
|
+
ROFF_feature,
|
|
165
|
+
ROFF_fkern,
|
|
166
|
+
ROFF_fl,
|
|
167
|
+
ROFF_flig,
|
|
168
|
+
ROFF_fp,
|
|
169
|
+
ROFF_fps,
|
|
170
|
+
ROFF_fschar,
|
|
171
|
+
ROFF_fspacewidth,
|
|
172
|
+
ROFF_fspecial,
|
|
173
|
+
ROFF_ftr,
|
|
174
|
+
ROFF_fzoom,
|
|
175
|
+
ROFF_gcolor,
|
|
176
|
+
ROFF_hc,
|
|
177
|
+
ROFF_hcode,
|
|
178
|
+
ROFF_hidechar,
|
|
179
|
+
ROFF_hla,
|
|
180
|
+
ROFF_hlm,
|
|
181
|
+
ROFF_hpf,
|
|
182
|
+
ROFF_hpfa,
|
|
183
|
+
ROFF_hpfcode,
|
|
184
|
+
ROFF_hw,
|
|
185
|
+
ROFF_hy,
|
|
186
|
+
ROFF_hylang,
|
|
187
|
+
ROFF_hylen,
|
|
188
|
+
ROFF_hym,
|
|
189
|
+
ROFF_hypp,
|
|
190
|
+
ROFF_hys,
|
|
191
|
+
ROFF_ie,
|
|
192
|
+
ROFF_if,
|
|
193
|
+
ROFF_ig,
|
|
194
|
+
/* MAN_in; ignored in mdoc(7) */
|
|
195
|
+
ROFF_index,
|
|
196
|
+
ROFF_it,
|
|
197
|
+
ROFF_itc,
|
|
198
|
+
ROFF_IX,
|
|
199
|
+
ROFF_kern,
|
|
200
|
+
ROFF_kernafter,
|
|
201
|
+
ROFF_kernbefore,
|
|
202
|
+
ROFF_kernpair,
|
|
203
|
+
ROFF_lc,
|
|
204
|
+
ROFF_lc_ctype,
|
|
205
|
+
ROFF_lds,
|
|
206
|
+
ROFF_length,
|
|
207
|
+
ROFF_letadj,
|
|
208
|
+
ROFF_lf,
|
|
209
|
+
ROFF_lg,
|
|
210
|
+
ROFF_lhang,
|
|
211
|
+
ROFF_linetabs,
|
|
212
|
+
ROFF_lnr,
|
|
213
|
+
ROFF_lnrf,
|
|
214
|
+
ROFF_lpfx,
|
|
215
|
+
ROFF_ls,
|
|
216
|
+
ROFF_lsm,
|
|
217
|
+
ROFF_lt,
|
|
218
|
+
ROFF_mediasize,
|
|
219
|
+
ROFF_minss,
|
|
220
|
+
ROFF_mk,
|
|
221
|
+
ROFF_mso,
|
|
222
|
+
ROFF_na,
|
|
223
|
+
ROFF_ne,
|
|
224
|
+
ROFF_nh,
|
|
225
|
+
ROFF_nhychar,
|
|
226
|
+
ROFF_nm,
|
|
227
|
+
ROFF_nn,
|
|
228
|
+
ROFF_nop,
|
|
229
|
+
ROFF_nr,
|
|
230
|
+
ROFF_nrf,
|
|
231
|
+
ROFF_nroff,
|
|
232
|
+
ROFF_ns,
|
|
233
|
+
ROFF_nx,
|
|
234
|
+
ROFF_open,
|
|
235
|
+
ROFF_opena,
|
|
236
|
+
ROFF_os,
|
|
237
|
+
ROFF_output,
|
|
238
|
+
ROFF_padj,
|
|
239
|
+
ROFF_papersize,
|
|
240
|
+
ROFF_pc,
|
|
241
|
+
ROFF_pev,
|
|
242
|
+
ROFF_pi,
|
|
243
|
+
ROFF_PI,
|
|
244
|
+
ROFF_pl,
|
|
245
|
+
ROFF_pm,
|
|
246
|
+
ROFF_pn,
|
|
247
|
+
ROFF_pnr,
|
|
248
|
+
ROFF_ps,
|
|
249
|
+
ROFF_psbb,
|
|
250
|
+
ROFF_pshape,
|
|
251
|
+
ROFF_pso,
|
|
252
|
+
ROFF_ptr,
|
|
253
|
+
ROFF_pvs,
|
|
254
|
+
ROFF_rchar,
|
|
255
|
+
ROFF_rd,
|
|
256
|
+
ROFF_recursionlimit,
|
|
257
|
+
ROFF_return,
|
|
258
|
+
ROFF_rfschar,
|
|
259
|
+
ROFF_rhang,
|
|
260
|
+
ROFF_rm,
|
|
261
|
+
ROFF_rn,
|
|
262
|
+
ROFF_rnn,
|
|
263
|
+
ROFF_rr,
|
|
264
|
+
ROFF_rs,
|
|
265
|
+
ROFF_rt,
|
|
266
|
+
ROFF_schar,
|
|
267
|
+
ROFF_sentchar,
|
|
268
|
+
ROFF_shc,
|
|
269
|
+
ROFF_shift,
|
|
270
|
+
ROFF_sizes,
|
|
271
|
+
ROFF_so,
|
|
272
|
+
ROFF_spacewidth,
|
|
273
|
+
ROFF_special,
|
|
274
|
+
ROFF_spreadwarn,
|
|
275
|
+
ROFF_ss,
|
|
276
|
+
ROFF_sty,
|
|
277
|
+
ROFF_substring,
|
|
278
|
+
ROFF_sv,
|
|
279
|
+
ROFF_sy,
|
|
280
|
+
ROFF_T_,
|
|
281
|
+
ROFF_tc,
|
|
282
|
+
ROFF_TE,
|
|
283
|
+
ROFF_TH,
|
|
284
|
+
ROFF_tkf,
|
|
285
|
+
ROFF_tl,
|
|
286
|
+
ROFF_tm,
|
|
287
|
+
ROFF_tm1,
|
|
288
|
+
ROFF_tmc,
|
|
289
|
+
ROFF_tr,
|
|
290
|
+
ROFF_track,
|
|
291
|
+
ROFF_transchar,
|
|
292
|
+
ROFF_trf,
|
|
293
|
+
ROFF_trimat,
|
|
294
|
+
ROFF_trin,
|
|
295
|
+
ROFF_trnt,
|
|
296
|
+
ROFF_troff,
|
|
297
|
+
ROFF_TS,
|
|
298
|
+
ROFF_uf,
|
|
299
|
+
ROFF_ul,
|
|
300
|
+
ROFF_unformat,
|
|
301
|
+
ROFF_unwatch,
|
|
302
|
+
ROFF_unwatchn,
|
|
303
|
+
ROFF_vpt,
|
|
304
|
+
ROFF_vs,
|
|
305
|
+
ROFF_warn,
|
|
306
|
+
ROFF_warnscale,
|
|
307
|
+
ROFF_watch,
|
|
308
|
+
ROFF_watchlength,
|
|
309
|
+
ROFF_watchn,
|
|
310
|
+
ROFF_wh,
|
|
311
|
+
ROFF_while,
|
|
312
|
+
ROFF_write,
|
|
313
|
+
ROFF_writec,
|
|
314
|
+
ROFF_writem,
|
|
315
|
+
ROFF_xflag,
|
|
316
|
+
ROFF_cblock,
|
|
317
|
+
ROFF_RENAMED,
|
|
318
|
+
ROFF_USERDEF,
|
|
319
|
+
TOKEN_NONE,
|
|
320
|
+
MDOC_Dd,
|
|
321
|
+
MDOC_Dt,
|
|
322
|
+
MDOC_Os,
|
|
323
|
+
MDOC_Sh,
|
|
324
|
+
MDOC_Ss,
|
|
325
|
+
MDOC_Pp,
|
|
326
|
+
MDOC_D1,
|
|
327
|
+
MDOC_Dl,
|
|
328
|
+
MDOC_B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DOC__C,
|
|
434
|
+
MDOC_Es,
|
|
435
|
+
MDOC_En,
|
|
436
|
+
MDOC_Dx,
|
|
437
|
+
MDOC__Q,
|
|
438
|
+
MDOC__U,
|
|
439
|
+
MDOC_Ta,
|
|
440
|
+
MDOC_Tg,
|
|
441
|
+
MDOC_MAX,
|
|
442
|
+
MAN_TH,
|
|
443
|
+
MAN_SH,
|
|
444
|
+
MAN_SS,
|
|
445
|
+
MAN_TP,
|
|
446
|
+
MAN_TQ,
|
|
447
|
+
MAN_LP,
|
|
448
|
+
MAN_PP,
|
|
449
|
+
MAN_P,
|
|
450
|
+
MAN_IP,
|
|
451
|
+
MAN_HP,
|
|
452
|
+
MAN_SM,
|
|
453
|
+
MAN_SB,
|
|
454
|
+
MAN_BI,
|
|
455
|
+
MAN_IB,
|
|
456
|
+
MAN_BR,
|
|
457
|
+
MAN_RB,
|
|
458
|
+
MAN_R,
|
|
459
|
+
MAN_B,
|
|
460
|
+
MAN_I,
|
|
461
|
+
MAN_IR,
|
|
462
|
+
MAN_RI,
|
|
463
|
+
MAN_RE,
|
|
464
|
+
MAN_RS,
|
|
465
|
+
MAN_DT,
|
|
466
|
+
MAN_UC,
|
|
467
|
+
MAN_PD,
|
|
468
|
+
MAN_AT,
|
|
469
|
+
MAN_in,
|
|
470
|
+
MAN_SY,
|
|
471
|
+
MAN_YS,
|
|
472
|
+
MAN_OP,
|
|
473
|
+
MAN_EX,
|
|
474
|
+
MAN_EE,
|
|
475
|
+
MAN_UR,
|
|
476
|
+
MAN_UE,
|
|
477
|
+
MAN_MT,
|
|
478
|
+
MAN_ME,
|
|
479
|
+
MAN_MAX
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
/*
|
|
483
|
+
* Indicates that a BODY's formatting has ended, but
|
|
484
|
+
* the scope is still open. Used for badly nested blocks.
|
|
485
|
+
*/
|
|
486
|
+
enum mdoc_endbody {
|
|
487
|
+
ENDBODY_NOT = 0,
|
|
488
|
+
ENDBODY_SPACE /* Is broken: append a space. */
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
enum mandoc_os {
|
|
492
|
+
MANDOC_OS_OTHER = 0,
|
|
493
|
+
MANDOC_OS_NETBSD,
|
|
494
|
+
MANDOC_OS_OPENBSD
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
struct roff_node {
|
|
498
|
+
struct roff_node *parent; /* Parent AST node. */
|
|
499
|
+
struct roff_node *child; /* First child AST node. */
|
|
500
|
+
struct roff_node *last; /* Last child AST node. */
|
|
501
|
+
struct roff_node *next; /* Sibling AST node. */
|
|
502
|
+
struct roff_node *prev; /* Prior sibling AST node. */
|
|
503
|
+
struct roff_node *head; /* BLOCK */
|
|
504
|
+
struct roff_node *body; /* BLOCK/ENDBODY */
|
|
505
|
+
struct roff_node *tail; /* BLOCK */
|
|
506
|
+
struct mdoc_arg *args; /* BLOCK/ELEM */
|
|
507
|
+
union mdoc_data *norm; /* Normalized arguments. */
|
|
508
|
+
char *string; /* TEXT */
|
|
509
|
+
char *tag; /* For less(1) :t and HTML id=. */
|
|
510
|
+
struct tbl_span *span; /* TBL */
|
|
511
|
+
struct eqn_box *eqn; /* EQN */
|
|
512
|
+
int line; /* Input file line number. */
|
|
513
|
+
int pos; /* Input file column number. */
|
|
514
|
+
int flags;
|
|
515
|
+
#define NODE_VALID (1 << 0) /* Has been validated. */
|
|
516
|
+
#define NODE_ENDED (1 << 1) /* Gone past body end mark. */
|
|
517
|
+
#define NODE_BROKEN (1 << 2) /* Must validate parent when ending. */
|
|
518
|
+
#define NODE_LINE (1 << 3) /* First macro/text on line. */
|
|
519
|
+
#define NODE_DELIMO (1 << 4)
|
|
520
|
+
#define NODE_DELIMC (1 << 5)
|
|
521
|
+
#define NODE_EOS (1 << 6) /* At sentence boundary. */
|
|
522
|
+
#define NODE_SYNPRETTY (1 << 7) /* SYNOPSIS-style formatting. */
|
|
523
|
+
#define NODE_NOFILL (1 << 8) /* Fill mode switched off. */
|
|
524
|
+
#define NODE_NOSRC (1 << 9) /* Generated node, not in input file. */
|
|
525
|
+
#define NODE_NOPRT (1 << 10) /* Shall not print anything. */
|
|
526
|
+
#define NODE_ID (1 << 11) /* Target for deep linking. */
|
|
527
|
+
#define NODE_HREF (1 << 12) /* Link to another place in this page. */
|
|
528
|
+
int prev_font; /* Before entering this node. */
|
|
529
|
+
int aux; /* Decoded node data, type-dependent. */
|
|
530
|
+
enum roff_tok tok; /* Request or macro ID. */
|
|
531
|
+
enum roff_type type; /* AST node type. */
|
|
532
|
+
enum roff_sec sec; /* Current named section. */
|
|
533
|
+
enum mdoc_endbody end; /* BODY */
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
struct roff_meta {
|
|
537
|
+
struct roff_node *first; /* The first node parsed. */
|
|
538
|
+
char *msec; /* Manual section, usually a digit. */
|
|
539
|
+
char *vol; /* Manual volume title. */
|
|
540
|
+
char *os; /* Operating system. */
|
|
541
|
+
char *arch; /* Machine architecture. */
|
|
542
|
+
char *title; /* Manual title, usually CAPS. */
|
|
543
|
+
char *name; /* Leading manual name. */
|
|
544
|
+
char *date; /* Normalized date. */
|
|
545
|
+
char *sodest; /* .so target file name or NULL. */
|
|
546
|
+
int hasbody; /* Document is not empty. */
|
|
547
|
+
int rcsids; /* Bits indexed by enum mandoc_os. */
|
|
548
|
+
enum mandoc_os os_e; /* Operating system. */
|
|
549
|
+
enum roff_macroset macroset; /* Kind of high-level macros used. */
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
extern const char *const *roff_name;
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
int arch_valid(const char *, enum mandoc_os);
|
|
556
|
+
void deroff(char **, const struct roff_node *);
|
|
557
|
+
struct roff_node *roff_node_child(struct roff_node *);
|
|
558
|
+
struct roff_node *roff_node_next(struct roff_node *);
|
|
559
|
+
struct roff_node *roff_node_prev(struct roff_node *);
|
|
560
|
+
int roff_node_transparent(struct roff_node *);
|
|
561
|
+
int roff_tok_transparent(enum roff_tok);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* $Id: roff_html.c,v 1.21 2020/06/22 19:20:40 schwarze Exp $ */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
|
|
4
|
+
* Copyright (c) 2014, 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.
|
|
17
|
+
*/
|
|
18
|
+
#include "config.h"
|
|
19
|
+
|
|
20
|
+
#include <sys/types.h>
|
|
21
|
+
|
|
22
|
+
#include <assert.h>
|
|
23
|
+
#include <stdio.h>
|
|
24
|
+
#include <string.h>
|
|
25
|
+
|
|
26
|
+
#include "mandoc.h"
|
|
27
|
+
#include "roff.h"
|
|
28
|
+
#include "out.h"
|
|
29
|
+
#include "html.h"
|
|
30
|
+
|
|
31
|
+
#define ROFF_HTML_ARGS struct html *h, const struct roff_node *n
|
|
32
|
+
|
|
33
|
+
typedef void (*roff_html_pre_fp)(ROFF_HTML_ARGS);
|
|
34
|
+
|
|
35
|
+
static void roff_html_pre_br(ROFF_HTML_ARGS);
|
|
36
|
+
static void roff_html_pre_ce(ROFF_HTML_ARGS);
|
|
37
|
+
static void roff_html_pre_fi(ROFF_HTML_ARGS);
|
|
38
|
+
static void roff_html_pre_ft(ROFF_HTML_ARGS);
|
|
39
|
+
static void roff_html_pre_nf(ROFF_HTML_ARGS);
|
|
40
|
+
static void roff_html_pre_sp(ROFF_HTML_ARGS);
|
|
41
|
+
|
|
42
|
+
static const roff_html_pre_fp roff_html_pre_acts[ROFF_MAX] = {
|
|
43
|
+
roff_html_pre_br, /* br */
|
|
44
|
+
roff_html_pre_ce, /* ce */
|
|
45
|
+
roff_html_pre_fi, /* fi */
|
|
46
|
+
roff_html_pre_ft, /* ft */
|
|
47
|
+
NULL, /* ll */
|
|
48
|
+
NULL, /* mc */
|
|
49
|
+
roff_html_pre_nf, /* nf */
|
|
50
|
+
NULL, /* po */
|
|
51
|
+
roff_html_pre_ce, /* rj */
|
|
52
|
+
roff_html_pre_sp, /* sp */
|
|
53
|
+
NULL, /* ta */
|
|
54
|
+
NULL, /* ti */
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
void
|
|
59
|
+
roff_html_pre(struct html *h, const struct roff_node *n)
|
|
60
|
+
{
|
|
61
|
+
assert(n->tok < ROFF_MAX);
|
|
62
|
+
if (roff_html_pre_acts[n->tok] != NULL)
|
|
63
|
+
(*roff_html_pre_acts[n->tok])(h, n);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static void
|
|
67
|
+
roff_html_pre_br(ROFF_HTML_ARGS)
|
|
68
|
+
{
|
|
69
|
+
print_otag(h, TAG_BR, "");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static void
|
|
73
|
+
roff_html_pre_ce(ROFF_HTML_ARGS)
|
|
74
|
+
{
|
|
75
|
+
for (n = n->child->next; n != NULL; n = n->next) {
|
|
76
|
+
if (n->type == ROFFT_TEXT) {
|
|
77
|
+
if (n->flags & NODE_LINE)
|
|
78
|
+
roff_html_pre_br(h, n);
|
|
79
|
+
print_text(h, n->string);
|
|
80
|
+
} else
|
|
81
|
+
roff_html_pre(h, n);
|
|
82
|
+
}
|
|
83
|
+
roff_html_pre_br(h, n);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static void
|
|
87
|
+
roff_html_pre_fi(ROFF_HTML_ARGS)
|
|
88
|
+
{
|
|
89
|
+
if (html_fillmode(h, TOKEN_NONE) == ROFF_fi)
|
|
90
|
+
print_otag(h, TAG_BR, "");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static void
|
|
94
|
+
roff_html_pre_ft(ROFF_HTML_ARGS)
|
|
95
|
+
{
|
|
96
|
+
const char *cp;
|
|
97
|
+
|
|
98
|
+
cp = n->child->string;
|
|
99
|
+
html_setfont(h, mandoc_font(cp, (int)strlen(cp)));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static void
|
|
103
|
+
roff_html_pre_nf(ROFF_HTML_ARGS)
|
|
104
|
+
{
|
|
105
|
+
if (html_fillmode(h, TOKEN_NONE) == ROFF_nf)
|
|
106
|
+
print_otag(h, TAG_BR, "");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static void
|
|
110
|
+
roff_html_pre_sp(ROFF_HTML_ARGS)
|
|
111
|
+
{
|
|
112
|
+
if (html_fillmode(h, TOKEN_NONE) == ROFF_nf) {
|
|
113
|
+
h->col++;
|
|
114
|
+
print_endline(h);
|
|
115
|
+
} else {
|
|
116
|
+
html_close_paragraph(h);
|
|
117
|
+
print_otag(h, TAG_P, "c", "Pp");
|
|
118
|
+
}
|
|
119
|
+
}
|