]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc_term.c
1 /* $Id: mdoc_term.c,v 1.174 2010/07/16 00:03:37 schwarze Exp $ */
3 * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
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.
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.
22 #include <sys/types.h>
42 struct termpair
*ppair
;
46 #define DECL_ARGS struct termp *p, \
47 struct termpair *pair, \
48 const struct mdoc_meta *m, \
49 const struct mdoc_node *n
52 int (*pre
)(DECL_ARGS
);
53 void (*post
)(DECL_ARGS
);
56 static size_t a2width(const struct termp
*, const char *);
57 static size_t a2height(const struct termp
*, const char *);
58 static size_t a2offs(const struct termp
*, const char *);
60 static void print_bvspace(struct termp
*,
61 const struct mdoc_node
*,
62 const struct mdoc_node
*);
63 static void print_mdoc_node(DECL_ARGS
);
64 static void print_mdoc_nodelist(DECL_ARGS
);
65 static void print_mdoc_head(struct termp
*, const void *);
66 static void print_mdoc_foot(struct termp
*, const void *);
67 static void synopsis_pre(struct termp
*,
68 const struct mdoc_node
*);
70 static void termp____post(DECL_ARGS
);
71 static void termp_an_post(DECL_ARGS
);
72 static void termp_aq_post(DECL_ARGS
);
73 static void termp_bd_post(DECL_ARGS
);
74 static void termp_bk_post(DECL_ARGS
);
75 static void termp_bl_post(DECL_ARGS
);
76 static void termp_bq_post(DECL_ARGS
);
77 static void termp_brq_post(DECL_ARGS
);
78 static void termp_bx_post(DECL_ARGS
);
79 static void termp_d1_post(DECL_ARGS
);
80 static void termp_dq_post(DECL_ARGS
);
81 static int termp_fd_pre(DECL_ARGS
);
82 static void termp_fo_post(DECL_ARGS
);
83 static void termp_in_post(DECL_ARGS
);
84 static void termp_it_post(DECL_ARGS
);
85 static void termp_lb_post(DECL_ARGS
);
86 static void termp_nm_post(DECL_ARGS
);
87 static void termp_op_post(DECL_ARGS
);
88 static void termp_pf_post(DECL_ARGS
);
89 static void termp_pq_post(DECL_ARGS
);
90 static void termp_qq_post(DECL_ARGS
);
91 static void termp_sh_post(DECL_ARGS
);
92 static void termp_sq_post(DECL_ARGS
);
93 static void termp_ss_post(DECL_ARGS
);
95 static int termp_an_pre(DECL_ARGS
);
96 static int termp_ap_pre(DECL_ARGS
);
97 static int termp_aq_pre(DECL_ARGS
);
98 static int termp_bd_pre(DECL_ARGS
);
99 static int termp_bf_pre(DECL_ARGS
);
100 static int termp_bk_pre(DECL_ARGS
);
101 static int termp_bl_pre(DECL_ARGS
);
102 static int termp_bold_pre(DECL_ARGS
);
103 static int termp_bq_pre(DECL_ARGS
);
104 static int termp_brq_pre(DECL_ARGS
);
105 static int termp_bt_pre(DECL_ARGS
);
106 static int termp_cd_pre(DECL_ARGS
);
107 static int termp_d1_pre(DECL_ARGS
);
108 static int termp_dq_pre(DECL_ARGS
);
109 static int termp_ex_pre(DECL_ARGS
);
110 static int termp_fa_pre(DECL_ARGS
);
111 static int termp_fl_pre(DECL_ARGS
);
112 static int termp_fn_pre(DECL_ARGS
);
113 static int termp_fo_pre(DECL_ARGS
);
114 static int termp_ft_pre(DECL_ARGS
);
115 static int termp_in_pre(DECL_ARGS
);
116 static int termp_it_pre(DECL_ARGS
);
117 static int termp_li_pre(DECL_ARGS
);
118 static int termp_lk_pre(DECL_ARGS
);
119 static int termp_nd_pre(DECL_ARGS
);
120 static int termp_nm_pre(DECL_ARGS
);
121 static int termp_ns_pre(DECL_ARGS
);
122 static int termp_op_pre(DECL_ARGS
);
123 static int termp_pf_pre(DECL_ARGS
);
124 static int termp_pq_pre(DECL_ARGS
);
125 static int termp_qq_pre(DECL_ARGS
);
126 static int termp_rs_pre(DECL_ARGS
);
127 static int termp_rv_pre(DECL_ARGS
);
128 static int termp_sh_pre(DECL_ARGS
);
129 static int termp_sm_pre(DECL_ARGS
);
130 static int termp_sp_pre(DECL_ARGS
);
131 static int termp_sq_pre(DECL_ARGS
);
132 static int termp_ss_pre(DECL_ARGS
);
133 static int termp_under_pre(DECL_ARGS
);
134 static int termp_ud_pre(DECL_ARGS
);
135 static int termp_vt_pre(DECL_ARGS
);
136 static int termp_xr_pre(DECL_ARGS
);
137 static int termp_xx_pre(DECL_ARGS
);
139 static const struct termact termacts
[MDOC_MAX
] = {
140 { termp_ap_pre
, NULL
}, /* Ap */
141 { NULL
, NULL
}, /* Dd */
142 { NULL
, NULL
}, /* Dt */
143 { NULL
, NULL
}, /* Os */
144 { termp_sh_pre
, termp_sh_post
}, /* Sh */
145 { termp_ss_pre
, termp_ss_post
}, /* Ss */
146 { termp_sp_pre
, NULL
}, /* Pp */
147 { termp_d1_pre
, termp_d1_post
}, /* D1 */
148 { termp_d1_pre
, termp_d1_post
}, /* Dl */
149 { termp_bd_pre
, termp_bd_post
}, /* Bd */
150 { NULL
, NULL
}, /* Ed */
151 { termp_bl_pre
, termp_bl_post
}, /* Bl */
152 { NULL
, NULL
}, /* El */
153 { termp_it_pre
, termp_it_post
}, /* It */
154 { NULL
, NULL
}, /* Ad */
155 { termp_an_pre
, termp_an_post
}, /* An */
156 { termp_under_pre
, NULL
}, /* Ar */
157 { termp_cd_pre
, NULL
}, /* Cd */
158 { termp_bold_pre
, NULL
}, /* Cm */
159 { NULL
, NULL
}, /* Dv */
160 { NULL
, NULL
}, /* Er */
161 { NULL
, NULL
}, /* Ev */
162 { termp_ex_pre
, NULL
}, /* Ex */
163 { termp_fa_pre
, NULL
}, /* Fa */
164 { termp_fd_pre
, NULL
}, /* Fd */
165 { termp_fl_pre
, NULL
}, /* Fl */
166 { termp_fn_pre
, NULL
}, /* Fn */
167 { termp_ft_pre
, NULL
}, /* Ft */
168 { termp_bold_pre
, NULL
}, /* Ic */
169 { termp_in_pre
, termp_in_post
}, /* In */
170 { termp_li_pre
, NULL
}, /* Li */
171 { termp_nd_pre
, NULL
}, /* Nd */
172 { termp_nm_pre
, termp_nm_post
}, /* Nm */
173 { termp_op_pre
, termp_op_post
}, /* Op */
174 { NULL
, NULL
}, /* Ot */
175 { termp_under_pre
, NULL
}, /* Pa */
176 { termp_rv_pre
, NULL
}, /* Rv */
177 { NULL
, NULL
}, /* St */
178 { termp_under_pre
, NULL
}, /* Va */
179 { termp_vt_pre
, NULL
}, /* Vt */
180 { termp_xr_pre
, NULL
}, /* Xr */
181 { NULL
, termp____post
}, /* %A */
182 { termp_under_pre
, termp____post
}, /* %B */
183 { NULL
, termp____post
}, /* %D */
184 { termp_under_pre
, termp____post
}, /* %I */
185 { termp_under_pre
, termp____post
}, /* %J */
186 { NULL
, termp____post
}, /* %N */
187 { NULL
, termp____post
}, /* %O */
188 { NULL
, termp____post
}, /* %P */
189 { NULL
, termp____post
}, /* %R */
190 { termp_under_pre
, termp____post
}, /* %T */
191 { NULL
, termp____post
}, /* %V */
192 { NULL
, NULL
}, /* Ac */
193 { termp_aq_pre
, termp_aq_post
}, /* Ao */
194 { termp_aq_pre
, termp_aq_post
}, /* Aq */
195 { NULL
, NULL
}, /* At */
196 { NULL
, NULL
}, /* Bc */
197 { termp_bf_pre
, NULL
}, /* Bf */
198 { termp_bq_pre
, termp_bq_post
}, /* Bo */
199 { termp_bq_pre
, termp_bq_post
}, /* Bq */
200 { termp_xx_pre
, NULL
}, /* Bsx */
201 { NULL
, termp_bx_post
}, /* Bx */
202 { NULL
, NULL
}, /* Db */
203 { NULL
, NULL
}, /* Dc */
204 { termp_dq_pre
, termp_dq_post
}, /* Do */
205 { termp_dq_pre
, termp_dq_post
}, /* Dq */
206 { NULL
, NULL
}, /* Ec */ /* FIXME: no space */
207 { NULL
, NULL
}, /* Ef */
208 { termp_under_pre
, NULL
}, /* Em */
209 { NULL
, NULL
}, /* Eo */
210 { termp_xx_pre
, NULL
}, /* Fx */
211 { termp_bold_pre
, NULL
}, /* Ms */ /* FIXME: convert to symbol? */
212 { NULL
, NULL
}, /* No */
213 { termp_ns_pre
, NULL
}, /* Ns */
214 { termp_xx_pre
, NULL
}, /* Nx */
215 { termp_xx_pre
, NULL
}, /* Ox */
216 { NULL
, NULL
}, /* Pc */
217 { termp_pf_pre
, termp_pf_post
}, /* Pf */
218 { termp_pq_pre
, termp_pq_post
}, /* Po */
219 { termp_pq_pre
, termp_pq_post
}, /* Pq */
220 { NULL
, NULL
}, /* Qc */
221 { termp_sq_pre
, termp_sq_post
}, /* Ql */
222 { termp_qq_pre
, termp_qq_post
}, /* Qo */
223 { termp_qq_pre
, termp_qq_post
}, /* Qq */
224 { NULL
, NULL
}, /* Re */
225 { termp_rs_pre
, NULL
}, /* Rs */
226 { NULL
, NULL
}, /* Sc */
227 { termp_sq_pre
, termp_sq_post
}, /* So */
228 { termp_sq_pre
, termp_sq_post
}, /* Sq */
229 { termp_sm_pre
, NULL
}, /* Sm */
230 { termp_under_pre
, NULL
}, /* Sx */
231 { termp_bold_pre
, NULL
}, /* Sy */
232 { NULL
, NULL
}, /* Tn */
233 { termp_xx_pre
, NULL
}, /* Ux */
234 { NULL
, NULL
}, /* Xc */
235 { NULL
, NULL
}, /* Xo */
236 { termp_fo_pre
, termp_fo_post
}, /* Fo */
237 { NULL
, NULL
}, /* Fc */
238 { termp_op_pre
, termp_op_post
}, /* Oo */
239 { NULL
, NULL
}, /* Oc */
240 { termp_bk_pre
, termp_bk_post
}, /* Bk */
241 { NULL
, NULL
}, /* Ek */
242 { termp_bt_pre
, NULL
}, /* Bt */
243 { NULL
, NULL
}, /* Hf */
244 { NULL
, NULL
}, /* Fr */
245 { termp_ud_pre
, NULL
}, /* Ud */
246 { NULL
, termp_lb_post
}, /* Lb */
247 { termp_sp_pre
, NULL
}, /* Lp */
248 { termp_lk_pre
, NULL
}, /* Lk */
249 { termp_under_pre
, NULL
}, /* Mt */
250 { termp_brq_pre
, termp_brq_post
}, /* Brq */
251 { termp_brq_pre
, termp_brq_post
}, /* Bro */
252 { NULL
, NULL
}, /* Brc */
253 { NULL
, termp____post
}, /* %C */
254 { NULL
, NULL
}, /* Es */ /* TODO */
255 { NULL
, NULL
}, /* En */ /* TODO */
256 { termp_xx_pre
, NULL
}, /* Dx */
257 { NULL
, termp____post
}, /* %Q */
258 { termp_sp_pre
, NULL
}, /* br */
259 { termp_sp_pre
, NULL
}, /* sp */
260 { termp_under_pre
, termp____post
}, /* %U */
261 { NULL
, NULL
}, /* Ta */
266 terminal_mdoc(void *arg
, const struct mdoc
*mdoc
)
268 const struct mdoc_node
*n
;
269 const struct mdoc_meta
*m
;
272 p
= (struct termp
*)arg
;
275 p
->maxrmargin
= p
->defrmargin
;
276 p
->tabwidth
= term_len(p
, 5);
278 if (NULL
== p
->symtab
)
280 case (TERMENC_ASCII
):
281 p
->symtab
= chars_init(CHARS_ASCII
);
291 term_begin(p
, print_mdoc_head
, print_mdoc_foot
, m
);
294 print_mdoc_nodelist(p
, NULL
, m
, n
->child
);
301 print_mdoc_nodelist(DECL_ARGS
)
304 print_mdoc_node(p
, pair
, m
, n
);
306 print_mdoc_nodelist(p
, pair
, m
, n
->next
);
312 print_mdoc_node(DECL_ARGS
)
316 struct termpair npair
;
317 size_t offset
, rmargin
;
321 rmargin
= p
->rmargin
;
322 font
= term_fontq(p
);
324 memset(&npair
, 0, sizeof(struct termpair
));
327 if (MDOC_TEXT
== n
->type
)
328 term_word(p
, n
->string
);
329 else if (termacts
[n
->tok
].pre
&& ENDBODY_NOT
== n
->end
)
330 chld
= (*termacts
[n
->tok
].pre
)(p
, &npair
, m
, n
);
333 * Keeps only work until the end of a line. If a keep was
334 * invoked in a prior line, revert it to PREKEEP.
337 if (TERMP_KEEP
& p
->flags
) {
338 if (n
->prev
&& n
->prev
->line
!= n
->line
) {
339 p
->flags
&= ~TERMP_KEEP
;
340 p
->flags
|= TERMP_PREKEEP
;
341 } else if (NULL
== n
->prev
) {
342 if (n
->parent
&& n
->parent
->line
!= n
->line
) {
343 p
->flags
&= ~TERMP_KEEP
;
344 p
->flags
|= TERMP_PREKEEP
;
349 if (chld
&& n
->child
)
350 print_mdoc_nodelist(p
, &npair
, m
, n
->child
);
352 term_fontpopq(p
, font
);
354 if (MDOC_TEXT
!= n
->type
&& termacts
[n
->tok
].post
&&
355 ! (MDOC_ENDED
& n
->flags
)) {
356 (void)(*termacts
[n
->tok
].post
)(p
, &npair
, m
, n
);
359 * Explicit end tokens not only call the post
360 * handler, but also tell the respective block
361 * that it must not call the post handler again.
363 if (ENDBODY_NOT
!= n
->end
)
364 n
->pending
->flags
|= MDOC_ENDED
;
367 * End of line terminating an implicit block
368 * while an explicit block is still open.
369 * Continue the explicit block without spacing.
371 if (ENDBODY_NOSPACE
== n
->end
)
372 p
->flags
|= TERMP_NOSPACE
;
375 if (MDOC_EOS
& n
->flags
)
376 p
->flags
|= TERMP_SENTENCE
;
379 p
->rmargin
= rmargin
;
384 print_mdoc_foot(struct termp
*p
, const void *arg
)
386 char buf
[DATESIZ
], os
[BUFSIZ
];
387 const struct mdoc_meta
*m
;
389 m
= (const struct mdoc_meta
*)arg
;
391 term_fontrepl(p
, TERMFONT_NONE
);
394 * Output the footer in new-groff style, that is, three columns
395 * with the middle being the manual date and flanking columns
396 * being the operating system:
401 time2a(m
->date
, buf
, DATESIZ
);
402 strlcpy(os
, m
->os
, BUFSIZ
);
407 p
->rmargin
= (p
->maxrmargin
-
408 term_strlen(p
, buf
) + term_len(p
, 1)) / 2;
409 p
->flags
|= TERMP_NOSPACE
| TERMP_NOBREAK
;
414 p
->offset
= p
->rmargin
;
415 p
->rmargin
= p
->maxrmargin
- term_strlen(p
, os
);
416 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
421 p
->offset
= p
->rmargin
;
422 p
->rmargin
= p
->maxrmargin
;
423 p
->flags
&= ~TERMP_NOBREAK
;
424 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
430 p
->rmargin
= p
->maxrmargin
;
436 print_mdoc_head(struct termp
*p
, const void *arg
)
438 char buf
[BUFSIZ
], title
[BUFSIZ
];
439 const struct mdoc_meta
*m
;
441 m
= (const struct mdoc_meta
*)arg
;
443 p
->rmargin
= p
->maxrmargin
;
447 * The header is strange. It has three components, which are
448 * really two with the first duplicated. It goes like this:
450 * IDENTIFIER TITLE IDENTIFIER
452 * The IDENTIFIER is NAME(SECTION), which is the command-name
453 * (if given, or "unknown" if not) followed by the manual page
454 * section. These are given in `Dt'. The TITLE is a free-form
455 * string depending on the manual volume. If not specified, it
456 * switches on the manual section.
460 strlcpy(buf
, m
->vol
, BUFSIZ
);
463 strlcat(buf
, " (", BUFSIZ
);
464 strlcat(buf
, m
->arch
, BUFSIZ
);
465 strlcat(buf
, ")", BUFSIZ
);
468 snprintf(title
, BUFSIZ
, "%s(%s)", m
->title
, m
->msec
);
471 p
->rmargin
= (p
->maxrmargin
-
472 term_strlen(p
, buf
) + term_len(p
, 1)) / 2;
473 p
->flags
|= TERMP_NOBREAK
| TERMP_NOSPACE
;
478 p
->offset
= p
->rmargin
;
479 p
->rmargin
= p
->maxrmargin
- term_strlen(p
, title
);
480 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
485 p
->offset
= p
->rmargin
;
486 p
->rmargin
= p
->maxrmargin
;
487 p
->flags
&= ~TERMP_NOBREAK
;
488 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
494 p
->rmargin
= p
->maxrmargin
;
495 p
->flags
&= ~TERMP_NOSPACE
;
500 a2height(const struct termp
*p
, const char *v
)
505 if ( ! a2roffsu(v
, &su
, SCALE_VS
))
506 SCALE_VS_INIT(&su
, term_len(p
, 1));
508 return(term_vspan(p
, &su
));
513 a2width(const struct termp
*p
, const char *v
)
518 if ( ! a2roffsu(v
, &su
, SCALE_MAX
))
519 SCALE_HS_INIT(&su
, term_strlen(p
, v
));
521 return(term_hspan(p
, &su
));
526 a2offs(const struct termp
*p
, const char *v
)
532 else if (0 == strcmp(v
, "left"))
534 else if (0 == strcmp(v
, "indent"))
535 return(term_len(p
, INDENT
+ 1));
536 else if (0 == strcmp(v
, "indent-two"))
537 return(term_len(p
, (INDENT
+ 1) * 2));
538 else if ( ! a2roffsu(v
, &su
, SCALE_MAX
))
539 SCALE_HS_INIT(&su
, term_strlen(p
, v
));
541 return(term_hspan(p
, &su
));
546 * Determine how much space to print out before block elements of `It'
547 * (and thus `Bl') and `Bd'. And then go ahead and print that space,
551 print_bvspace(struct termp
*p
,
552 const struct mdoc_node
*bl
,
553 const struct mdoc_node
*n
)
555 const struct mdoc_node
*nn
;
559 if (MDOC_Bd
== bl
->tok
&& bl
->data
.Bd
->comp
)
561 if (MDOC_Bl
== bl
->tok
&& bl
->data
.Bl
->comp
)
564 /* Do not vspace directly after Ss/Sh. */
566 for (nn
= n
; nn
; nn
= nn
->parent
) {
567 if (MDOC_BLOCK
!= nn
->type
)
569 if (MDOC_Ss
== nn
->tok
)
571 if (MDOC_Sh
== nn
->tok
)
573 if (NULL
== nn
->prev
)
578 /* A `-column' does not assert vspace within the list. */
580 if (MDOC_Bl
== bl
->tok
&& LIST_column
== bl
->data
.Bl
->type
)
581 if (n
->prev
&& MDOC_It
== n
->prev
->tok
)
584 /* A `-diag' without body does not vspace. */
586 if (MDOC_Bl
== bl
->tok
&& LIST_diag
== bl
->data
.Bl
->type
)
587 if (n
->prev
&& MDOC_It
== n
->prev
->tok
) {
588 assert(n
->prev
->body
);
589 if (NULL
== n
->prev
->body
->child
)
599 termp_dq_pre(DECL_ARGS
)
602 if (MDOC_BODY
!= n
->type
)
605 term_word(p
, "\\(lq");
606 p
->flags
|= TERMP_NOSPACE
;
613 termp_dq_post(DECL_ARGS
)
616 if (MDOC_BODY
!= n
->type
)
619 p
->flags
|= TERMP_NOSPACE
;
620 term_word(p
, "\\(rq");
626 termp_it_pre(DECL_ARGS
)
628 const struct mdoc_node
*bl
, *nn
;
631 size_t width
, offset
, ncols
, dcol
;
634 if (MDOC_BLOCK
== n
->type
) {
635 print_bvspace(p
, n
->parent
->parent
, n
);
639 bl
= n
->parent
->parent
->parent
;
641 type
= bl
->data
.Bl
->type
;
644 * First calculate width and offset. This is pretty easy unless
645 * we're a -column list, in which case all prior columns must
651 if (bl
->data
.Bl
->offs
)
652 offset
= a2offs(p
, bl
->data
.Bl
->offs
);
656 if (MDOC_HEAD
== n
->type
)
660 * Imitate groff's column handling:
661 * - For each earlier column, add its width.
662 * - For less than 5 columns, add four more blanks per
664 * - For exactly 5 columns, add three more blank per
666 * - For more than 5 columns, add only one column.
668 ncols
= bl
->data
.Bl
->ncols
;
671 dcol
= ncols
< 5 ? term_len(p
, 4) :
672 ncols
== 5 ? term_len(p
, 3) : term_len(p
, 1);
675 * Calculate the offset by applying all prior MDOC_BODY,
676 * so we stop at the MDOC_HEAD (NULL == nn->prev).
679 for (i
= 0, nn
= n
->prev
;
680 nn
->prev
&& i
< (int)ncols
;
682 offset
+= dcol
+ a2width
683 (p
, bl
->data
.Bl
->cols
[i
]);
686 * When exceeding the declared number of columns, leave
687 * the remaining widths at 0. This will later be
688 * adjusted to the default width of 10, or, for the last
689 * column, stretched to the right margin.
695 * Use the declared column widths, extended as explained
696 * in the preceding paragraph.
698 width
= a2width(p
, bl
->data
.Bl
->cols
[i
]) + dcol
;
701 if (NULL
== bl
->data
.Bl
->width
)
705 * Note: buffer the width by 2, which is groff's magic
706 * number for buffering single arguments. See the above
707 * handling for column for how this changes.
709 assert(bl
->data
.Bl
->width
);
710 width
= a2width(p
, bl
->data
.Bl
->width
) + term_len(p
, 2);
715 * List-type can override the width in the case of fixed-head
716 * values (bullet, dash/hyphen, enum). Tags need a non-zero
726 if (width
< term_len(p
, 4))
727 width
= term_len(p
, 4);
730 if (width
< term_len(p
, 5))
731 width
= term_len(p
, 5);
735 width
= term_len(p
, 8);
741 width
= term_len(p
, 10);
748 * Whitespace control. Inset bodies need an initial space,
749 * while diagonal bodies need two.
752 p
->flags
|= TERMP_NOSPACE
;
756 if (MDOC_BODY
== n
->type
)
757 term_word(p
, "\\ \\ ");
760 if (MDOC_BODY
== n
->type
)
767 p
->flags
|= TERMP_NOSPACE
;
771 if (MDOC_HEAD
== n
->type
)
772 term_fontpush(p
, TERMFONT_BOLD
);
779 * Pad and break control. This is the tricky part. These flags
780 * are documented in term_flushln() in term.c. Note that we're
781 * going to unset all of these flags in termp_it_post() when we
793 if (MDOC_HEAD
== n
->type
)
794 p
->flags
|= TERMP_NOBREAK
;
796 p
->flags
|= TERMP_NOLPAD
;
799 if (MDOC_HEAD
== n
->type
)
800 p
->flags
|= TERMP_NOBREAK
;
802 p
->flags
|= TERMP_NOLPAD
;
804 if (MDOC_HEAD
!= n
->type
)
808 * This is ugly. If `-hang' is specified and the body
809 * is a `Bl' or `Bd', then we want basically to nullify
810 * the "overstep" effect in term_flushln() and treat
811 * this as a `-ohang' list instead.
813 if (n
->next
->child
&&
814 (MDOC_Bl
== n
->next
->child
->tok
||
815 MDOC_Bd
== n
->next
->child
->tok
)) {
816 p
->flags
&= ~TERMP_NOBREAK
;
817 p
->flags
&= ~TERMP_NOLPAD
;
819 p
->flags
|= TERMP_HANG
;
822 if (MDOC_HEAD
== n
->type
)
823 p
->flags
|= TERMP_NOBREAK
| TERMP_TWOSPACE
;
825 p
->flags
|= TERMP_NOLPAD
;
827 if (MDOC_HEAD
!= n
->type
)
829 if (NULL
== n
->next
|| NULL
== n
->next
->child
)
830 p
->flags
|= TERMP_DANGLE
;
833 if (MDOC_HEAD
== n
->type
)
837 p
->flags
&= ~TERMP_NOBREAK
;
839 p
->flags
|= TERMP_NOBREAK
;
842 if (MDOC_BODY
== n
->prev
->type
)
843 p
->flags
|= TERMP_NOLPAD
;
847 if (MDOC_HEAD
== n
->type
)
848 p
->flags
|= TERMP_NOBREAK
;
855 * Margin control. Set-head-width lists have their right
856 * margins shortened. The body for these lists has the offset
857 * necessarily lengthened. Everybody gets the offset.
865 * Same stipulation as above, regarding `-hang'. We
866 * don't want to recalculate rmargin and offsets when
867 * using `Bd' or `Bl' within `-hang' overstep lists.
869 if (MDOC_HEAD
== n
->type
&& n
->next
->child
&&
870 (MDOC_Bl
== n
->next
->child
->tok
||
871 MDOC_Bd
== n
->next
->child
->tok
))
884 if (MDOC_HEAD
== n
->type
)
885 p
->rmargin
= p
->offset
+ width
;
891 p
->rmargin
= p
->offset
+ width
;
893 * XXX - this behaviour is not documented: the
894 * right-most column is filled to the right margin.
896 if (MDOC_HEAD
== n
->type
)
898 if (NULL
== n
->next
&& p
->rmargin
< p
->maxrmargin
)
899 p
->rmargin
= p
->maxrmargin
;
906 * The dash, hyphen, bullet and enum lists all have a special
907 * HEAD character (temporarily bold, in some cases).
910 if (MDOC_HEAD
== n
->type
)
913 term_fontpush(p
, TERMFONT_BOLD
);
914 term_word(p
, "\\[bu]");
920 term_fontpush(p
, TERMFONT_BOLD
);
921 term_word(p
, "\\(hy");
925 (pair
->ppair
->ppair
->count
)++;
926 snprintf(buf
, sizeof(buf
), "%d.",
927 pair
->ppair
->ppair
->count
);
935 * If we're not going to process our children, indicate so here.
948 if (MDOC_HEAD
== n
->type
)
952 if (MDOC_HEAD
== n
->type
)
965 termp_it_post(DECL_ARGS
)
969 if (MDOC_BLOCK
== n
->type
)
972 type
= n
->parent
->parent
->parent
->data
.Bl
->type
;
980 if (MDOC_BODY
== n
->type
)
984 if (MDOC_BODY
== n
->type
)
993 * Now that our output is flushed, we can reset our tags. Since
994 * only `It' sets these flags, we're free to assume that nobody
995 * has munged them in the meanwhile.
998 p
->flags
&= ~TERMP_DANGLE
;
999 p
->flags
&= ~TERMP_NOBREAK
;
1000 p
->flags
&= ~TERMP_TWOSPACE
;
1001 p
->flags
&= ~TERMP_NOLPAD
;
1002 p
->flags
&= ~TERMP_HANG
;
1008 termp_nm_pre(DECL_ARGS
)
1011 if (MDOC_BLOCK
== n
->type
)
1014 if (MDOC_BODY
== n
->type
) {
1015 if (NULL
== n
->child
)
1017 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
1018 p
->offset
+= term_len(p
, 1) +
1019 (NULL
== n
->prev
->child
? term_strlen(p
, m
->name
) :
1020 MDOC_TEXT
== n
->prev
->child
->type
?
1021 term_strlen(p
, n
->prev
->child
->string
) :
1026 if (NULL
== n
->child
&& NULL
== m
->name
)
1031 if (MDOC_HEAD
== n
->type
&& n
->next
->child
) {
1032 p
->flags
|= TERMP_NOSPACE
| TERMP_NOBREAK
| TERMP_HANG
;
1033 p
->rmargin
= p
->offset
+ term_len(p
, 1) +
1034 (NULL
== n
->child
? term_strlen(p
, m
->name
) :
1035 MDOC_TEXT
== n
->child
->type
?
1036 term_strlen(p
, n
->child
->string
) :
1040 term_fontpush(p
, TERMFONT_BOLD
);
1041 if (NULL
== n
->child
)
1042 term_word(p
, m
->name
);
1049 termp_nm_post(DECL_ARGS
)
1052 if (MDOC_HEAD
== n
->type
&& n
->next
->child
) {
1054 p
->flags
&= ~(TERMP_NOBREAK
| TERMP_HANG
);
1055 } else if (MDOC_BODY
== n
->type
&& n
->child
) {
1057 p
->flags
&= ~TERMP_NOLPAD
;
1064 termp_fl_pre(DECL_ARGS
)
1067 term_fontpush(p
, TERMFONT_BOLD
);
1068 term_word(p
, "\\-");
1071 p
->flags
|= TERMP_NOSPACE
;
1072 else if (n
->next
&& n
->next
->line
== n
->line
)
1073 p
->flags
|= TERMP_NOSPACE
;
1081 termp_an_pre(DECL_ARGS
)
1084 if (NULL
== n
->child
)
1088 * If not in the AUTHORS section, `An -split' will cause
1089 * newlines to occur before the author name. If in the AUTHORS
1090 * section, by default, the first `An' invocation is nosplit,
1091 * then all subsequent ones, regardless of whether interspersed
1092 * with other macros/text, are split. -split, in this case,
1093 * will override the condition of the implied first -nosplit.
1096 if (n
->sec
== SEC_AUTHORS
) {
1097 if ( ! (TERMP_ANPREC
& p
->flags
)) {
1098 if (TERMP_SPLIT
& p
->flags
)
1102 if (TERMP_NOSPLIT
& p
->flags
)
1108 if (TERMP_SPLIT
& p
->flags
)
1117 termp_an_post(DECL_ARGS
)
1121 if (SEC_AUTHORS
== n
->sec
)
1122 p
->flags
|= TERMP_ANPREC
;
1126 if (AUTH_split
== n
->data
.An
.auth
) {
1127 p
->flags
&= ~TERMP_NOSPLIT
;
1128 p
->flags
|= TERMP_SPLIT
;
1129 } else if (AUTH_nosplit
== n
->data
.An
.auth
) {
1130 p
->flags
&= ~TERMP_SPLIT
;
1131 p
->flags
|= TERMP_NOSPLIT
;
1139 termp_ns_pre(DECL_ARGS
)
1142 p
->flags
|= TERMP_NOSPACE
;
1149 termp_rs_pre(DECL_ARGS
)
1152 if (SEC_SEE_ALSO
!= n
->sec
)
1154 if (MDOC_BLOCK
== n
->type
&& n
->prev
)
1162 termp_rv_pre(DECL_ARGS
)
1164 const struct mdoc_node
*nn
;
1167 term_word(p
, "The");
1169 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1170 term_fontpush(p
, TERMFONT_BOLD
);
1171 term_word(p
, nn
->string
);
1173 p
->flags
|= TERMP_NOSPACE
;
1174 if (nn
->next
&& NULL
== nn
->next
->next
)
1175 term_word(p
, "(), and");
1177 term_word(p
, "(),");
1182 if (n
->child
&& n
->child
->next
)
1183 term_word(p
, "functions return");
1185 term_word(p
, "function returns");
1187 term_word(p
, "the value 0 if successful; otherwise the value "
1188 "-1 is returned and the global variable");
1190 term_fontpush(p
, TERMFONT_UNDER
);
1191 term_word(p
, "errno");
1194 term_word(p
, "is set to indicate the error.");
1195 p
->flags
|= TERMP_SENTENCE
;
1203 termp_ex_pre(DECL_ARGS
)
1205 const struct mdoc_node
*nn
;
1207 term_word(p
, "The");
1209 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1210 term_fontpush(p
, TERMFONT_BOLD
);
1211 term_word(p
, nn
->string
);
1213 p
->flags
|= TERMP_NOSPACE
;
1214 if (nn
->next
&& NULL
== nn
->next
->next
)
1215 term_word(p
, ", and");
1219 p
->flags
&= ~TERMP_NOSPACE
;
1222 if (n
->child
&& n
->child
->next
)
1223 term_word(p
, "utilities exit");
1225 term_word(p
, "utility exits");
1227 term_word(p
, "0 on success, and >0 if an error occurs.");
1228 p
->flags
|= TERMP_SENTENCE
;
1236 termp_nd_pre(DECL_ARGS
)
1239 if (MDOC_BODY
!= n
->type
)
1242 #if defined(__OpenBSD__) || defined(__linux__)
1243 term_word(p
, "\\(en");
1245 term_word(p
, "\\(em");
1253 termp_bl_pre(DECL_ARGS
)
1256 return(MDOC_HEAD
!= n
->type
);
1262 termp_bl_post(DECL_ARGS
)
1265 if (MDOC_BLOCK
== n
->type
)
1272 termp_op_post(DECL_ARGS
)
1275 if (MDOC_BODY
!= n
->type
)
1277 p
->flags
|= TERMP_NOSPACE
;
1278 term_word(p
, "\\(rB");
1284 termp_xr_pre(DECL_ARGS
)
1286 const struct mdoc_node
*nn
;
1288 if (NULL
== n
->child
)
1291 assert(MDOC_TEXT
== n
->child
->type
);
1294 term_word(p
, nn
->string
);
1295 if (NULL
== (nn
= nn
->next
))
1297 p
->flags
|= TERMP_NOSPACE
;
1299 p
->flags
|= TERMP_NOSPACE
;
1300 term_word(p
, nn
->string
);
1301 p
->flags
|= TERMP_NOSPACE
;
1309 * This decides how to assert whitespace before any of the SYNOPSIS set
1310 * of macros (which, as in the case of Ft/Fo and Ft/Fn, may contain
1314 synopsis_pre(struct termp
*p
, const struct mdoc_node
*n
)
1317 * Obviously, if we're not in a SYNOPSIS or no prior macros
1318 * exist, do nothing.
1320 if (NULL
== n
->prev
|| ! (MDOC_SYNPRETTY
& n
->flags
))
1324 * If we're the second in a pair of like elements, emit our
1325 * newline and return. UNLESS we're `Fo', `Fn', `Fn', in which
1326 * case we soldier on.
1328 if (n
->prev
->tok
== n
->tok
&&
1329 MDOC_Ft
!= n
->tok
&&
1330 MDOC_Fo
!= n
->tok
&&
1331 MDOC_Fn
!= n
->tok
) {
1337 * If we're one of the SYNOPSIS set and non-like pair-wise after
1338 * another (or Fn/Fo, which we've let slip through) then assert
1339 * vertical space, else only newline and move on.
1341 switch (n
->prev
->tok
) {
1354 if (MDOC_Fn
!= n
->tok
&& MDOC_Fo
!= n
->tok
) {
1367 termp_vt_pre(DECL_ARGS
)
1370 if (MDOC_ELEM
== n
->type
) {
1372 return(termp_under_pre(p
, pair
, m
, n
));
1373 } else if (MDOC_BLOCK
== n
->type
) {
1376 } else if (MDOC_HEAD
== n
->type
)
1379 return(termp_under_pre(p
, pair
, m
, n
));
1385 termp_bold_pre(DECL_ARGS
)
1388 term_fontpush(p
, TERMFONT_BOLD
);
1395 termp_fd_pre(DECL_ARGS
)
1399 return(termp_bold_pre(p
, pair
, m
, n
));
1405 termp_sh_pre(DECL_ARGS
)
1408 /* No vspace between consecutive `Sh' calls. */
1412 if (n
->prev
&& MDOC_Sh
== n
->prev
->tok
)
1413 if (NULL
== n
->prev
->body
->child
)
1418 term_fontpush(p
, TERMFONT_BOLD
);
1421 p
->offset
= term_len(p
, INDENT
);
1432 termp_sh_post(DECL_ARGS
)
1451 termp_op_pre(DECL_ARGS
)
1456 term_word(p
, "\\(lB");
1457 p
->flags
|= TERMP_NOSPACE
;
1468 termp_bt_pre(DECL_ARGS
)
1471 term_word(p
, "is currently in beta test.");
1472 p
->flags
|= TERMP_SENTENCE
;
1479 termp_lb_post(DECL_ARGS
)
1482 if (SEC_LIBRARY
== n
->sec
&& MDOC_LINE
& n
->flags
)
1489 termp_ud_pre(DECL_ARGS
)
1492 term_word(p
, "currently under development.");
1493 p
->flags
|= TERMP_SENTENCE
;
1500 termp_d1_pre(DECL_ARGS
)
1503 if (MDOC_BLOCK
!= n
->type
)
1506 p
->offset
+= term_len(p
, (INDENT
+ 1));
1513 termp_d1_post(DECL_ARGS
)
1516 if (MDOC_BLOCK
!= n
->type
)
1524 termp_aq_pre(DECL_ARGS
)
1527 if (MDOC_BODY
!= n
->type
)
1529 term_word(p
, "\\(la");
1530 p
->flags
|= TERMP_NOSPACE
;
1537 termp_aq_post(DECL_ARGS
)
1540 if (MDOC_BODY
!= n
->type
)
1542 p
->flags
|= TERMP_NOSPACE
;
1543 term_word(p
, "\\(ra");
1549 termp_ft_pre(DECL_ARGS
)
1552 /* NB: MDOC_LINE does not effect this! */
1554 term_fontpush(p
, TERMFONT_UNDER
);
1561 termp_fn_pre(DECL_ARGS
)
1563 const struct mdoc_node
*nn
;
1567 term_fontpush(p
, TERMFONT_BOLD
);
1568 term_word(p
, n
->child
->string
);
1571 p
->flags
|= TERMP_NOSPACE
;
1574 for (nn
= n
->child
->next
; nn
; nn
= nn
->next
) {
1575 term_fontpush(p
, TERMFONT_UNDER
);
1576 term_word(p
, nn
->string
);
1585 if (MDOC_SYNPRETTY
& n
->flags
)
1594 termp_fa_pre(DECL_ARGS
)
1596 const struct mdoc_node
*nn
;
1598 if (n
->parent
->tok
!= MDOC_Fo
) {
1599 term_fontpush(p
, TERMFONT_UNDER
);
1603 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1604 term_fontpush(p
, TERMFONT_UNDER
);
1605 term_word(p
, nn
->string
);
1612 if (n
->child
&& n
->next
&& n
->next
->tok
== MDOC_Fa
)
1621 termp_bd_pre(DECL_ARGS
)
1625 const struct mdoc_node
*nn
;
1627 if (MDOC_BLOCK
== n
->type
) {
1628 print_bvspace(p
, n
, n
);
1630 } else if (MDOC_HEAD
== n
->type
)
1634 if (n
->data
.Bd
->offs
)
1635 p
->offset
+= a2offs(p
, n
->data
.Bd
->offs
);
1638 * If -ragged or -filled are specified, the block does nothing
1639 * but change the indentation. If -unfilled or -literal are
1640 * specified, text is printed exactly as entered in the display:
1641 * for macro lines, a newline is appended to the line. Blank
1642 * lines are allowed.
1645 if (DISP_literal
!= n
->data
.Bd
->type
&&
1646 DISP_unfilled
!= n
->data
.Bd
->type
)
1649 tabwidth
= p
->tabwidth
;
1650 p
->tabwidth
= term_len(p
, 8);
1652 rmax
= p
->maxrmargin
;
1653 p
->rmargin
= p
->maxrmargin
= TERM_MAXMARGIN
;
1655 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1656 p
->flags
|= TERMP_NOSPACE
;
1657 print_mdoc_node(p
, pair
, m
, nn
);
1658 if (NULL
== nn
->prev
||
1659 nn
->prev
->line
< nn
->line
||
1664 p
->tabwidth
= tabwidth
;
1666 p
->maxrmargin
= rmax
;
1673 termp_bd_post(DECL_ARGS
)
1677 if (MDOC_BODY
!= n
->type
)
1681 rmax
= p
->maxrmargin
;
1684 if (DISP_literal
== n
->data
.Bd
->type
||
1685 DISP_unfilled
== n
->data
.Bd
->type
)
1686 p
->rmargin
= p
->maxrmargin
= TERM_MAXMARGIN
;
1688 p
->flags
|= TERMP_NOSPACE
;
1692 p
->maxrmargin
= rmax
;
1698 termp_qq_pre(DECL_ARGS
)
1701 if (MDOC_BODY
!= n
->type
)
1704 p
->flags
|= TERMP_NOSPACE
;
1711 termp_qq_post(DECL_ARGS
)
1714 if (MDOC_BODY
!= n
->type
)
1716 p
->flags
|= TERMP_NOSPACE
;
1723 termp_bx_post(DECL_ARGS
)
1727 p
->flags
|= TERMP_NOSPACE
;
1728 term_word(p
, "BSD");
1734 termp_xx_pre(DECL_ARGS
)
1770 termp_sq_pre(DECL_ARGS
)
1773 if (MDOC_BODY
!= n
->type
)
1775 term_word(p
, "\\(oq");
1776 p
->flags
|= TERMP_NOSPACE
;
1783 termp_sq_post(DECL_ARGS
)
1786 if (MDOC_BODY
!= n
->type
)
1788 p
->flags
|= TERMP_NOSPACE
;
1789 term_word(p
, "\\(aq");
1795 termp_pf_pre(DECL_ARGS
)
1798 p
->flags
|= TERMP_IGNDELIM
;
1805 termp_pf_post(DECL_ARGS
)
1808 p
->flags
&= ~TERMP_IGNDELIM
;
1809 p
->flags
|= TERMP_NOSPACE
;
1815 termp_ss_pre(DECL_ARGS
)
1825 term_fontpush(p
, TERMFONT_BOLD
);
1826 p
->offset
= term_len(p
, HALFINDENT
);
1838 termp_ss_post(DECL_ARGS
)
1841 if (MDOC_HEAD
== n
->type
)
1848 termp_cd_pre(DECL_ARGS
)
1852 term_fontpush(p
, TERMFONT_BOLD
);
1859 termp_in_pre(DECL_ARGS
)
1864 if (MDOC_SYNPRETTY
& n
->flags
&& MDOC_LINE
& n
->flags
) {
1865 term_fontpush(p
, TERMFONT_BOLD
);
1866 term_word(p
, "#include");
1870 term_fontpush(p
, TERMFONT_UNDER
);
1873 p
->flags
|= TERMP_NOSPACE
;
1880 termp_in_post(DECL_ARGS
)
1883 if (MDOC_SYNPRETTY
& n
->flags
)
1884 term_fontpush(p
, TERMFONT_BOLD
);
1886 p
->flags
|= TERMP_NOSPACE
;
1889 if (MDOC_SYNPRETTY
& n
->flags
)
1896 termp_sp_pre(DECL_ARGS
)
1902 len
= n
->child
? a2height(p
, n
->child
->string
) : 1;
1914 for (i
= 0; i
< len
; i
++)
1923 termp_brq_pre(DECL_ARGS
)
1926 if (MDOC_BODY
!= n
->type
)
1928 term_word(p
, "\\(lC");
1929 p
->flags
|= TERMP_NOSPACE
;
1936 termp_brq_post(DECL_ARGS
)
1939 if (MDOC_BODY
!= n
->type
)
1941 p
->flags
|= TERMP_NOSPACE
;
1942 term_word(p
, "\\(rC");
1948 termp_bq_pre(DECL_ARGS
)
1951 if (MDOC_BODY
!= n
->type
)
1953 term_word(p
, "\\(lB");
1954 p
->flags
|= TERMP_NOSPACE
;
1961 termp_bq_post(DECL_ARGS
)
1964 if (MDOC_BODY
!= n
->type
)
1966 p
->flags
|= TERMP_NOSPACE
;
1967 term_word(p
, "\\(rB");
1973 termp_pq_pre(DECL_ARGS
)
1976 if (MDOC_BODY
!= n
->type
)
1978 term_word(p
, "\\&(");
1979 p
->flags
|= TERMP_NOSPACE
;
1986 termp_pq_post(DECL_ARGS
)
1989 if (MDOC_BODY
!= n
->type
)
1997 termp_fo_pre(DECL_ARGS
)
2000 if (MDOC_BLOCK
== n
->type
) {
2003 } else if (MDOC_BODY
== n
->type
) {
2004 p
->flags
|= TERMP_NOSPACE
;
2006 p
->flags
|= TERMP_NOSPACE
;
2010 if (NULL
== n
->child
)
2013 /* XXX: we drop non-initial arguments as per groff. */
2015 assert(n
->child
->string
);
2016 term_fontpush(p
, TERMFONT_BOLD
);
2017 term_word(p
, n
->child
->string
);
2024 termp_fo_post(DECL_ARGS
)
2027 if (MDOC_BODY
!= n
->type
)
2030 p
->flags
|= TERMP_NOSPACE
;
2033 if (MDOC_SYNPRETTY
& n
->flags
) {
2034 p
->flags
|= TERMP_NOSPACE
;
2042 termp_bf_pre(DECL_ARGS
)
2045 if (MDOC_HEAD
== n
->type
)
2047 else if (MDOC_BLOCK
!= n
->type
)
2052 if (FONT_Em
== n
->data
.Bf
->font
)
2053 term_fontpush(p
, TERMFONT_UNDER
);
2054 else if (FONT_Sy
== n
->data
.Bf
->font
)
2055 term_fontpush(p
, TERMFONT_BOLD
);
2057 term_fontpush(p
, TERMFONT_NONE
);
2065 termp_sm_pre(DECL_ARGS
)
2068 assert(n
->child
&& MDOC_TEXT
== n
->child
->type
);
2069 if (0 == strcmp("on", n
->child
->string
)) {
2071 p
->flags
&= ~TERMP_NOSPACE
;
2072 p
->flags
&= ~TERMP_NONOSPACE
;
2074 p
->flags
|= TERMP_NONOSPACE
;
2082 termp_ap_pre(DECL_ARGS
)
2085 p
->flags
|= TERMP_NOSPACE
;
2086 term_word(p
, "\\(aq");
2087 p
->flags
|= TERMP_NOSPACE
;
2094 termp____post(DECL_ARGS
)
2099 p
->flags
|= TERMP_NOSPACE
;
2100 term_word(p
, n
->next
? "," : ".");
2106 termp_li_pre(DECL_ARGS
)
2109 term_fontpush(p
, TERMFONT_NONE
);
2116 termp_lk_pre(DECL_ARGS
)
2118 const struct mdoc_node
*nn
;
2120 term_fontpush(p
, TERMFONT_UNDER
);
2123 if (NULL
== nn
->next
)
2126 term_word(p
, nn
->string
);
2129 p
->flags
|= TERMP_NOSPACE
;
2132 term_fontpush(p
, TERMFONT_BOLD
);
2133 for (nn
= nn
->next
; nn
; nn
= nn
->next
)
2134 term_word(p
, nn
->string
);
2143 termp_bk_pre(DECL_ARGS
)
2152 p
->flags
|= TERMP_PREKEEP
;
2165 termp_bk_post(DECL_ARGS
)
2168 if (MDOC_BODY
== n
->type
)
2169 p
->flags
&= ~(TERMP_KEEP
| TERMP_PREKEEP
);
2174 termp_under_pre(DECL_ARGS
)
2177 term_fontpush(p
, TERMFONT_UNDER
);