]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc_term.c
1 /* $Id: mdoc_term.c,v 1.217 2011/02/06 22:33:38 schwarze Exp $ */
3 * Copyright (c) 2008, 2009, 2010, 2011 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
));
317 * Keeps only work until the end of a line. If a keep was
318 * invoked in a prior line, revert it to PREKEEP.
320 * Also let SYNPRETTY sections behave as if they were wrapped
324 if (TERMP_KEEP
& p
->flags
|| MDOC_SYNPRETTY
& n
->flags
) {
325 if (n
->prev
&& n
->prev
->line
!= n
->line
) {
326 p
->flags
&= ~TERMP_KEEP
;
327 p
->flags
|= TERMP_PREKEEP
;
328 } else if (NULL
== n
->prev
) {
329 if (n
->parent
&& n
->parent
->line
!= n
->line
) {
330 p
->flags
&= ~TERMP_KEEP
;
331 p
->flags
|= TERMP_PREKEEP
;
337 * Since SYNPRETTY sections aren't "turned off" with `Ek',
338 * we have to intuit whether we should disable formatting.
341 if ( ! (MDOC_SYNPRETTY
& n
->flags
) &&
342 ((n
->prev
&& MDOC_SYNPRETTY
& n
->prev
->flags
) ||
343 (n
->parent
&& MDOC_SYNPRETTY
& n
->parent
->flags
)))
344 p
->flags
&= ~(TERMP_KEEP
| TERMP_PREKEEP
);
347 * After the keep flags have been set up, we may now
348 * produce output. Note that some pre-handlers do so.
353 if (' ' == *n
->string
&& MDOC_LINE
& n
->flags
)
355 term_word(p
, n
->string
);
360 term_tbl(p
, n
->span
);
363 if (termacts
[n
->tok
].pre
&& ENDBODY_NOT
== n
->end
)
364 chld
= (*termacts
[n
->tok
].pre
)
369 if (chld
&& n
->child
)
370 print_mdoc_nodelist(p
, &npair
, m
, n
->child
);
372 term_fontpopq(p
, font
);
382 if ( ! termacts
[n
->tok
].post
|| MDOC_ENDED
& n
->flags
)
384 (void)(*termacts
[n
->tok
].post
)(p
, &npair
, m
, n
);
387 * Explicit end tokens not only call the post
388 * handler, but also tell the respective block
389 * that it must not call the post handler again.
391 if (ENDBODY_NOT
!= n
->end
)
392 n
->pending
->flags
|= MDOC_ENDED
;
395 * End of line terminating an implicit block
396 * while an explicit block is still open.
397 * Continue the explicit block without spacing.
399 if (ENDBODY_NOSPACE
== n
->end
)
400 p
->flags
|= TERMP_NOSPACE
;
404 if (MDOC_EOS
& n
->flags
)
405 p
->flags
|= TERMP_SENTENCE
;
408 p
->rmargin
= rmargin
;
413 print_mdoc_foot(struct termp
*p
, const void *arg
)
415 char buf
[DATESIZ
], os
[BUFSIZ
];
416 const struct mdoc_meta
*m
;
418 m
= (const struct mdoc_meta
*)arg
;
420 term_fontrepl(p
, TERMFONT_NONE
);
423 * Output the footer in new-groff style, that is, three columns
424 * with the middle being the manual date and flanking columns
425 * being the operating system:
430 time2a(m
->date
, buf
, DATESIZ
);
431 strlcpy(os
, m
->os
, BUFSIZ
);
436 p
->rmargin
= (p
->maxrmargin
-
437 term_strlen(p
, buf
) + term_len(p
, 1)) / 2;
438 p
->flags
|= TERMP_NOSPACE
| TERMP_NOBREAK
;
443 p
->offset
= p
->rmargin
;
444 p
->rmargin
= p
->maxrmargin
- term_strlen(p
, os
);
445 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
450 p
->offset
= p
->rmargin
;
451 p
->rmargin
= p
->maxrmargin
;
452 p
->flags
&= ~TERMP_NOBREAK
;
453 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
459 p
->rmargin
= p
->maxrmargin
;
465 print_mdoc_head(struct termp
*p
, const void *arg
)
467 char buf
[BUFSIZ
], title
[BUFSIZ
];
468 const struct mdoc_meta
*m
;
470 m
= (const struct mdoc_meta
*)arg
;
472 p
->rmargin
= p
->maxrmargin
;
476 * The header is strange. It has three components, which are
477 * really two with the first duplicated. It goes like this:
479 * IDENTIFIER TITLE IDENTIFIER
481 * The IDENTIFIER is NAME(SECTION), which is the command-name
482 * (if given, or "unknown" if not) followed by the manual page
483 * section. These are given in `Dt'. The TITLE is a free-form
484 * string depending on the manual volume. If not specified, it
485 * switches on the manual section.
489 strlcpy(buf
, m
->vol
, BUFSIZ
);
492 strlcat(buf
, " (", BUFSIZ
);
493 strlcat(buf
, m
->arch
, BUFSIZ
);
494 strlcat(buf
, ")", BUFSIZ
);
497 snprintf(title
, BUFSIZ
, "%s(%s)", m
->title
, m
->msec
);
500 p
->rmargin
= (p
->maxrmargin
-
501 term_strlen(p
, buf
) + term_len(p
, 1)) / 2;
502 p
->flags
|= TERMP_NOBREAK
| TERMP_NOSPACE
;
507 p
->offset
= p
->rmargin
;
508 p
->rmargin
= p
->maxrmargin
- term_strlen(p
, title
);
509 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
514 p
->offset
= p
->rmargin
;
515 p
->rmargin
= p
->maxrmargin
;
516 p
->flags
&= ~TERMP_NOBREAK
;
517 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
523 p
->rmargin
= p
->maxrmargin
;
524 p
->flags
&= ~TERMP_NOSPACE
;
529 a2height(const struct termp
*p
, const char *v
)
534 if ( ! a2roffsu(v
, &su
, SCALE_VS
))
535 SCALE_VS_INIT(&su
, term_len(p
, 1));
537 return(term_vspan(p
, &su
));
542 a2width(const struct termp
*p
, const char *v
)
547 if ( ! a2roffsu(v
, &su
, SCALE_MAX
))
548 SCALE_HS_INIT(&su
, term_strlen(p
, v
));
550 return(term_hspan(p
, &su
));
555 a2offs(const struct termp
*p
, const char *v
)
561 else if (0 == strcmp(v
, "left"))
563 else if (0 == strcmp(v
, "indent"))
564 return(term_len(p
, INDENT
+ 1));
565 else if (0 == strcmp(v
, "indent-two"))
566 return(term_len(p
, (INDENT
+ 1) * 2));
567 else if ( ! a2roffsu(v
, &su
, SCALE_MAX
))
568 SCALE_HS_INIT(&su
, term_strlen(p
, v
));
570 return(term_hspan(p
, &su
));
575 * Determine how much space to print out before block elements of `It'
576 * (and thus `Bl') and `Bd'. And then go ahead and print that space,
580 print_bvspace(struct termp
*p
,
581 const struct mdoc_node
*bl
,
582 const struct mdoc_node
*n
)
584 const struct mdoc_node
*nn
;
588 if (MDOC_Bd
== bl
->tok
&& bl
->norm
->Bd
.comp
)
590 if (MDOC_Bl
== bl
->tok
&& bl
->norm
->Bl
.comp
)
593 /* Do not vspace directly after Ss/Sh. */
595 for (nn
= n
; nn
; nn
= nn
->parent
) {
596 if (MDOC_BLOCK
!= nn
->type
)
598 if (MDOC_Ss
== nn
->tok
)
600 if (MDOC_Sh
== nn
->tok
)
602 if (NULL
== nn
->prev
)
607 /* A `-column' does not assert vspace within the list. */
609 if (MDOC_Bl
== bl
->tok
&& LIST_column
== bl
->norm
->Bl
.type
)
610 if (n
->prev
&& MDOC_It
== n
->prev
->tok
)
613 /* A `-diag' without body does not vspace. */
615 if (MDOC_Bl
== bl
->tok
&& LIST_diag
== bl
->norm
->Bl
.type
)
616 if (n
->prev
&& MDOC_It
== n
->prev
->tok
) {
617 assert(n
->prev
->body
);
618 if (NULL
== n
->prev
->body
->child
)
628 termp_it_pre(DECL_ARGS
)
630 const struct mdoc_node
*bl
, *nn
;
633 size_t width
, offset
, ncols
, dcol
;
636 if (MDOC_BLOCK
== n
->type
) {
637 print_bvspace(p
, n
->parent
->parent
, n
);
641 bl
= n
->parent
->parent
->parent
;
642 type
= bl
->norm
->Bl
.type
;
645 * First calculate width and offset. This is pretty easy unless
646 * we're a -column list, in which case all prior columns must
652 if (bl
->norm
->Bl
.offs
)
653 offset
= a2offs(p
, bl
->norm
->Bl
.offs
);
657 if (MDOC_HEAD
== n
->type
)
661 * Imitate groff's column handling:
662 * - For each earlier column, add its width.
663 * - For less than 5 columns, add four more blanks per
665 * - For exactly 5 columns, add three more blank per
667 * - For more than 5 columns, add only one column.
669 ncols
= bl
->norm
->Bl
.ncols
;
672 dcol
= ncols
< 5 ? term_len(p
, 4) :
673 ncols
== 5 ? term_len(p
, 3) : term_len(p
, 1);
676 * Calculate the offset by applying all prior MDOC_BODY,
677 * so we stop at the MDOC_HEAD (NULL == nn->prev).
680 for (i
= 0, nn
= n
->prev
;
681 nn
->prev
&& i
< (int)ncols
;
683 offset
+= dcol
+ a2width
684 (p
, bl
->norm
->Bl
.cols
[i
]);
687 * When exceeding the declared number of columns, leave
688 * the remaining widths at 0. This will later be
689 * adjusted to the default width of 10, or, for the last
690 * column, stretched to the right margin.
696 * Use the declared column widths, extended as explained
697 * in the preceding paragraph.
699 width
= a2width(p
, bl
->norm
->Bl
.cols
[i
]) + dcol
;
702 if (NULL
== bl
->norm
->Bl
.width
)
706 * Note: buffer the width by 2, which is groff's magic
707 * number for buffering single arguments. See the above
708 * handling for column for how this changes.
710 assert(bl
->norm
->Bl
.width
);
711 width
= a2width(p
, bl
->norm
->Bl
.width
) + term_len(p
, 2);
716 * List-type can override the width in the case of fixed-head
717 * values (bullet, dash/hyphen, enum). Tags need a non-zero
727 if (width
< term_len(p
, 4))
728 width
= term_len(p
, 4);
731 if (width
< term_len(p
, 5))
732 width
= term_len(p
, 5);
736 width
= term_len(p
, 8);
742 width
= term_len(p
, 10);
749 * Whitespace control. Inset bodies need an initial space,
750 * while diagonal bodies need two.
753 p
->flags
|= TERMP_NOSPACE
;
757 if (MDOC_BODY
== n
->type
)
758 term_word(p
, "\\ \\ ");
761 if (MDOC_BODY
== n
->type
)
768 p
->flags
|= TERMP_NOSPACE
;
772 if (MDOC_HEAD
== n
->type
)
773 term_fontpush(p
, TERMFONT_BOLD
);
780 * Pad and break control. This is the tricky part. These flags
781 * are documented in term_flushln() in term.c. Note that we're
782 * going to unset all of these flags in termp_it_post() when we
794 if (MDOC_HEAD
== n
->type
)
795 p
->flags
|= TERMP_NOBREAK
;
797 p
->flags
|= TERMP_NOLPAD
;
800 if (MDOC_HEAD
== n
->type
)
801 p
->flags
|= TERMP_NOBREAK
;
803 p
->flags
|= TERMP_NOLPAD
;
805 if (MDOC_HEAD
!= n
->type
)
809 * This is ugly. If `-hang' is specified and the body
810 * is a `Bl' or `Bd', then we want basically to nullify
811 * the "overstep" effect in term_flushln() and treat
812 * this as a `-ohang' list instead.
814 if (n
->next
->child
&&
815 (MDOC_Bl
== n
->next
->child
->tok
||
816 MDOC_Bd
== n
->next
->child
->tok
)) {
817 p
->flags
&= ~TERMP_NOBREAK
;
818 p
->flags
&= ~TERMP_NOLPAD
;
820 p
->flags
|= TERMP_HANG
;
823 if (MDOC_HEAD
== n
->type
)
824 p
->flags
|= TERMP_NOBREAK
| TERMP_TWOSPACE
;
826 p
->flags
|= TERMP_NOLPAD
;
828 if (MDOC_HEAD
!= n
->type
)
830 if (NULL
== n
->next
|| NULL
== n
->next
->child
)
831 p
->flags
|= TERMP_DANGLE
;
834 if (MDOC_HEAD
== n
->type
)
838 p
->flags
&= ~TERMP_NOBREAK
;
840 p
->flags
|= TERMP_NOBREAK
;
843 if (MDOC_BODY
== n
->prev
->type
)
844 p
->flags
|= TERMP_NOLPAD
;
848 if (MDOC_HEAD
== n
->type
)
849 p
->flags
|= TERMP_NOBREAK
;
856 * Margin control. Set-head-width lists have their right
857 * margins shortened. The body for these lists has the offset
858 * necessarily lengthened. Everybody gets the offset.
866 * Same stipulation as above, regarding `-hang'. We
867 * don't want to recalculate rmargin and offsets when
868 * using `Bd' or `Bl' within `-hang' overstep lists.
870 if (MDOC_HEAD
== n
->type
&& n
->next
->child
&&
871 (MDOC_Bl
== n
->next
->child
->tok
||
872 MDOC_Bd
== n
->next
->child
->tok
))
885 if (MDOC_HEAD
== n
->type
)
886 p
->rmargin
= p
->offset
+ width
;
892 p
->rmargin
= p
->offset
+ width
;
894 * XXX - this behaviour is not documented: the
895 * right-most column is filled to the right margin.
897 if (MDOC_HEAD
== n
->type
)
899 if (NULL
== n
->next
&& p
->rmargin
< p
->maxrmargin
)
900 p
->rmargin
= p
->maxrmargin
;
907 * The dash, hyphen, bullet and enum lists all have a special
908 * HEAD character (temporarily bold, in some cases).
911 if (MDOC_HEAD
== n
->type
)
914 term_fontpush(p
, TERMFONT_BOLD
);
915 term_word(p
, "\\[bu]");
921 term_fontpush(p
, TERMFONT_BOLD
);
922 term_word(p
, "\\(hy");
926 (pair
->ppair
->ppair
->count
)++;
927 snprintf(buf
, sizeof(buf
), "%d.",
928 pair
->ppair
->ppair
->count
);
936 * If we're not going to process our children, indicate so here.
949 if (MDOC_HEAD
== n
->type
)
953 if (MDOC_HEAD
== n
->type
)
966 termp_it_post(DECL_ARGS
)
970 if (MDOC_BLOCK
== n
->type
)
973 type
= n
->parent
->parent
->parent
->norm
->Bl
.type
;
981 if (MDOC_BODY
== n
->type
)
985 if (MDOC_BODY
== n
->type
)
994 * Now that our output is flushed, we can reset our tags. Since
995 * only `It' sets these flags, we're free to assume that nobody
996 * has munged them in the meanwhile.
999 p
->flags
&= ~TERMP_DANGLE
;
1000 p
->flags
&= ~TERMP_NOBREAK
;
1001 p
->flags
&= ~TERMP_TWOSPACE
;
1002 p
->flags
&= ~TERMP_NOLPAD
;
1003 p
->flags
&= ~TERMP_HANG
;
1009 termp_nm_pre(DECL_ARGS
)
1012 if (MDOC_BLOCK
== n
->type
)
1015 if (MDOC_BODY
== n
->type
) {
1016 if (NULL
== n
->child
)
1018 p
->flags
|= TERMP_NOLPAD
| TERMP_NOSPACE
;
1019 p
->offset
+= term_len(p
, 1) +
1020 (NULL
== n
->prev
->child
? term_strlen(p
, m
->name
) :
1021 MDOC_TEXT
== n
->prev
->child
->type
?
1022 term_strlen(p
, n
->prev
->child
->string
) :
1027 if (NULL
== n
->child
&& NULL
== m
->name
)
1030 if (MDOC_HEAD
== n
->type
)
1031 synopsis_pre(p
, n
->parent
);
1033 if (MDOC_HEAD
== n
->type
&& n
->next
->child
) {
1034 p
->flags
|= TERMP_NOSPACE
| TERMP_NOBREAK
;
1035 p
->rmargin
= p
->offset
+ term_len(p
, 1);
1036 if (NULL
== n
->child
) {
1037 p
->rmargin
+= term_strlen(p
, m
->name
);
1038 } else if (MDOC_TEXT
== n
->child
->type
) {
1039 p
->rmargin
+= term_strlen(p
, n
->child
->string
);
1041 p
->flags
|= TERMP_HANG
;
1043 p
->rmargin
+= term_len(p
, 5);
1044 p
->flags
|= TERMP_HANG
;
1048 term_fontpush(p
, TERMFONT_BOLD
);
1049 if (NULL
== n
->child
)
1050 term_word(p
, m
->name
);
1057 termp_nm_post(DECL_ARGS
)
1060 if (MDOC_HEAD
== n
->type
&& n
->next
->child
) {
1062 p
->flags
&= ~(TERMP_NOBREAK
| TERMP_HANG
);
1063 } else if (MDOC_BODY
== n
->type
&& n
->child
) {
1065 p
->flags
&= ~TERMP_NOLPAD
;
1072 termp_fl_pre(DECL_ARGS
)
1075 term_fontpush(p
, TERMFONT_BOLD
);
1076 term_word(p
, "\\-");
1079 p
->flags
|= TERMP_NOSPACE
;
1080 else if (n
->next
&& n
->next
->line
== n
->line
)
1081 p
->flags
|= TERMP_NOSPACE
;
1089 termp__a_pre(DECL_ARGS
)
1092 if (n
->prev
&& MDOC__A
== n
->prev
->tok
)
1093 if (NULL
== n
->next
|| MDOC__A
!= n
->next
->tok
)
1094 term_word(p
, "and");
1102 termp_an_pre(DECL_ARGS
)
1105 if (NULL
== n
->child
)
1109 * If not in the AUTHORS section, `An -split' will cause
1110 * newlines to occur before the author name. If in the AUTHORS
1111 * section, by default, the first `An' invocation is nosplit,
1112 * then all subsequent ones, regardless of whether interspersed
1113 * with other macros/text, are split. -split, in this case,
1114 * will override the condition of the implied first -nosplit.
1117 if (n
->sec
== SEC_AUTHORS
) {
1118 if ( ! (TERMP_ANPREC
& p
->flags
)) {
1119 if (TERMP_SPLIT
& p
->flags
)
1123 if (TERMP_NOSPLIT
& p
->flags
)
1129 if (TERMP_SPLIT
& p
->flags
)
1138 termp_an_post(DECL_ARGS
)
1142 if (SEC_AUTHORS
== n
->sec
)
1143 p
->flags
|= TERMP_ANPREC
;
1147 if (AUTH_split
== n
->norm
->An
.auth
) {
1148 p
->flags
&= ~TERMP_NOSPLIT
;
1149 p
->flags
|= TERMP_SPLIT
;
1150 } else if (AUTH_nosplit
== n
->norm
->An
.auth
) {
1151 p
->flags
&= ~TERMP_SPLIT
;
1152 p
->flags
|= TERMP_NOSPLIT
;
1160 termp_ns_pre(DECL_ARGS
)
1163 if ( ! (MDOC_LINE
& n
->flags
))
1164 p
->flags
|= TERMP_NOSPACE
;
1171 termp_rs_pre(DECL_ARGS
)
1174 if (SEC_SEE_ALSO
!= n
->sec
)
1176 if (MDOC_BLOCK
== n
->type
&& n
->prev
)
1184 termp_rv_pre(DECL_ARGS
)
1186 const struct mdoc_node
*nn
;
1189 term_word(p
, "The");
1191 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1192 term_fontpush(p
, TERMFONT_BOLD
);
1193 term_word(p
, nn
->string
);
1195 p
->flags
|= TERMP_NOSPACE
;
1196 if (nn
->next
&& NULL
== nn
->next
->next
)
1197 term_word(p
, "(), and");
1199 term_word(p
, "(),");
1204 if (n
->child
&& n
->child
->next
)
1205 term_word(p
, "functions return");
1207 term_word(p
, "function returns");
1209 term_word(p
, "the value 0 if successful; otherwise the value "
1210 "-1 is returned and the global variable");
1212 term_fontpush(p
, TERMFONT_UNDER
);
1213 term_word(p
, "errno");
1216 term_word(p
, "is set to indicate the error.");
1217 p
->flags
|= TERMP_SENTENCE
;
1225 termp_ex_pre(DECL_ARGS
)
1227 const struct mdoc_node
*nn
;
1229 term_word(p
, "The");
1231 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1232 term_fontpush(p
, TERMFONT_BOLD
);
1233 term_word(p
, nn
->string
);
1235 p
->flags
|= TERMP_NOSPACE
;
1236 if (nn
->next
&& NULL
== nn
->next
->next
)
1237 term_word(p
, ", and");
1241 p
->flags
&= ~TERMP_NOSPACE
;
1244 if (n
->child
&& n
->child
->next
)
1245 term_word(p
, "utilities exit");
1247 term_word(p
, "utility exits");
1249 term_word(p
, "0 on success, and >0 if an error occurs.");
1250 p
->flags
|= TERMP_SENTENCE
;
1258 termp_nd_pre(DECL_ARGS
)
1261 if (MDOC_BODY
!= n
->type
)
1264 #if defined(__OpenBSD__) || defined(__linux__)
1265 term_word(p
, "\\(en");
1267 term_word(p
, "\\(em");
1275 termp_bl_pre(DECL_ARGS
)
1278 return(MDOC_HEAD
!= n
->type
);
1284 termp_bl_post(DECL_ARGS
)
1287 if (MDOC_BLOCK
== n
->type
)
1294 termp_xr_pre(DECL_ARGS
)
1296 const struct mdoc_node
*nn
;
1298 if (NULL
== n
->child
)
1301 assert(MDOC_TEXT
== n
->child
->type
);
1304 term_word(p
, nn
->string
);
1305 if (NULL
== (nn
= nn
->next
))
1307 p
->flags
|= TERMP_NOSPACE
;
1309 term_word(p
, nn
->string
);
1317 * This decides how to assert whitespace before any of the SYNOPSIS set
1318 * of macros (which, as in the case of Ft/Fo and Ft/Fn, may contain
1322 synopsis_pre(struct termp
*p
, const struct mdoc_node
*n
)
1325 * Obviously, if we're not in a SYNOPSIS or no prior macros
1326 * exist, do nothing.
1328 if (NULL
== n
->prev
|| ! (MDOC_SYNPRETTY
& n
->flags
))
1332 * If we're the second in a pair of like elements, emit our
1333 * newline and return. UNLESS we're `Fo', `Fn', `Fn', in which
1334 * case we soldier on.
1336 if (n
->prev
->tok
== n
->tok
&&
1337 MDOC_Ft
!= n
->tok
&&
1338 MDOC_Fo
!= n
->tok
&&
1339 MDOC_Fn
!= n
->tok
) {
1345 * If we're one of the SYNOPSIS set and non-like pair-wise after
1346 * another (or Fn/Fo, which we've let slip through) then assert
1347 * vertical space, else only newline and move on.
1349 switch (n
->prev
->tok
) {
1362 if (MDOC_Fn
!= n
->tok
&& MDOC_Fo
!= n
->tok
) {
1375 termp_vt_pre(DECL_ARGS
)
1378 if (MDOC_ELEM
== n
->type
) {
1380 return(termp_under_pre(p
, pair
, m
, n
));
1381 } else if (MDOC_BLOCK
== n
->type
) {
1384 } else if (MDOC_HEAD
== n
->type
)
1387 return(termp_under_pre(p
, pair
, m
, n
));
1393 termp_bold_pre(DECL_ARGS
)
1396 term_fontpush(p
, TERMFONT_BOLD
);
1403 termp_fd_pre(DECL_ARGS
)
1407 return(termp_bold_pre(p
, pair
, m
, n
));
1413 termp_sh_pre(DECL_ARGS
)
1416 /* No vspace between consecutive `Sh' calls. */
1420 if (n
->prev
&& MDOC_Sh
== n
->prev
->tok
)
1421 if (NULL
== n
->prev
->body
->child
)
1426 term_fontpush(p
, TERMFONT_BOLD
);
1429 p
->offset
= term_len(p
, INDENT
);
1440 termp_sh_post(DECL_ARGS
)
1459 termp_bt_pre(DECL_ARGS
)
1462 term_word(p
, "is currently in beta test.");
1463 p
->flags
|= TERMP_SENTENCE
;
1470 termp_lb_post(DECL_ARGS
)
1473 if (SEC_LIBRARY
== n
->sec
&& MDOC_LINE
& n
->flags
)
1480 termp_ud_pre(DECL_ARGS
)
1483 term_word(p
, "currently under development.");
1484 p
->flags
|= TERMP_SENTENCE
;
1491 termp_d1_pre(DECL_ARGS
)
1494 if (MDOC_BLOCK
!= n
->type
)
1497 p
->offset
+= term_len(p
, (INDENT
+ 1));
1504 termp_d1_post(DECL_ARGS
)
1507 if (MDOC_BLOCK
!= n
->type
)
1515 termp_ft_pre(DECL_ARGS
)
1518 /* NB: MDOC_LINE does not effect this! */
1520 term_fontpush(p
, TERMFONT_UNDER
);
1527 termp_fn_pre(DECL_ARGS
)
1529 const struct mdoc_node
*nn
;
1533 term_fontpush(p
, TERMFONT_BOLD
);
1534 term_word(p
, n
->child
->string
);
1537 p
->flags
|= TERMP_NOSPACE
;
1540 for (nn
= n
->child
->next
; nn
; nn
= nn
->next
) {
1541 term_fontpush(p
, TERMFONT_UNDER
);
1542 term_word(p
, nn
->string
);
1551 if (MDOC_SYNPRETTY
& n
->flags
)
1560 termp_fa_pre(DECL_ARGS
)
1562 const struct mdoc_node
*nn
;
1564 if (n
->parent
->tok
!= MDOC_Fo
) {
1565 term_fontpush(p
, TERMFONT_UNDER
);
1569 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1570 term_fontpush(p
, TERMFONT_UNDER
);
1571 term_word(p
, nn
->string
);
1578 if (n
->child
&& n
->next
&& n
->next
->tok
== MDOC_Fa
)
1587 termp_bd_pre(DECL_ARGS
)
1589 size_t tabwidth
, rm
, rmax
;
1590 const struct mdoc_node
*nn
;
1592 if (MDOC_BLOCK
== n
->type
) {
1593 print_bvspace(p
, n
, n
);
1595 } else if (MDOC_HEAD
== n
->type
)
1598 if (n
->norm
->Bd
.offs
)
1599 p
->offset
+= a2offs(p
, n
->norm
->Bd
.offs
);
1602 * If -ragged or -filled are specified, the block does nothing
1603 * but change the indentation. If -unfilled or -literal are
1604 * specified, text is printed exactly as entered in the display:
1605 * for macro lines, a newline is appended to the line. Blank
1606 * lines are allowed.
1609 if (DISP_literal
!= n
->norm
->Bd
.type
&&
1610 DISP_unfilled
!= n
->norm
->Bd
.type
)
1613 tabwidth
= p
->tabwidth
;
1614 if (DISP_literal
== n
->norm
->Bd
.type
)
1615 p
->tabwidth
= term_len(p
, 8);
1618 rmax
= p
->maxrmargin
;
1619 p
->rmargin
= p
->maxrmargin
= TERM_MAXMARGIN
;
1621 for (nn
= n
->child
; nn
; nn
= nn
->next
) {
1622 print_mdoc_node(p
, pair
, m
, nn
);
1624 * If the printed node flushes its own line, then we
1625 * needn't do it here as well. This is hacky, but the
1626 * notion of selective eoln whitespace is pretty dumb
1627 * anyway, so don't sweat it.
1649 if (nn
->next
&& nn
->next
->line
== nn
->line
)
1652 p
->flags
|= TERMP_NOSPACE
;
1655 p
->tabwidth
= tabwidth
;
1657 p
->maxrmargin
= rmax
;
1664 termp_bd_post(DECL_ARGS
)
1668 if (MDOC_BODY
!= n
->type
)
1672 rmax
= p
->maxrmargin
;
1674 if (DISP_literal
== n
->norm
->Bd
.type
||
1675 DISP_unfilled
== n
->norm
->Bd
.type
)
1676 p
->rmargin
= p
->maxrmargin
= TERM_MAXMARGIN
;
1678 p
->flags
|= TERMP_NOSPACE
;
1682 p
->maxrmargin
= rmax
;
1688 termp_bx_pre(DECL_ARGS
)
1691 if (NULL
!= (n
= n
->child
)) {
1692 term_word(p
, n
->string
);
1693 p
->flags
|= TERMP_NOSPACE
;
1694 term_word(p
, "BSD");
1696 term_word(p
, "BSD");
1700 if (NULL
!= (n
= n
->next
)) {
1701 p
->flags
|= TERMP_NOSPACE
;
1703 p
->flags
|= TERMP_NOSPACE
;
1704 term_word(p
, n
->string
);
1713 termp_xx_pre(DECL_ARGS
)
1743 p
->flags
|= TERMP_KEEP
;
1744 term_word(p
, n
->child
->string
);
1745 p
->flags
&= ~TERMP_KEEP
;
1753 termp_igndelim_pre(DECL_ARGS
)
1756 p
->flags
|= TERMP_IGNDELIM
;
1763 termp_pf_post(DECL_ARGS
)
1766 p
->flags
|= TERMP_NOSPACE
;
1772 termp_ss_pre(DECL_ARGS
)
1782 term_fontpush(p
, TERMFONT_BOLD
);
1783 p
->offset
= term_len(p
, HALFINDENT
);
1795 termp_ss_post(DECL_ARGS
)
1798 if (MDOC_HEAD
== n
->type
)
1805 termp_cd_pre(DECL_ARGS
)
1809 term_fontpush(p
, TERMFONT_BOLD
);
1816 termp_in_pre(DECL_ARGS
)
1821 if (MDOC_SYNPRETTY
& n
->flags
&& MDOC_LINE
& n
->flags
) {
1822 term_fontpush(p
, TERMFONT_BOLD
);
1823 term_word(p
, "#include");
1827 term_fontpush(p
, TERMFONT_UNDER
);
1830 p
->flags
|= TERMP_NOSPACE
;
1837 termp_in_post(DECL_ARGS
)
1840 if (MDOC_SYNPRETTY
& n
->flags
)
1841 term_fontpush(p
, TERMFONT_BOLD
);
1843 p
->flags
|= TERMP_NOSPACE
;
1846 if (MDOC_SYNPRETTY
& n
->flags
)
1853 termp_sp_pre(DECL_ARGS
)
1859 len
= n
->child
? a2height(p
, n
->child
->string
) : 1;
1871 for (i
= 0; i
< len
; i
++)
1880 termp_quote_pre(DECL_ARGS
)
1883 if (MDOC_BODY
!= n
->type
&& MDOC_ELEM
!= n
->type
)
1935 p
->flags
|= TERMP_NOSPACE
;
1942 termp_quote_post(DECL_ARGS
)
1945 if (MDOC_BODY
!= n
->type
&& MDOC_ELEM
!= n
->type
)
1948 p
->flags
|= TERMP_NOSPACE
;
2003 termp_fo_pre(DECL_ARGS
)
2006 if (MDOC_BLOCK
== n
->type
) {
2009 } else if (MDOC_BODY
== n
->type
) {
2010 p
->flags
|= TERMP_NOSPACE
;
2015 if (NULL
== n
->child
)
2018 /* XXX: we drop non-initial arguments as per groff. */
2020 assert(n
->child
->string
);
2021 term_fontpush(p
, TERMFONT_BOLD
);
2022 term_word(p
, n
->child
->string
);
2029 termp_fo_post(DECL_ARGS
)
2032 if (MDOC_BODY
!= n
->type
)
2037 if (MDOC_SYNPRETTY
& n
->flags
)
2044 termp_bf_pre(DECL_ARGS
)
2047 if (MDOC_HEAD
== n
->type
)
2049 else if (MDOC_BLOCK
!= n
->type
)
2052 if (FONT_Em
== n
->norm
->Bf
.font
)
2053 term_fontpush(p
, TERMFONT_UNDER
);
2054 else if (FONT_Sy
== n
->norm
->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
;
2087 p
->flags
|= TERMP_NOSPACE
;
2094 termp____post(DECL_ARGS
)
2098 * Handle lists of authors. In general, print each followed by
2099 * a comma. Don't print the comma if there are only two
2102 if (MDOC__A
== n
->tok
&& n
->next
&& MDOC__A
== n
->next
->tok
)
2103 if (NULL
== n
->next
->next
|| MDOC__A
!= n
->next
->next
->tok
)
2104 if (NULL
== n
->prev
|| MDOC__A
!= n
->prev
->tok
)
2109 if (NULL
== n
->parent
|| MDOC_Rs
!= n
->parent
->tok
)
2112 if (NULL
== n
->next
) {
2114 p
->flags
|= TERMP_SENTENCE
;
2122 termp_li_pre(DECL_ARGS
)
2125 term_fontpush(p
, TERMFONT_NONE
);
2132 termp_lk_pre(DECL_ARGS
)
2134 const struct mdoc_node
*nn
, *sv
;
2136 term_fontpush(p
, TERMFONT_UNDER
);
2140 if (NULL
== nn
|| NULL
== nn
->next
)
2143 for (nn
= nn
->next
; nn
; nn
= nn
->next
)
2144 term_word(p
, nn
->string
);
2150 term_fontpush(p
, TERMFONT_BOLD
);
2151 term_word(p
, sv
->string
);
2160 termp_bk_pre(DECL_ARGS
)
2169 if (n
->parent
->args
|| 0 == n
->prev
->nchild
)
2170 p
->flags
|= TERMP_PREKEEP
;
2183 termp_bk_post(DECL_ARGS
)
2186 if (MDOC_BODY
== n
->type
)
2187 p
->flags
&= ~(TERMP_KEEP
| TERMP_PREKEEP
);
2192 termp__t_post(DECL_ARGS
)
2196 * If we're in an `Rs' and there's a journal present, then quote
2197 * us instead of underlining us (for disambiguation).
2199 if (n
->parent
&& MDOC_Rs
== n
->parent
->tok
&&
2200 n
->parent
->norm
->Rs
.quote_T
)
2201 termp_quote_post(p
, pair
, m
, n
);
2203 termp____post(p
, pair
, m
, n
);
2208 termp__t_pre(DECL_ARGS
)
2212 * If we're in an `Rs' and there's a journal present, then quote
2213 * us instead of underlining us (for disambiguation).
2215 if (n
->parent
&& MDOC_Rs
== n
->parent
->tok
&&
2216 n
->parent
->norm
->Rs
.quote_T
)
2217 return(termp_quote_pre(p
, pair
, m
, n
));
2219 term_fontpush(p
, TERMFONT_UNDER
);
2225 termp_under_pre(DECL_ARGS
)
2228 term_fontpush(p
, TERMFONT_UNDER
);