]>
git.cameronkatri.com Git - mandoc.git/blob - man_term.c
1 /* $Id: man_term.c,v 1.151 2014/09/03 05:22:45 schwarze Exp $ */
3 * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2010-2014 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.
20 #include <sys/types.h>
29 #include "mandoc_aux.h"
35 #define MAXMARGINS 64 /* maximum number of indented scopes */
39 #define MANT_LITERAL (1 << 0)
40 size_t lmargin
[MAXMARGINS
]; /* margins (incl. visible page) */
41 int lmargincur
; /* index of current margin */
42 int lmarginsz
; /* actual number of nested margins */
43 size_t offset
; /* default offset to visible page */
44 int pardist
; /* vert. space before par., unit: [v] */
47 #define DECL_ARGS struct termp *p, \
49 const struct man_node *n, \
50 const struct man_meta *meta
53 int (*pre
)(DECL_ARGS
);
54 void (*post
)(DECL_ARGS
);
56 #define MAN_NOTEXT (1 << 0) /* Never has text children. */
59 static int a2width(const struct termp
*, const char *);
60 static size_t a2height(const struct termp
*, const char *);
62 static void print_man_nodelist(DECL_ARGS
);
63 static void print_man_node(DECL_ARGS
);
64 static void print_man_head(struct termp
*, const void *);
65 static void print_man_foot(struct termp
*, const void *);
66 static void print_bvspace(struct termp
*,
67 const struct man_node
*, int);
69 static int pre_B(DECL_ARGS
);
70 static int pre_HP(DECL_ARGS
);
71 static int pre_I(DECL_ARGS
);
72 static int pre_IP(DECL_ARGS
);
73 static int pre_OP(DECL_ARGS
);
74 static int pre_PD(DECL_ARGS
);
75 static int pre_PP(DECL_ARGS
);
76 static int pre_RS(DECL_ARGS
);
77 static int pre_SH(DECL_ARGS
);
78 static int pre_SS(DECL_ARGS
);
79 static int pre_TP(DECL_ARGS
);
80 static int pre_UR(DECL_ARGS
);
81 static int pre_alternate(DECL_ARGS
);
82 static int pre_ft(DECL_ARGS
);
83 static int pre_ign(DECL_ARGS
);
84 static int pre_in(DECL_ARGS
);
85 static int pre_literal(DECL_ARGS
);
86 static int pre_ll(DECL_ARGS
);
87 static int pre_sp(DECL_ARGS
);
89 static void post_IP(DECL_ARGS
);
90 static void post_HP(DECL_ARGS
);
91 static void post_RS(DECL_ARGS
);
92 static void post_SH(DECL_ARGS
);
93 static void post_SS(DECL_ARGS
);
94 static void post_TP(DECL_ARGS
);
95 static void post_UR(DECL_ARGS
);
97 static const struct termact termacts
[MAN_MAX
] = {
98 { pre_sp
, NULL
, MAN_NOTEXT
}, /* br */
99 { NULL
, NULL
, 0 }, /* TH */
100 { pre_SH
, post_SH
, 0 }, /* SH */
101 { pre_SS
, post_SS
, 0 }, /* SS */
102 { pre_TP
, post_TP
, 0 }, /* TP */
103 { pre_PP
, NULL
, 0 }, /* LP */
104 { pre_PP
, NULL
, 0 }, /* PP */
105 { pre_PP
, NULL
, 0 }, /* P */
106 { pre_IP
, post_IP
, 0 }, /* IP */
107 { pre_HP
, post_HP
, 0 }, /* HP */
108 { NULL
, NULL
, 0 }, /* SM */
109 { pre_B
, NULL
, 0 }, /* SB */
110 { pre_alternate
, NULL
, 0 }, /* BI */
111 { pre_alternate
, NULL
, 0 }, /* IB */
112 { pre_alternate
, NULL
, 0 }, /* BR */
113 { pre_alternate
, NULL
, 0 }, /* RB */
114 { NULL
, NULL
, 0 }, /* R */
115 { pre_B
, NULL
, 0 }, /* B */
116 { pre_I
, NULL
, 0 }, /* I */
117 { pre_alternate
, NULL
, 0 }, /* IR */
118 { pre_alternate
, NULL
, 0 }, /* RI */
119 { pre_ign
, NULL
, MAN_NOTEXT
}, /* na */
120 { pre_sp
, NULL
, MAN_NOTEXT
}, /* sp */
121 { pre_literal
, NULL
, 0 }, /* nf */
122 { pre_literal
, NULL
, 0 }, /* fi */
123 { NULL
, NULL
, 0 }, /* RE */
124 { pre_RS
, post_RS
, 0 }, /* RS */
125 { pre_ign
, NULL
, 0 }, /* DT */
126 { pre_ign
, NULL
, 0 }, /* UC */
127 { pre_PD
, NULL
, MAN_NOTEXT
}, /* PD */
128 { pre_ign
, NULL
, 0 }, /* AT */
129 { pre_in
, NULL
, MAN_NOTEXT
}, /* in */
130 { pre_ft
, NULL
, MAN_NOTEXT
}, /* ft */
131 { pre_OP
, NULL
, 0 }, /* OP */
132 { pre_literal
, NULL
, 0 }, /* EX */
133 { pre_literal
, NULL
, 0 }, /* EE */
134 { pre_UR
, post_UR
, 0 }, /* UR */
135 { NULL
, NULL
, 0 }, /* UE */
136 { pre_ll
, NULL
, MAN_NOTEXT
}, /* ll */
141 terminal_man(void *arg
, const struct man
*man
)
144 const struct man_meta
*meta
;
148 p
= (struct termp
*)arg
;
151 p
->rmargin
= p
->maxrmargin
= p
->defrmargin
;
152 p
->tabwidth
= term_len(p
, 5);
154 if (NULL
== p
->symtab
)
155 p
->symtab
= mchars_alloc();
157 n
= man_node(man
)->child
;
158 meta
= man_meta(man
);
160 memset(&mt
, 0, sizeof(struct mtermp
));
162 mt
.lmargin
[mt
.lmargincur
] = term_len(p
, p
->defindent
);
163 mt
.offset
= term_len(p
, p
->defindent
);
166 if (p
->synopsisonly
) {
168 if (n
->tok
== MAN_SH
&&
169 n
->child
->child
->type
== MAN_TEXT
&&
170 !strcmp(n
->child
->child
->string
, "SYNOPSIS")) {
171 if (n
->child
->next
->child
!= NULL
)
172 print_man_nodelist(p
, &mt
,
173 n
->child
->next
->child
, meta
);
180 if (p
->defindent
== 0)
182 term_begin(p
, print_man_head
, print_man_foot
, meta
);
183 p
->flags
|= TERMP_NOSPACE
;
185 print_man_nodelist(p
, &mt
, n
, meta
);
192 a2height(const struct termp
*p
, const char *cp
)
196 if ( ! a2roffsu(cp
, &su
, SCALE_VS
))
197 SCALE_VS_INIT(&su
, atoi(cp
));
199 return(term_vspan(p
, &su
));
203 a2width(const struct termp
*p
, const char *cp
)
207 if ( ! a2roffsu(cp
, &su
, SCALE_BU
))
210 return((int)term_hspan(p
, &su
));
214 * Printing leading vertical space before a block.
215 * This is used for the paragraph macros.
216 * The rules are pretty simple, since there's very little nesting going
217 * on here. Basically, if we're the first within another block (SS/SH),
218 * then don't emit vertical space. If we are (RS), then do. If not the
222 print_bvspace(struct termp
*p
, const struct man_node
*n
, int pardist
)
228 if (n
->body
&& n
->body
->child
)
229 if (MAN_TBL
== n
->body
->child
->type
)
232 if (MAN_ROOT
== n
->parent
->type
|| MAN_RS
!= n
->parent
->tok
)
236 for (i
= 0; i
< pardist
; i
++)
252 term_setwidth(p
, n
->nchild
? n
->child
->string
: NULL
);
260 term_fontrepl(p
, TERMFONT_UNDER
);
265 pre_literal(DECL_ARGS
)
270 if (MAN_nf
== n
->tok
|| MAN_EX
== n
->tok
)
271 mt
->fl
|= MANT_LITERAL
;
273 mt
->fl
&= ~MANT_LITERAL
;
276 * Unlike .IP and .TP, .HP does not have a HEAD.
277 * So in case a second call to term_flushln() is needed,
278 * indentation has to be set up explicitly.
280 if (MAN_HP
== n
->parent
->tok
&& p
->rmargin
< p
->maxrmargin
) {
281 p
->offset
= p
->rmargin
;
282 p
->rmargin
= p
->maxrmargin
;
284 p
->flags
&= ~(TERMP_NOBREAK
| TERMP_BRIND
);
285 p
->flags
|= TERMP_NOSPACE
;
300 assert(MAN_TEXT
== n
->type
);
301 mt
->pardist
= atoi(n
->string
);
306 pre_alternate(DECL_ARGS
)
308 enum termfont font
[2];
309 const struct man_node
*nn
;
314 font
[0] = TERMFONT_NONE
;
315 font
[1] = TERMFONT_BOLD
;
318 font
[0] = TERMFONT_NONE
;
319 font
[1] = TERMFONT_UNDER
;
322 font
[0] = TERMFONT_BOLD
;
323 font
[1] = TERMFONT_NONE
;
326 font
[0] = TERMFONT_BOLD
;
327 font
[1] = TERMFONT_UNDER
;
330 font
[0] = TERMFONT_UNDER
;
331 font
[1] = TERMFONT_NONE
;
334 font
[0] = TERMFONT_UNDER
;
335 font
[1] = TERMFONT_BOLD
;
341 savelit
= MANT_LITERAL
& mt
->fl
;
342 mt
->fl
&= ~MANT_LITERAL
;
344 for (i
= 0, nn
= n
->child
; nn
; nn
= nn
->next
, i
= 1 - i
) {
345 term_fontrepl(p
, font
[i
]);
346 if (savelit
&& NULL
== nn
->next
)
347 mt
->fl
|= MANT_LITERAL
;
348 print_man_node(p
, mt
, nn
, meta
);
350 p
->flags
|= TERMP_NOSPACE
;
360 term_fontrepl(p
, TERMFONT_BOLD
);
369 p
->flags
|= TERMP_NOSPACE
;
371 if (NULL
!= (n
= n
->child
)) {
372 term_fontrepl(p
, TERMFONT_BOLD
);
373 term_word(p
, n
->string
);
375 if (NULL
!= n
&& NULL
!= n
->next
) {
376 term_fontrepl(p
, TERMFONT_UNDER
);
377 term_word(p
, n
->next
->string
);
380 term_fontrepl(p
, TERMFONT_NONE
);
381 p
->flags
|= TERMP_NOSPACE
;
391 if (NULL
== n
->child
) {
396 cp
= n
->child
->string
;
403 term_fontrepl(p
, TERMFONT_BOLD
);
408 term_fontrepl(p
, TERMFONT_UNDER
);
418 term_fontrepl(p
, TERMFONT_NONE
);
435 if (NULL
== n
->child
) {
436 p
->offset
= mt
->offset
;
440 cp
= n
->child
->string
;
450 if ((len
= a2width(p
, ++cp
)) < 0)
456 p
->offset
-= p
->offset
> v
? v
: p
->offset
;
462 /* Don't let this creep beyond the right margin. */
464 if (p
->offset
> p
->rmargin
)
465 p
->offset
= p
->rmargin
;
477 if ((NULL
== n
->prev
&& n
->parent
)) {
478 switch (n
->parent
->tok
) {
501 if (NULL
== n
->child
) {
505 s
= n
->child
->string
;
510 len
= a2height(p
, s
);
519 for (i
= 0; i
< len
; i
++)
530 const struct man_node
*nn
;
534 print_bvspace(p
, n
, mt
->pardist
);
542 if ( ! (MANT_LITERAL
& mt
->fl
)) {
543 p
->flags
|= TERMP_NOBREAK
| TERMP_BRIND
;
547 len
= mt
->lmargin
[mt
->lmargincur
];
550 /* Calculate offset. */
552 if (NULL
!= (nn
= n
->parent
->head
->child
))
553 if ((ival
= a2width(p
, nn
->string
)) >= 0)
556 one
= term_len(p
, 1);
560 p
->offset
= mt
->offset
;
561 p
->rmargin
= mt
->offset
+ len
;
564 mt
->lmargin
[mt
->lmargincur
] = (size_t)ival
;
576 p
->flags
&= ~(TERMP_NOBREAK
| TERMP_BRIND
);
578 p
->offset
= mt
->offset
;
579 p
->rmargin
= p
->maxrmargin
;
592 mt
->lmargin
[mt
->lmargincur
] = term_len(p
, p
->defindent
);
593 print_bvspace(p
, n
, mt
->pardist
);
596 p
->offset
= mt
->offset
;
600 return(MAN_HEAD
!= n
->type
);
606 const struct man_node
*nn
;
612 p
->flags
|= TERMP_NOSPACE
;
615 p
->flags
|= TERMP_NOBREAK
;
619 print_bvspace(p
, n
, mt
->pardist
);
625 len
= mt
->lmargin
[mt
->lmargincur
];
628 /* Calculate the offset from the optional second argument. */
629 if (NULL
!= (nn
= n
->parent
->head
->child
))
630 if (NULL
!= (nn
= nn
->next
))
631 if ((ival
= a2width(p
, nn
->string
)) >= 0)
636 /* Handle zero-width lengths. */
638 len
= term_len(p
, 1);
640 p
->offset
= mt
->offset
;
641 p
->rmargin
= mt
->offset
+ len
;
645 /* Set the saved left-margin. */
646 mt
->lmargin
[mt
->lmargincur
] = (size_t)ival
;
648 savelit
= MANT_LITERAL
& mt
->fl
;
649 mt
->fl
&= ~MANT_LITERAL
;
652 print_man_node(p
, mt
, n
->child
, meta
);
655 mt
->fl
|= MANT_LITERAL
;
659 p
->offset
= mt
->offset
+ len
;
660 p
->rmargin
= p
->maxrmargin
> p
->offset
?
661 p
->maxrmargin
: p
->offset
;
677 p
->flags
&= ~TERMP_NOBREAK
;
679 p
->rmargin
= p
->maxrmargin
;
683 p
->offset
= mt
->offset
;
693 const struct man_node
*nn
;
699 p
->flags
|= TERMP_NOBREAK
;
703 p
->flags
|= TERMP_NOSPACE
;
706 print_bvspace(p
, n
, mt
->pardist
);
712 len
= (size_t)mt
->lmargin
[mt
->lmargincur
];
715 /* Calculate offset. */
717 if (NULL
!= (nn
= n
->parent
->head
->child
))
718 if (nn
->string
&& 0 == (MAN_LINE
& nn
->flags
))
719 if ((ival
= a2width(p
, nn
->string
)) >= 0)
724 /* Handle zero-length properly. */
726 len
= term_len(p
, 1);
728 p
->offset
= mt
->offset
;
729 p
->rmargin
= mt
->offset
+ len
;
731 savelit
= MANT_LITERAL
& mt
->fl
;
732 mt
->fl
&= ~MANT_LITERAL
;
734 /* Don't print same-line elements. */
736 while (NULL
!= nn
&& 0 == (MAN_LINE
& nn
->flags
))
740 print_man_node(p
, mt
, nn
, meta
);
745 mt
->fl
|= MANT_LITERAL
;
747 mt
->lmargin
[mt
->lmargincur
] = (size_t)ival
;
751 p
->offset
= mt
->offset
+ len
;
752 p
->rmargin
= p
->maxrmargin
> p
->offset
?
753 p
->maxrmargin
: p
->offset
;
755 p
->flags
&= ~TERMP_NOBREAK
;
774 p
->offset
= mt
->offset
;
788 mt
->fl
&= ~MANT_LITERAL
;
789 mt
->lmargin
[mt
->lmargincur
] = term_len(p
, p
->defindent
);
790 mt
->offset
= term_len(p
, p
->defindent
);
791 /* If following a prior empty `SS', no vspace. */
792 if (n
->prev
&& MAN_SS
== n
->prev
->tok
)
793 if (NULL
== n
->prev
->body
->child
)
797 for (i
= 0; i
< mt
->pardist
; i
++)
801 term_fontrepl(p
, TERMFONT_BOLD
);
802 p
->offset
= term_len(p
, 3);
805 p
->offset
= mt
->offset
;
837 mt
->fl
&= ~MANT_LITERAL
;
838 mt
->lmargin
[mt
->lmargincur
] = term_len(p
, p
->defindent
);
839 mt
->offset
= term_len(p
, p
->defindent
);
840 /* If following a prior empty `SH', no vspace. */
841 if (n
->prev
&& MAN_SH
== n
->prev
->tok
)
842 if (NULL
== n
->prev
->body
->child
)
844 /* If the first macro, no vspae. */
847 for (i
= 0; i
< mt
->pardist
; i
++)
851 term_fontrepl(p
, TERMFONT_BOLD
);
855 p
->offset
= mt
->offset
;
896 sz
= term_len(p
, p
->defindent
);
898 if (NULL
!= (n
= n
->parent
->head
->child
))
899 if ((ival
= a2width(p
, n
->string
)) >= 0)
903 p
->offset
= mt
->offset
;
904 p
->rmargin
= p
->maxrmargin
> p
->offset
?
905 p
->maxrmargin
: p
->offset
;
907 if (++mt
->lmarginsz
< MAXMARGINS
)
908 mt
->lmargincur
= mt
->lmarginsz
;
910 mt
->lmargin
[mt
->lmargincur
] = mt
->lmargin
[mt
->lmargincur
- 1];
930 sz
= term_len(p
, p
->defindent
);
932 if (NULL
!= (n
= n
->parent
->head
->child
))
933 if ((ival
= a2width(p
, n
->string
)) >= 0)
936 mt
->offset
= mt
->offset
< sz
? 0 : mt
->offset
- sz
;
937 p
->offset
= mt
->offset
;
939 if (--mt
->lmarginsz
< MAXMARGINS
)
940 mt
->lmargincur
= mt
->lmarginsz
;
947 return (MAN_HEAD
!= n
->type
);
954 if (MAN_BLOCK
!= n
->type
)
958 p
->flags
|= TERMP_NOSPACE
;
960 if (NULL
!= n
->child
->child
)
961 print_man_node(p
, mt
, n
->child
->child
, meta
);
963 p
->flags
|= TERMP_NOSPACE
;
968 print_man_node(DECL_ARGS
)
976 * If we have a blank line, output a vertical space.
977 * If we have a space as the first character, break
978 * before printing the line's data.
980 if ('\0' == *n
->string
) {
983 } else if (' ' == *n
->string
&& MAN_LINE
& n
->flags
)
986 term_word(p
, n
->string
);
994 * Tables are preceded by a newline. Then process a
995 * table line, which will cause line termination,
997 if (TBL_SPAN_FIRST
& n
->span
->flags
)
999 term_tbl(p
, n
->span
);
1005 if ( ! (MAN_NOTEXT
& termacts
[n
->tok
].flags
))
1006 term_fontrepl(p
, TERMFONT_NONE
);
1009 if (termacts
[n
->tok
].pre
)
1010 c
= (*termacts
[n
->tok
].pre
)(p
, mt
, n
, meta
);
1013 print_man_nodelist(p
, mt
, n
->child
, meta
);
1015 if (termacts
[n
->tok
].post
)
1016 (*termacts
[n
->tok
].post
)(p
, mt
, n
, meta
);
1017 if ( ! (MAN_NOTEXT
& termacts
[n
->tok
].flags
))
1018 term_fontrepl(p
, TERMFONT_NONE
);
1022 * If we're in a literal context, make sure that words
1023 * together on the same line stay together. This is a
1024 * POST-printing call, so we check the NEXT word. Since
1025 * -man doesn't have nested macros, we don't need to be
1026 * more specific than this.
1028 if (MANT_LITERAL
& mt
->fl
&& ! (TERMP_NOBREAK
& p
->flags
) &&
1029 (NULL
== n
->next
|| MAN_LINE
& n
->next
->flags
)) {
1031 rmax
= p
->maxrmargin
;
1032 p
->rmargin
= p
->maxrmargin
= TERM_MAXMARGIN
;
1033 p
->flags
|= TERMP_NOSPACE
;
1034 if (NULL
!= n
->string
&& '\0' != *n
->string
)
1038 if (rm
< rmax
&& n
->parent
->tok
== MAN_HP
) {
1043 p
->maxrmargin
= rmax
;
1045 if (MAN_EOS
& n
->flags
)
1046 p
->flags
|= TERMP_SENTENCE
;
1051 print_man_nodelist(DECL_ARGS
)
1054 print_man_node(p
, mt
, n
, meta
);
1057 print_man_nodelist(p
, mt
, n
->next
, meta
);
1061 print_man_foot(struct termp
*p
, const void *arg
)
1063 const struct man_meta
*meta
;
1067 meta
= (const struct man_meta
*)arg
;
1068 assert(meta
->title
);
1072 term_fontrepl(p
, TERMFONT_NONE
);
1078 * Temporary, undocumented option to imitate mdoc(7) output.
1079 * In the bottom right corner, use the source instead of
1083 if ( ! p
->mdocstyle
) {
1084 if (meta
->hasbody
) {
1088 mandoc_asprintf(&title
, "%s(%s)",
1089 meta
->title
, meta
->msec
);
1090 } else if (meta
->source
) {
1091 title
= mandoc_strdup(meta
->source
);
1093 title
= mandoc_strdup("");
1095 datelen
= term_strlen(p
, meta
->date
);
1097 /* Bottom left corner: manual source. */
1099 p
->flags
|= TERMP_NOSPACE
| TERMP_NOBREAK
;
1102 p
->rmargin
= (p
->maxrmargin
- datelen
+ term_len(p
, 1)) / 2;
1105 term_word(p
, meta
->source
);
1108 /* At the bottom in the middle: manual date. */
1110 p
->flags
|= TERMP_NOSPACE
;
1111 p
->offset
= p
->rmargin
;
1112 p
->rmargin
= p
->maxrmargin
- term_strlen(p
, title
);
1113 if (p
->offset
+ datelen
>= p
->rmargin
)
1114 p
->rmargin
= p
->offset
+ datelen
;
1116 term_word(p
, meta
->date
);
1119 /* Bottom right corner: manual title and section. */
1121 p
->flags
&= ~TERMP_NOBREAK
;
1122 p
->flags
|= TERMP_NOSPACE
;
1124 p
->offset
= p
->rmargin
;
1125 p
->rmargin
= p
->maxrmargin
;
1127 term_word(p
, title
);
1133 print_man_head(struct termp
*p
, const void *arg
)
1135 const struct man_meta
*meta
;
1138 size_t vollen
, titlen
;
1140 meta
= (const struct man_meta
*)arg
;
1141 assert(meta
->title
);
1144 volume
= NULL
== meta
->vol
? "" : meta
->vol
;
1145 vollen
= term_strlen(p
, volume
);
1147 /* Top left corner: manual title and section. */
1149 mandoc_asprintf(&title
, "%s(%s)", meta
->title
, meta
->msec
);
1150 titlen
= term_strlen(p
, title
);
1152 p
->flags
|= TERMP_NOBREAK
| TERMP_NOSPACE
;
1155 p
->rmargin
= 2 * (titlen
+1) + vollen
< p
->maxrmargin
?
1156 (p
->maxrmargin
- vollen
+ term_len(p
, 1)) / 2 :
1157 p
->maxrmargin
- vollen
;
1159 term_word(p
, title
);
1162 /* At the top in the middle: manual volume. */
1164 p
->flags
|= TERMP_NOSPACE
;
1165 p
->offset
= p
->rmargin
;
1166 p
->rmargin
= p
->offset
+ vollen
+ titlen
< p
->maxrmargin
?
1167 p
->maxrmargin
- titlen
: p
->maxrmargin
;
1169 term_word(p
, volume
);
1172 /* Top right corner: title and section, again. */
1174 p
->flags
&= ~TERMP_NOBREAK
;
1176 if (p
->rmargin
+ titlen
<= p
->maxrmargin
) {
1177 p
->flags
|= TERMP_NOSPACE
;
1178 p
->offset
= p
->rmargin
;
1179 p
->rmargin
= p
->maxrmargin
;
1180 term_word(p
, title
);
1184 p
->flags
&= ~TERMP_NOSPACE
;
1186 p
->rmargin
= p
->maxrmargin
;
1189 * Groff prints three blank lines before the content.
1190 * Do the same, except in the temporary, undocumented
1191 * mode imitating mdoc(7) output.
1195 if ( ! p
->mdocstyle
) {