]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc_term.c
1 /* $Id: mdoc_term.c,v 1.214 2011/01/25 16:20:24 kristaps 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__t_post(DECL_ARGS
);
72 static void termp_an_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_d1_post(DECL_ARGS
);
77 static void termp_fo_post(DECL_ARGS
);
78 static void termp_in_post(DECL_ARGS
);
79 static void termp_it_post(DECL_ARGS
);
80 static void termp_lb_post(DECL_ARGS
);
81 static void termp_nm_post(DECL_ARGS
);
82 static void termp_pf_post(DECL_ARGS
);
83 static void termp_quote_post(DECL_ARGS
);
84 static void termp_sh_post(DECL_ARGS
);
85 static void termp_ss_post(DECL_ARGS
);
87 static int termp__a_pre(DECL_ARGS
);
88 static int termp__t_pre(DECL_ARGS
);
89 static int termp_an_pre(DECL_ARGS
);
90 static int termp_ap_pre(DECL_ARGS
);
91 static int termp_bd_pre(DECL_ARGS
);
92 static int termp_bf_pre(DECL_ARGS
);
93 static int termp_bk_pre(DECL_ARGS
);
94 static int termp_bl_pre(DECL_ARGS
);
95 static int termp_bold_pre(DECL_ARGS
);
96 static int termp_bt_pre(DECL_ARGS
);
97 static int termp_bx_pre(DECL_ARGS
);
98 static int termp_cd_pre(DECL_ARGS
);
99 static int termp_d1_pre(DECL_ARGS
);
100 static int termp_ex_pre(DECL_ARGS
);
101 static int termp_fa_pre(DECL_ARGS
);
102 static int termp_fd_pre(DECL_ARGS
);
103 static int termp_fl_pre(DECL_ARGS
);
104 static int termp_fn_pre(DECL_ARGS
);
105 static int termp_fo_pre(DECL_ARGS
);
106 static int termp_ft_pre(DECL_ARGS
);
107 static int termp_igndelim_pre(DECL_ARGS
);
108 static int termp_in_pre(DECL_ARGS
);
109 static int termp_it_pre(DECL_ARGS
);
110 static int termp_li_pre(DECL_ARGS
);
111 static int termp_lk_pre(DECL_ARGS
);
112 static int termp_nd_pre(DECL_ARGS
);
113 static int termp_nm_pre(DECL_ARGS
);
114 static int termp_ns_pre(DECL_ARGS
);
115 static int termp_quote_pre(DECL_ARGS
);
116 static int termp_rs_pre(DECL_ARGS
);
117 static int termp_rv_pre(DECL_ARGS
);
118 static int termp_sh_pre(DECL_ARGS
);
119 static int termp_sm_pre(DECL_ARGS
);
120 static int termp_sp_pre(DECL_ARGS
);
121 static int termp_ss_pre(DECL_ARGS
);
122 static int termp_under_pre(DECL_ARGS
);
123 static int termp_ud_pre(DECL_ARGS
);
124 static int termp_vt_pre(DECL_ARGS
);
125 static int termp_xr_pre(DECL_ARGS
);
126 static int termp_xx_pre(DECL_ARGS
);
128 static const struct termact termacts
[MDOC_MAX
] = {
129 { termp_ap_pre
, NULL
}, /* Ap */
130 { NULL
, NULL
}, /* Dd */
131 { NULL
, NULL
}, /* Dt */
132 { NULL
, NULL
}, /* Os */
133 { termp_sh_pre
, termp_sh_post
}, /* Sh */
134 { termp_ss_pre
, termp_ss_post
}, /* Ss */
135 { termp_sp_pre
, NULL
}, /* Pp */
136 { termp_d1_pre
, termp_d1_post
}, /* D1 */
137 { termp_d1_pre
, termp_d1_post
}, /* Dl */
138 { termp_bd_pre
, termp_bd_post
}, /* Bd */
139 { NULL
, NULL
}, /* Ed */
140 { termp_bl_pre
, termp_bl_post
}, /* Bl */
141 { NULL
, NULL
}, /* El */
142 { termp_it_pre
, termp_it_post
}, /* It */
143 { termp_under_pre
, NULL
}, /* Ad */
144 { termp_an_pre
, termp_an_post
}, /* An */
145 { termp_under_pre
, NULL
}, /* Ar */
146 { termp_cd_pre
, NULL
}, /* Cd */
147 { termp_bold_pre
, NULL
}, /* Cm */
148 { NULL
, NULL
}, /* Dv */
149 { NULL
, NULL
}, /* Er */
150 { NULL
, NULL
}, /* Ev */
151 { termp_ex_pre
, NULL
}, /* Ex */
152 { termp_fa_pre
, NULL
}, /* Fa */
153 { termp_fd_pre
, NULL
}, /* Fd */
154 { termp_fl_pre
, NULL
}, /* Fl */
155 { termp_fn_pre
, NULL
}, /* Fn */
156 { termp_ft_pre
, NULL
}, /* Ft */
157 { termp_bold_pre
, NULL
}, /* Ic */
158 { termp_in_pre
, termp_in_post
}, /* In */
159 { termp_li_pre
, NULL
}, /* Li */
160 { termp_nd_pre
, NULL
}, /* Nd */
161 { termp_nm_pre
, termp_nm_post
}, /* Nm */
162 { termp_quote_pre
, termp_quote_post
}, /* Op */
163 { NULL
, NULL
}, /* Ot */
164 { termp_under_pre
, NULL
}, /* Pa */
165 { termp_rv_pre
, NULL
}, /* Rv */
166 { NULL
, NULL
}, /* St */
167 { termp_under_pre
, NULL
}, /* Va */
168 { termp_vt_pre
, NULL
}, /* Vt */
169 { termp_xr_pre
, NULL
}, /* Xr */
170 { termp__a_pre
, termp____post
}, /* %A */
171 { termp_under_pre
, termp____post
}, /* %B */
172 { NULL
, termp____post
}, /* %D */
173 { termp_under_pre
, termp____post
}, /* %I */
174 { termp_under_pre
, termp____post
}, /* %J */
175 { NULL
, termp____post
}, /* %N */
176 { NULL
, termp____post
}, /* %O */
177 { NULL
, termp____post
}, /* %P */
178 { NULL
, termp____post
}, /* %R */
179 { termp__t_pre
, termp__t_post
}, /* %T */
180 { NULL
, termp____post
}, /* %V */
181 { NULL
, NULL
}, /* Ac */
182 { termp_quote_pre
, termp_quote_post
}, /* Ao */
183 { termp_quote_pre
, termp_quote_post
}, /* Aq */
184 { NULL
, NULL
}, /* At */
185 { NULL
, NULL
}, /* Bc */
186 { termp_bf_pre
, NULL
}, /* Bf */
187 { termp_quote_pre
, termp_quote_post
}, /* Bo */
188 { termp_quote_pre
, termp_quote_post
}, /* Bq */
189 { termp_xx_pre
, NULL
}, /* Bsx */
190 { termp_bx_pre
, NULL
}, /* Bx */
191 { NULL
, NULL
}, /* Db */
192 { NULL
, NULL
}, /* Dc */
193 { termp_quote_pre
, termp_quote_post
}, /* Do */
194 { termp_quote_pre
, termp_quote_post
}, /* Dq */
195 { NULL
, NULL
}, /* Ec */ /* FIXME: no space */
196 { NULL
, NULL
}, /* Ef */
197 { termp_under_pre
, NULL
}, /* Em */
198 { NULL
, NULL
}, /* Eo */
199 { termp_xx_pre
, NULL
}, /* Fx */
200 { termp_bold_pre
, NULL
}, /* Ms */
201 { termp_igndelim_pre
, NULL
}, /* No */
202 { termp_ns_pre
, NULL
}, /* Ns */
203 { termp_xx_pre
, NULL
}, /* Nx */
204 { termp_xx_pre
, NULL
}, /* Ox */
205 { NULL
, NULL
}, /* Pc */
206 { termp_igndelim_pre
, termp_pf_post
}, /* Pf */
207 { termp_quote_pre
, termp_quote_post
}, /* Po */
208 { termp_quote_pre
, termp_quote_post
}, /* Pq */
209 { NULL
, NULL
}, /* Qc */
210 { termp_quote_pre
, termp_quote_post
}, /* Ql */
211 { termp_quote_pre
, termp_quote_post
}, /* Qo */
212 { termp_quote_pre
, termp_quote_post
}, /* Qq */
213 { NULL
, NULL
}, /* Re */
214 { termp_rs_pre
, NULL
}, /* Rs */
215 { NULL
, NULL
}, /* Sc */
216 { termp_quote_pre
, termp_quote_post
}, /* So */
217 { termp_quote_pre
, termp_quote_post
}, /* Sq */
218 { termp_sm_pre
, NULL
}, /* Sm */
219 { termp_under_pre
, NULL
}, /* Sx */
220 { termp_bold_pre
, NULL
}, /* Sy */
221 { NULL
, NULL
}, /* Tn */
222 { termp_xx_pre
, NULL
}, /* Ux */
223 { NULL
, NULL
}, /* Xc */
224 { NULL
, NULL
}, /* Xo */
225 { termp_fo_pre
, termp_fo_post
}, /* Fo */
226 { NULL
, NULL
}, /* Fc */
227 { termp_quote_pre
, termp_quote_post
}, /* Oo */
228 { NULL
, NULL
}, /* Oc */
229 { termp_bk_pre
, termp_bk_post
}, /* Bk */
230 { NULL
, NULL
}, /* Ek */
231 { termp_bt_pre
, NULL
}, /* Bt */
232 { NULL
, NULL
}, /* Hf */
233 { NULL
, NULL
}, /* Fr */
234 { termp_ud_pre
, NULL
}, /* Ud */
235 { NULL
, termp_lb_post
}, /* Lb */
236 { termp_sp_pre
, NULL
}, /* Lp */
237 { termp_lk_pre
, NULL
}, /* Lk */
238 { termp_under_pre
, NULL
}, /* Mt */
239 { termp_quote_pre
, termp_quote_post
}, /* Brq */
240 { termp_quote_pre
, termp_quote_post
}, /* Bro */
241 { NULL
, NULL
}, /* Brc */
242 { NULL
, termp____post
}, /* %C */
243 { NULL
, NULL
}, /* Es */ /* TODO */
244 { NULL
, NULL
}, /* En */ /* TODO */
245 { termp_xx_pre
, NULL
}, /* Dx */
246 { NULL
, termp____post
}, /* %Q */
247 { termp_sp_pre
, NULL
}, /* br */
248 { termp_sp_pre
, NULL
}, /* sp */
249 { termp_under_pre
, termp____post
}, /* %U */
250 { NULL
, NULL
}, /* Ta */
255 terminal_mdoc(void *arg
, const struct mdoc
*mdoc
)
257 const struct mdoc_node
*n
;
258 const struct mdoc_meta
*m
;
261 p
= (struct termp
*)arg
;
264 p
->maxrmargin
= p
->defrmargin
;
265 p
->tabwidth
= term_len(p
, 5);
267 if (NULL
== p
->symtab
)
269 case (TERMENC_ASCII
):
270 p
->symtab
= chars_init(CHARS_ASCII
);
280 term_begin(p
, print_mdoc_head
, print_mdoc_foot
, m
);
283 print_mdoc_nodelist(p
, NULL
, m
, n
->child
);
290 print_mdoc_nodelist(DECL_ARGS
)
293 print_mdoc_node(p
, pair
, m
, n
);
295 print_mdoc_nodelist(p
, pair
, m
, n
->next
);
301 print_mdoc_node(DECL_ARGS
)
305 struct termpair npair
;
306 size_t offset
, rmargin
;
310 rmargin
= p
->rmargin
;
311 font
= term_fontq(p
);
313 memset(&npair
, 0, sizeof(struct termpair
));
318 if (' ' == *n
->string
&& MDOC_LINE
& n
->flags
)
320 term_word(p
, n
->string
);
323 term_tbl(p
, n
->span
);
326 if (termacts
[n
->tok
].pre
&& ENDBODY_NOT
== n
->end
)
327 chld
= (*termacts
[n
->tok
].pre
)
333 * Keeps only work until the end of a line. If a keep was
334 * invoked in a prior line, revert it to PREKEEP.
336 * Also let SYNPRETTY sections behave as if they were wrapped
340 if (TERMP_KEEP
& p
->flags
|| MDOC_SYNPRETTY
& n
->flags
) {
341 if (n
->prev
&& n
->prev
->line
!= n
->line
) {
342 p
->flags
&= ~TERMP_KEEP
;
343 p
->flags
|= TERMP_PREKEEP
;
344 } else if (NULL
== n
->prev
) {
345 if (n
->parent
&& n
->parent
->line
!= n
->line
) {
346 p
->flags
&= ~TERMP_KEEP
;
347 p
->flags
|= TERMP_PREKEEP
;
353 * Since SYNPRETTY sections aren't "turned off" with `Ek',
354 * we have to intuit whether we should disable formatting.
357 if ( ! (MDOC_SYNPRETTY
& n
->flags
) &&
358 ((n
->prev
&& MDOC_SYNPRETTY
& n
->prev
->flags
) ||
359 (n
->parent
&& MDOC_SYNPRETTY
& n
->parent
->flags
)))
360 p
->flags
&= ~(TERMP_KEEP
| TERMP_PREKEEP
);
362 if (chld
&& n
->child
)
363 print_mdoc_nodelist(p
, &npair
, m
, n
->child
);
365 term_fontpopq(p
, font
);
373 if ( ! termacts
[n
->tok
].post
|| MDOC_ENDED
& n
->flags
)
375 (void)(*termacts
[n
->tok
].post
)(p
, &npair
, m
, n
);
378 * Explicit end tokens not only call the post
379 * handler, but also tell the respective block
380 * that it must not call the post handler again.
382 if (ENDBODY_NOT
!= n
->end
)
383 n
->pending
->flags
|= MDOC_ENDED
;
386 * End of line terminating an implicit block
387 * while an explicit block is still open.
388 * Continue the explicit block without spacing.
390 if (ENDBODY_NOSPACE
== n
->end
)
391 p
->flags
|= TERMP_NOSPACE
;
395 if (MDOC_EOS
& n
->flags
)
396 p
->flags
|= TERMP_SENTENCE
;
399 p
->rmargin
= rmargin
;
404 print_mdoc_foot(struct termp
*p
, const void *arg
)
406 char buf
[DATESIZ
], os
[BUFSIZ
];
407 const struct mdoc_meta
*m
;
409 m
= (const struct mdoc_meta
*)arg
;
411 term_fontrepl(p
, TERMFONT_NONE
);
414 * Output the footer in new-groff style, that is, three columns
415 * with the middle being the manual date and flanking columns
416 * being the operating system:
421 time2a(m
->date
, buf
, DATESIZ
);
422 strlcpy(os
, m
->os
, BUFSIZ
);
427 p
->rmargin
= (p
->maxrmargin
-
428 term_strlen(p
, buf
) + term_len(p
, 1)) / 2;
429 p
->flags
|= TERMP_NOSPACE
| TERMP_NOBREAK
;
434 p
->offset
= p
->rmargin
;
435 p
->rmargin
= p
->maxrmargin
- term_strlen(p
, os
);
436 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
441 p
->offset
= p
->rmargin
;
442 p
->rmargin
= p
->maxrmargin
;
443 p
->flags
&= ~TERMP_NOBREAK
;
444 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
450 p
->rmargin
= p
->maxrmargin
;
456 print_mdoc_head(struct termp
*p
, const void *arg
)
458 char buf
[BUFSIZ
], title
[BUFSIZ
];
459 const struct mdoc_meta
*m
;
461 m
= (const struct mdoc_meta
*)arg
;
463 p
->rmargin
= p
->maxrmargin
;
467 * The header is strange. It has three components, which are
468 * really two with the first duplicated. It goes like this:
470 * IDENTIFIER TITLE IDENTIFIER
472 * The IDENTIFIER is NAME(SECTION), which is the command-name
473 * (if given, or "unknown" if not) followed by the manual page
474 * section. These are given in `Dt'. The TITLE is a free-form
475 * string depending on the manual volume. If not specified, it
476 * switches on the manual section.
480 strlcpy(buf
, m
->vol
, BUFSIZ
);
483 strlcat(buf
, " (", BUFSIZ
);
484 strlcat(buf
, m
->arch
, BUFSIZ
);
485 strlcat(buf
, ")", BUFSIZ
);
488 snprintf(title
, BUFSIZ
, "%s(%s)", m
->title
, m
->msec
);
491 p
->rmargin
= (p
->maxrmargin
-
492 term_strlen(p
, buf
) + term_len(p
, 1)) / 2;
493 p
->flags
|= TERMP_NOBREAK
| TERMP_NOSPACE
;
498 p
->offset
= p
->rmargin
;
499 p
->rmargin
= p
->maxrmargin
- term_strlen(p
, title
);
500 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
505 p
->offset
= p
->rmargin
;
506 p
->rmargin
= p
->maxrmargin
;
507 p
->flags
&= ~TERMP_NOBREAK
;
508 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
514 p
->rmargin
= p
->maxrmargin
;
515 p
->flags
&= ~TERMP_NOSPACE
;
520 a2height(const struct termp
*p
, const char *v
)
525 if ( ! a2roffsu(v
, &su
, SCALE_VS
))
526 SCALE_VS_INIT(&su
, term_len(p
, 1));
528 return(term_vspan(p
, &su
));
533 a2width(const struct termp
*p
, const char *v
)
538 if ( ! a2roffsu(v
, &su
, SCALE_MAX
))
539 SCALE_HS_INIT(&su
, term_strlen(p
, v
));
541 return(term_hspan(p
, &su
));
546 a2offs(const struct termp
*p
, const char *v
)
552 else if (0 == strcmp(v
, "left"))
554 else if (0 == strcmp(v
, "indent"))
555 return(term_len(p
, INDENT
+ 1));
556 else if (0 == strcmp(v
, "indent-two"))
557 return(term_len(p
, (INDENT
+ 1) * 2));
558 else if ( ! a2roffsu(v
, &su
, SCALE_MAX
))
559 SCALE_HS_INIT(&su
, term_strlen(p
, v
));
561 return(term_hspan(p
, &su
));
566 * Determine how much space to print out before block elements of `It'
567 * (and thus `Bl') and `Bd'. And then go ahead and print that space,
571 print_bvspace(struct termp
*p
,
572 const struct mdoc_node
*bl
,
573 const struct mdoc_node
*n
)
575 const struct mdoc_node
*nn
;
579 if (MDOC_Bd
== bl
->tok
&& bl
->norm
->Bd
.comp
)
581 if (MDOC_Bl
== bl
->tok
&& bl
->norm
->Bl
.comp
)
584 /* Do not vspace directly after Ss/Sh. */
586 for (nn
= n
; nn
; nn
= nn
->parent
) {
587 if (MDOC_BLOCK
!= nn
->type
)
589 if (MDOC_Ss
== nn
->tok
)
591 if (MDOC_Sh
== nn
->tok
)
593 if (NULL
== nn
->prev
)
598 /* A `-column' does not assert vspace within the list. */
600 if (MDOC_Bl
== bl
->tok
&& LIST_column
== bl
->norm
->Bl
.type
)
601 if (n
->prev
&& MDOC_It
== n
->prev
->tok
)
604 /* A `-diag' without body does not vspace. */
606 if (MDOC_Bl
== bl
->tok
&& LIST_diag
== bl
->norm
->Bl
.type
)
607 if (n
->prev
&& MDOC_It
== n
->prev
->tok
) {
608 assert(n
->prev
->body
);
609 if (NULL
== n
->prev
->body
->child
)
619 termp_it_pre(DECL_ARGS
)
621 const struct mdoc_node
*bl
, *nn
;
624 size_t width
, offset
, ncols
, dcol
;
627 if (MDOC_BLOCK
== n
->type
) {
628 print_bvspace(p
, n
->parent
->parent
, n
);
632 bl
= n
->parent
->parent
->parent
;
633 type
= bl
->norm
->Bl
.type
;
636 * First calculate width and offset. This is pretty easy unless
637 * we're a -column list, in which case all prior columns must
643 if (bl
->norm
->Bl
.offs
)
644 offset
= a2offs(p
, bl
->norm
->Bl
.offs
);
648 if (MDOC_HEAD
== n
->type
)
652 * Imitate groff's column handling:
653 * - For each earlier column, add its width.
654 * - For less than 5 columns, add four more blanks per
656 * - For exactly 5 columns, add three more blank per
658 * - For more than 5 columns, add only one column.
660 ncols
= bl
->norm
->Bl
.ncols
;
663 dcol
= ncols
< 5 ? term_len(p
, 4) :
664 ncols
== 5 ? term_len(p
, 3) : term_len(p
, 1);
667 * Calculate the offset by applying all prior MDOC_BODY,
668 * so we stop at the MDOC_HEAD (NULL == nn->prev).
671 for (i
= 0, nn
= n
->prev
;
672 nn
->prev
&& i
< (int)ncols
;
674 offset
+= dcol
+ a2width
675 (p
, bl
->norm
->Bl
.cols
[i
]);
678 * When exceeding the declared number of columns, leave
679 * the remaining widths at 0. This will later be
680 * adjusted to the default width of 10, or, for the last
681 * column, stretched to the right margin.
687 * Use the declared column widths, extended as explained
688 * in the preceding paragraph.
690 width
= a2width(p
, bl
->norm
->Bl
.cols
[i
]) + dcol
;
693 if (NULL
== bl
->norm
->Bl
.width
)
697 * Note: buffer the width by 2, which is groff's magic
698 * number for buffering single arguments. See the above
699 * handling for column for how this changes.
701 assert(bl
->norm
->Bl
.width
);
702 width
= a2width(p
, bl
->norm
->Bl
.width
) + term_len(p
, 2);
707 * List-type can override the width in the case of fixed-head
708 * values (bullet, dash/hyphen, enum). Tags need a non-zero
718 if (width
< term_len(p
, 4))
719 width
= term_len(p
, 4);
722 if (width
< term_len(p
, 5))
723 width
= term_len(p
, 5);
727 width
= term_len(p
, 8);
733 width
= term_len(p
, 10);
740 * Whitespace control. Inset bodies need an initial space,
741 * while diagonal bodies need two.
744 p
->flags
|= TERMP_NOSPACE
;
748 if (MDOC_BODY
== n
->type
)
749 term_word(p
, "\\ \\ ");
752 if (MDOC_BODY
== n
->type
)
759 p
->flags
|= TERMP_NOSPACE
;
763 if (MDOC_HEAD
== n
->type
)
764 term_fontpush(p
, TERMFONT_BOLD
);
771 * Pad and break control. This is the tricky part. These flags
772 * are documented in term_flushln() in term.c. Note that we're
773 * going to unset all of these flags in termp_it_post() when we
785 if (MDOC_HEAD
== n
->type
)
786 p
->flags
|= TERMP_NOBREAK
;
788 p
->flags
|= TERMP_NOLPAD
;
791 if (MDOC_HEAD
== n
->type
)
792 p
->flags
|= TERMP_NOBREAK
;
794 p
->flags
|= TERMP_NOLPAD
;
796 if (MDOC_HEAD
!= n
->type
)
800 * This is ugly. If `-hang' is specified and the body
801 * is a `Bl' or `Bd', then we want basically to nullify
802 * the "overstep" effect in term_flushln() and treat
803 * this as a `-ohang' list instead.
805 if (n
->next
->child
&&
806 (MDOC_Bl
== n
->next
->child
->tok
||
807 MDOC_Bd
== n
->next
->child
->tok
)) {
808 p
->flags
&= ~TERMP_NOBREAK
;
809 p
->flags
&= ~TERMP_NOLPAD
;
811 p
->flags
|= TERMP_HANG
;
814 if (MDOC_HEAD
== n
->type
)
815 p
->flags
|= TERMP_NOBREAK
| TERMP_TWOSPACE
;
817 p
->flags
|= TERMP_NOLPAD
;
819 if (MDOC_HEAD
!= n
->type
)
821 if (NULL
== n
->next
|| NULL
== n
->next
->child
)
822 p
->flags
|= TERMP_DANGLE
;
825 if (MDOC_HEAD
== n
->type
)
829 p
->flags
&= ~TERMP_NOBREAK
;
831 p
->flags
|= TERMP_NOBREAK
;
834 if (MDOC_BODY
== n
->prev
->type
)
835 p
->flags
|= TERMP_NOLPAD
;
839 if (MDOC_HEAD
== n
->type
)
840 p
->flags
|= TERMP_NOBREAK
;
847 * Margin control. Set-head-width lists have their right
848 * margins shortened. The body for these lists has the offset
849 * necessarily lengthened. Everybody gets the offset.
857 * Same stipulation as above, regarding `-hang'. We
858 * don't want to recalculate rmargin and offsets when
859 * using `Bd' or `Bl' within `-hang' overstep lists.
861 if (MDOC_HEAD
== n
->type
&& n
->next
->child
&&
862 (MDOC_Bl
== n
->next
->child
->tok
||
863 MDOC_Bd
== n
->next
->child
->tok
))
876 if (MDOC_HEAD
== n
->type
)
877 p
->rmargin
= p
->offset
+ width
;
883 p
->rmargin
= p
->offset
+ width
;
885 * XXX - this behaviour is not documented: the
886 * right-most column is filled to the right margin.
888 if (MDOC_HEAD
== n
->type
)
890 if (NULL
== n
->next
&& p
->rmargin
< p
->maxrmargin
)
891 p
->rmargin
= p
->maxrmargin
;
898 * The dash, hyphen, bullet and enum lists all have a special
899 * HEAD character (temporarily bold, in some cases).
902 if (MDOC_HEAD
== n
->type
)
905 term_fontpush(p
, TERMFONT_BOLD
);
906 term_word(p
, "\\[bu]");
912 term_fontpush(p
, TERMFONT_BOLD
);
913 term_word(p
, "\\(hy");
917 (pair
->ppair
->ppair
->count
)++;
918 snprintf(buf
, sizeof(buf
), "%d.",
919 pair
->ppair
->ppair
->count
);
927 * If we're not going to process our children, indicate so here.
940 if (MDOC_HEAD
== n
->type
)
944 if (MDOC_HEAD
== n
->type
)
957 termp_it_post(DECL_ARGS
)
961 if (MDOC_BLOCK
== n
->type
)
964 type
= n
->parent
->parent
->parent
->norm
->Bl
.type
;
972 if (MDOC_BODY
== n
->type
)
976 if (MDOC_BODY
== n
->type
)
985 * Now that our output is flushed, we can reset our tags. Since
986 * only `It' sets these flags, we're free to assume that nobody
987 * has munged them in the meanwhile.
990 p
->flags
&= ~TERMP_DANGLE
;
991 p
->flags
&= ~TERMP_NOBREAK
;
992 p
->flags
&= ~TERMP_TWOSPACE
;
993 p
->flags
&= ~TERMP_NOLPAD
;
994 p
->flags
&= ~TERMP_HANG
;
1000 termp_nm_pre(DECL_ARGS
)
1003 if (MDOC_BLOCK
== n
->type
)
1006 if (MDOC_BODY
== n
->type
) {
1007 if (NULL
== n
->child
)
1009 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
1010 p
->offset
+= term_len(p
, 1) +
1011 (NULL
== n
->prev
->child
? term_strlen(p
, m
->name
) :
1012 MDOC_TEXT
== n
->prev
->child
->type
?
1013 term_strlen(p
, n
->prev
->child
->string
) :
1018 if (NULL
== n
->child
&& NULL
== m
->name
)
1021 if (MDOC_HEAD
== n
->type
)
1022 synopsis_pre(p
, n
->parent
);
1024 if (MDOC_HEAD
== n
->type
&& n
->next
->child
) {
1025 p
->flags
|= TERMP_NOSPACE
| TERMP_NOBREAK
;
1026 p
->rmargin
= p
->offset
+ term_len(p
, 1);
1027 if (NULL
== n
->child
) {
1028 p
->rmargin
+= term_strlen(p
, m
->name
);
1029 } else if (MDOC_TEXT
== n
->child
->type
) {
1030 p
->rmargin
+= term_strlen(p
, n
->child
->string
);
1032 p
->flags
|= TERMP_HANG
;
1034 p
->rmargin
+= term_len(p
, 5);
1035 p
->flags
|= TERMP_HANG
;
1039 term_fontpush(p
, TERMFONT_BOLD
);
1040 if (NULL
== n
->child
)
1041 term_word(p
, m
->name
);
1048 termp_nm_post(DECL_ARGS
)
1051 if (MDOC_HEAD
== n
->type
&& n
->next
->child
) {
1053 p
->flags
&= ~(TERMP_NOBREAK
| TERMP_HANG
);
1054 } else if (MDOC_BODY
== n
->type
&& n
->child
) {
1056 p
->flags
&= ~TERMP_NOLPAD
;
1063 termp_fl_pre(DECL_ARGS
)
1066 term_fontpush(p
, TERMFONT_BOLD
);
1067 term_word(p
, "\\-");
1070 p
->flags
|= TERMP_NOSPACE
;
1071 else if (n
->next
&& n
->next
->line
== n
->line
)
1072 p
->flags
|= TERMP_NOSPACE
;
1080 termp__a_pre(DECL_ARGS
)
1083 if (n
->prev
&& MDOC__A
== n
->prev
->tok
)
1084 if (NULL
== n
->next
|| MDOC__A
!= n
->next
->tok
)
1085 term_word(p
, "and");
1093 termp_an_pre(DECL_ARGS
)
1096 if (NULL
== n
->child
)
1100 * If not in the AUTHORS section, `An -split' will cause
1101 * newlines to occur before the author name. If in the AUTHORS
1102 * section, by default, the first `An' invocation is nosplit,
1103 * then all subsequent ones, regardless of whether interspersed
1104 * with other macros/text, are split. -split, in this case,
1105 * will override the condition of the implied first -nosplit.
1108 if (n
->sec
== SEC_AUTHORS
) {
1109 if ( ! (TERMP_ANPREC
& p
->flags
)) {
1110 if (TERMP_SPLIT
& p
->flags
)
1114 if (TERMP_NOSPLIT
& p
->flags
)
1120 if (TERMP_SPLIT
& p
->flags
)
1129 termp_an_post(DECL_ARGS
)
1133 if (SEC_AUTHORS
== n
->sec
)
1134 p
->flags
|= TERMP_ANPREC
;
1138 if (AUTH_split
== n
->norm
->An
.auth
) {
1139 p
->flags
&= ~TERMP_NOSPLIT
;
1140 p
->flags
|= TERMP_SPLIT
;
1141 } else if (AUTH_nosplit
== n
->norm
->An
.auth
) {
1142 p
->flags
&= ~TERMP_SPLIT
;
1143 p
->flags
|= TERMP_NOSPLIT
;
1151 termp_ns_pre(DECL_ARGS
)
1154 p
->flags
|= TERMP_NOSPACE
;
1161 termp_rs_pre(DECL_ARGS
)
1164 if (SEC_SEE_ALSO
!= n
->sec
)
1166 if (MDOC_BLOCK
== n
->type
&& n
->prev
)
1174 termp_rv_pre(DECL_ARGS
)
1176 const struct mdoc_node
*nn
;
1179 term_word(p
, "The");
1181 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1182 term_fontpush(p
, TERMFONT_BOLD
);
1183 term_word(p
, nn
->string
);
1185 p
->flags
|= TERMP_NOSPACE
;
1186 if (nn
->next
&& NULL
== nn
->next
->next
)
1187 term_word(p
, "(), and");
1189 term_word(p
, "(),");
1194 if (n
->child
&& n
->child
->next
)
1195 term_word(p
, "functions return");
1197 term_word(p
, "function returns");
1199 term_word(p
, "the value 0 if successful; otherwise the value "
1200 "-1 is returned and the global variable");
1202 term_fontpush(p
, TERMFONT_UNDER
);
1203 term_word(p
, "errno");
1206 term_word(p
, "is set to indicate the error.");
1207 p
->flags
|= TERMP_SENTENCE
;
1215 termp_ex_pre(DECL_ARGS
)
1217 const struct mdoc_node
*nn
;
1219 term_word(p
, "The");
1221 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1222 term_fontpush(p
, TERMFONT_BOLD
);
1223 term_word(p
, nn
->string
);
1225 p
->flags
|= TERMP_NOSPACE
;
1226 if (nn
->next
&& NULL
== nn
->next
->next
)
1227 term_word(p
, ", and");
1231 p
->flags
&= ~TERMP_NOSPACE
;
1234 if (n
->child
&& n
->child
->next
)
1235 term_word(p
, "utilities exit");
1237 term_word(p
, "utility exits");
1239 term_word(p
, "0 on success, and >0 if an error occurs.");
1240 p
->flags
|= TERMP_SENTENCE
;
1248 termp_nd_pre(DECL_ARGS
)
1251 if (MDOC_BODY
!= n
->type
)
1254 #if defined(__OpenBSD__) || defined(__linux__)
1255 term_word(p
, "\\(en");
1257 term_word(p
, "\\(em");
1265 termp_bl_pre(DECL_ARGS
)
1268 return(MDOC_HEAD
!= n
->type
);
1274 termp_bl_post(DECL_ARGS
)
1277 if (MDOC_BLOCK
== n
->type
)
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 term_word(p
, nn
->string
);
1307 * This decides how to assert whitespace before any of the SYNOPSIS set
1308 * of macros (which, as in the case of Ft/Fo and Ft/Fn, may contain
1312 synopsis_pre(struct termp
*p
, const struct mdoc_node
*n
)
1315 * Obviously, if we're not in a SYNOPSIS or no prior macros
1316 * exist, do nothing.
1318 if (NULL
== n
->prev
|| ! (MDOC_SYNPRETTY
& n
->flags
))
1322 * If we're the second in a pair of like elements, emit our
1323 * newline and return. UNLESS we're `Fo', `Fn', `Fn', in which
1324 * case we soldier on.
1326 if (n
->prev
->tok
== n
->tok
&&
1327 MDOC_Ft
!= n
->tok
&&
1328 MDOC_Fo
!= n
->tok
&&
1329 MDOC_Fn
!= n
->tok
) {
1335 * If we're one of the SYNOPSIS set and non-like pair-wise after
1336 * another (or Fn/Fo, which we've let slip through) then assert
1337 * vertical space, else only newline and move on.
1339 switch (n
->prev
->tok
) {
1352 if (MDOC_Fn
!= n
->tok
&& MDOC_Fo
!= n
->tok
) {
1365 termp_vt_pre(DECL_ARGS
)
1368 if (MDOC_ELEM
== n
->type
) {
1370 return(termp_under_pre(p
, pair
, m
, n
));
1371 } else if (MDOC_BLOCK
== n
->type
) {
1374 } else if (MDOC_HEAD
== n
->type
)
1377 return(termp_under_pre(p
, pair
, m
, n
));
1383 termp_bold_pre(DECL_ARGS
)
1386 term_fontpush(p
, TERMFONT_BOLD
);
1393 termp_fd_pre(DECL_ARGS
)
1397 return(termp_bold_pre(p
, pair
, m
, n
));
1403 termp_sh_pre(DECL_ARGS
)
1406 /* No vspace between consecutive `Sh' calls. */
1410 if (n
->prev
&& MDOC_Sh
== n
->prev
->tok
)
1411 if (NULL
== n
->prev
->body
->child
)
1416 term_fontpush(p
, TERMFONT_BOLD
);
1419 p
->offset
= term_len(p
, INDENT
);
1430 termp_sh_post(DECL_ARGS
)
1449 termp_bt_pre(DECL_ARGS
)
1452 term_word(p
, "is currently in beta test.");
1453 p
->flags
|= TERMP_SENTENCE
;
1460 termp_lb_post(DECL_ARGS
)
1463 if (SEC_LIBRARY
== n
->sec
&& MDOC_LINE
& n
->flags
)
1470 termp_ud_pre(DECL_ARGS
)
1473 term_word(p
, "currently under development.");
1474 p
->flags
|= TERMP_SENTENCE
;
1481 termp_d1_pre(DECL_ARGS
)
1484 if (MDOC_BLOCK
!= n
->type
)
1487 p
->offset
+= term_len(p
, (INDENT
+ 1));
1494 termp_d1_post(DECL_ARGS
)
1497 if (MDOC_BLOCK
!= n
->type
)
1505 termp_ft_pre(DECL_ARGS
)
1508 /* NB: MDOC_LINE does not effect this! */
1510 term_fontpush(p
, TERMFONT_UNDER
);
1517 termp_fn_pre(DECL_ARGS
)
1519 const struct mdoc_node
*nn
;
1523 term_fontpush(p
, TERMFONT_BOLD
);
1524 term_word(p
, n
->child
->string
);
1527 p
->flags
|= TERMP_NOSPACE
;
1530 for (nn
= n
->child
->next
; nn
; nn
= nn
->next
) {
1531 term_fontpush(p
, TERMFONT_UNDER
);
1532 term_word(p
, nn
->string
);
1541 if (MDOC_SYNPRETTY
& n
->flags
)
1550 termp_fa_pre(DECL_ARGS
)
1552 const struct mdoc_node
*nn
;
1554 if (n
->parent
->tok
!= MDOC_Fo
) {
1555 term_fontpush(p
, TERMFONT_UNDER
);
1559 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1560 term_fontpush(p
, TERMFONT_UNDER
);
1561 term_word(p
, nn
->string
);
1568 if (n
->child
&& n
->next
&& n
->next
->tok
== MDOC_Fa
)
1577 termp_bd_pre(DECL_ARGS
)
1579 size_t tabwidth
, rm
, rmax
;
1580 const struct mdoc_node
*nn
;
1582 if (MDOC_BLOCK
== n
->type
) {
1583 print_bvspace(p
, n
, n
);
1585 } else if (MDOC_HEAD
== n
->type
)
1588 if (n
->norm
->Bd
.offs
)
1589 p
->offset
+= a2offs(p
, n
->norm
->Bd
.offs
);
1592 * If -ragged or -filled are specified, the block does nothing
1593 * but change the indentation. If -unfilled or -literal are
1594 * specified, text is printed exactly as entered in the display:
1595 * for macro lines, a newline is appended to the line. Blank
1596 * lines are allowed.
1599 if (DISP_literal
!= n
->norm
->Bd
.type
&&
1600 DISP_unfilled
!= n
->norm
->Bd
.type
)
1603 tabwidth
= p
->tabwidth
;
1604 if (DISP_literal
== n
->norm
->Bd
.type
)
1605 p
->tabwidth
= term_len(p
, 8);
1608 rmax
= p
->maxrmargin
;
1609 p
->rmargin
= p
->maxrmargin
= TERM_MAXMARGIN
;
1611 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1612 print_mdoc_node(p
, pair
, m
, nn
);
1614 * If the printed node flushes its own line, then we
1615 * needn't do it here as well. This is hacky, but the
1616 * notion of selective eoln whitespace is pretty dumb
1617 * anyway, so don't sweat it.
1639 if (nn
->next
&& nn
->next
->line
== nn
->line
)
1642 p
->flags
|= TERMP_NOSPACE
;
1645 p
->tabwidth
= tabwidth
;
1647 p
->maxrmargin
= rmax
;
1654 termp_bd_post(DECL_ARGS
)
1658 if (MDOC_BODY
!= n
->type
)
1662 rmax
= p
->maxrmargin
;
1664 if (DISP_literal
== n
->norm
->Bd
.type
||
1665 DISP_unfilled
== n
->norm
->Bd
.type
)
1666 p
->rmargin
= p
->maxrmargin
= TERM_MAXMARGIN
;
1668 p
->flags
|= TERMP_NOSPACE
;
1672 p
->maxrmargin
= rmax
;
1678 termp_bx_pre(DECL_ARGS
)
1681 if (NULL
!= (n
= n
->child
)) {
1682 term_word(p
, n
->string
);
1683 p
->flags
|= TERMP_NOSPACE
;
1684 term_word(p
, "BSD");
1686 term_word(p
, "BSD");
1690 if (NULL
!= (n
= n
->next
)) {
1691 p
->flags
|= TERMP_NOSPACE
;
1693 p
->flags
|= TERMP_NOSPACE
;
1694 term_word(p
, n
->string
);
1703 termp_xx_pre(DECL_ARGS
)
1733 p
->flags
|= TERMP_KEEP
;
1734 term_word(p
, n
->child
->string
);
1735 p
->flags
&= ~TERMP_KEEP
;
1743 termp_igndelim_pre(DECL_ARGS
)
1746 p
->flags
|= TERMP_IGNDELIM
;
1753 termp_pf_post(DECL_ARGS
)
1756 p
->flags
|= TERMP_NOSPACE
;
1762 termp_ss_pre(DECL_ARGS
)
1772 term_fontpush(p
, TERMFONT_BOLD
);
1773 p
->offset
= term_len(p
, HALFINDENT
);
1785 termp_ss_post(DECL_ARGS
)
1788 if (MDOC_HEAD
== n
->type
)
1795 termp_cd_pre(DECL_ARGS
)
1799 term_fontpush(p
, TERMFONT_BOLD
);
1806 termp_in_pre(DECL_ARGS
)
1811 if (MDOC_SYNPRETTY
& n
->flags
&& MDOC_LINE
& n
->flags
) {
1812 term_fontpush(p
, TERMFONT_BOLD
);
1813 term_word(p
, "#include");
1817 term_fontpush(p
, TERMFONT_UNDER
);
1820 p
->flags
|= TERMP_NOSPACE
;
1827 termp_in_post(DECL_ARGS
)
1830 if (MDOC_SYNPRETTY
& n
->flags
)
1831 term_fontpush(p
, TERMFONT_BOLD
);
1833 p
->flags
|= TERMP_NOSPACE
;
1836 if (MDOC_SYNPRETTY
& n
->flags
)
1843 termp_sp_pre(DECL_ARGS
)
1849 len
= n
->child
? a2height(p
, n
->child
->string
) : 1;
1861 for (i
= 0; i
< len
; i
++)
1870 termp_quote_pre(DECL_ARGS
)
1873 if (MDOC_BODY
!= n
->type
&& MDOC_ELEM
!= n
->type
)
1925 p
->flags
|= TERMP_NOSPACE
;
1932 termp_quote_post(DECL_ARGS
)
1935 if (MDOC_BODY
!= n
->type
&& MDOC_ELEM
!= n
->type
)
1938 p
->flags
|= TERMP_NOSPACE
;
1993 termp_fo_pre(DECL_ARGS
)
1996 if (MDOC_BLOCK
== n
->type
) {
1999 } else if (MDOC_BODY
== n
->type
) {
2000 p
->flags
|= TERMP_NOSPACE
;
2005 if (NULL
== n
->child
)
2008 /* XXX: we drop non-initial arguments as per groff. */
2010 assert(n
->child
->string
);
2011 term_fontpush(p
, TERMFONT_BOLD
);
2012 term_word(p
, n
->child
->string
);
2019 termp_fo_post(DECL_ARGS
)
2022 if (MDOC_BODY
!= n
->type
)
2027 if (MDOC_SYNPRETTY
& n
->flags
)
2034 termp_bf_pre(DECL_ARGS
)
2037 if (MDOC_HEAD
== n
->type
)
2039 else if (MDOC_BLOCK
!= n
->type
)
2042 if (FONT_Em
== n
->norm
->Bf
.font
)
2043 term_fontpush(p
, TERMFONT_UNDER
);
2044 else if (FONT_Sy
== n
->norm
->Bf
.font
)
2045 term_fontpush(p
, TERMFONT_BOLD
);
2047 term_fontpush(p
, TERMFONT_NONE
);
2055 termp_sm_pre(DECL_ARGS
)
2058 assert(n
->child
&& MDOC_TEXT
== n
->child
->type
);
2059 if (0 == strcmp("on", n
->child
->string
)) {
2061 p
->flags
&= ~TERMP_NOSPACE
;
2062 p
->flags
&= ~TERMP_NONOSPACE
;
2064 p
->flags
|= TERMP_NONOSPACE
;
2072 termp_ap_pre(DECL_ARGS
)
2075 p
->flags
|= TERMP_NOSPACE
;
2077 p
->flags
|= TERMP_NOSPACE
;
2084 termp____post(DECL_ARGS
)
2088 * Handle lists of authors. In general, print each followed by
2089 * a comma. Don't print the comma if there are only two
2092 if (MDOC__A
== n
->tok
&& n
->next
&& MDOC__A
== n
->next
->tok
)
2093 if (NULL
== n
->next
->next
|| MDOC__A
!= n
->next
->next
->tok
)
2094 if (NULL
== n
->prev
|| MDOC__A
!= n
->prev
->tok
)
2099 if (NULL
== n
->parent
|| MDOC_Rs
!= n
->parent
->tok
)
2102 if (NULL
== n
->next
) {
2104 p
->flags
|= TERMP_SENTENCE
;
2112 termp_li_pre(DECL_ARGS
)
2115 term_fontpush(p
, TERMFONT_NONE
);
2122 termp_lk_pre(DECL_ARGS
)
2124 const struct mdoc_node
*nn
, *sv
;
2126 term_fontpush(p
, TERMFONT_UNDER
);
2130 if (NULL
== nn
|| NULL
== nn
->next
)
2133 for (nn
= nn
->next
; nn
; nn
= nn
->next
)
2134 term_word(p
, nn
->string
);
2140 term_fontpush(p
, TERMFONT_BOLD
);
2141 term_word(p
, sv
->string
);
2150 termp_bk_pre(DECL_ARGS
)
2159 if (n
->parent
->args
|| 0 == n
->prev
->nchild
)
2160 p
->flags
|= TERMP_PREKEEP
;
2173 termp_bk_post(DECL_ARGS
)
2176 if (MDOC_BODY
== n
->type
)
2177 p
->flags
&= ~(TERMP_KEEP
| TERMP_PREKEEP
);
2182 termp__t_post(DECL_ARGS
)
2186 * If we're in an `Rs' and there's a journal present, then quote
2187 * us instead of underlining us (for disambiguation).
2189 if (n
->parent
&& MDOC_Rs
== n
->parent
->tok
&&
2190 n
->parent
->norm
->Rs
.quote_T
)
2191 termp_quote_post(p
, pair
, m
, n
);
2193 termp____post(p
, pair
, m
, n
);
2198 termp__t_pre(DECL_ARGS
)
2202 * If we're in an `Rs' and there's a journal present, then quote
2203 * us instead of underlining us (for disambiguation).
2205 if (n
->parent
&& MDOC_Rs
== n
->parent
->tok
&&
2206 n
->parent
->norm
->Rs
.quote_T
)
2207 return(termp_quote_pre(p
, pair
, m
, n
));
2209 term_fontpush(p
, TERMFONT_UNDER
);
2215 termp_under_pre(DECL_ARGS
)
2218 term_fontpush(p
, TERMFONT_UNDER
);