Annotation of mandoc/man_term.c, Revision 1.196
1.196 ! schwarze 1: /* $Id: man_term.c,v 1.195 2017/05/05 02:06:19 schwarze Exp $ */
1.1 kristaps 2: /*
1.128 schwarze 3: * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
1.189 schwarze 4: * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
1.1 kristaps 5: *
6: * Permission to use, copy, modify, and distribute this software for any
1.8 kristaps 7: * purpose with or without fee is hereby granted, provided that the above
8: * copyright notice and this permission notice appear in all copies.
1.1 kristaps 9: *
1.171 schwarze 10: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1.8 kristaps 11: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1.171 schwarze 12: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1.8 kristaps 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.
1.1 kristaps 17: */
1.55 kristaps 18: #include "config.h"
19:
1.28 kristaps 20: #include <sys/types.h>
21:
1.1 kristaps 22: #include <assert.h>
1.18 kristaps 23: #include <ctype.h>
1.164 schwarze 24: #include <limits.h>
1.1 kristaps 25: #include <stdio.h>
26: #include <stdlib.h>
27: #include <string.h>
28:
1.171 schwarze 29: #include "mandoc_aux.h"
1.71 kristaps 30: #include "mandoc.h"
1.171 schwarze 31: #include "roff.h"
32: #include "man.h"
1.40 kristaps 33: #include "out.h"
1.1 kristaps 34: #include "term.h"
1.36 kristaps 35: #include "main.h"
1.1 kristaps 36:
1.116 schwarze 37: #define MAXMARGINS 64 /* maximum number of indented scopes */
1.18 kristaps 38:
1.24 kristaps 39: struct mtermp {
40: int fl;
1.19 kristaps 41: #define MANT_LITERAL (1 << 0)
1.163 schwarze 42: int lmargin[MAXMARGINS]; /* margins (incl. vis. page) */
1.116 schwarze 43: int lmargincur; /* index of current margin */
44: int lmarginsz; /* actual number of nested margins */
45: size_t offset; /* default offset to visible page */
1.134 schwarze 46: int pardist; /* vert. space before par., unit: [v] */
1.24 kristaps 47: };
1.19 kristaps 48:
1.146 schwarze 49: #define DECL_ARGS struct termp *p, \
1.24 kristaps 50: struct mtermp *mt, \
1.172 schwarze 51: struct roff_node *n, \
1.173 schwarze 52: const struct roff_meta *meta
1.1 kristaps 53:
54: struct termact {
55: int (*pre)(DECL_ARGS);
56: void (*post)(DECL_ARGS);
1.56 kristaps 57: int flags;
58: #define MAN_NOTEXT (1 << 0) /* Never has text children. */
1.1 kristaps 59: };
60:
1.52 kristaps 61: static void print_man_nodelist(DECL_ARGS);
1.45 kristaps 62: static void print_man_node(DECL_ARGS);
1.173 schwarze 63: static void print_man_head(struct termp *,
64: const struct roff_meta *);
65: static void print_man_foot(struct termp *,
66: const struct roff_meta *);
1.146 schwarze 67: static void print_bvspace(struct termp *,
1.172 schwarze 68: const struct roff_node *, int);
1.39 kristaps 69:
1.1 kristaps 70: static int pre_B(DECL_ARGS);
1.19 kristaps 71: static int pre_HP(DECL_ARGS);
1.1 kristaps 72: static int pre_I(DECL_ARGS);
1.4 kristaps 73: static int pre_IP(DECL_ARGS);
1.127 kristaps 74: static int pre_OP(DECL_ARGS);
1.134 schwarze 75: static int pre_PD(DECL_ARGS);
1.1 kristaps 76: static int pre_PP(DECL_ARGS);
1.26 kristaps 77: static int pre_RS(DECL_ARGS);
1.1 kristaps 78: static int pre_SH(DECL_ARGS);
79: static int pre_SS(DECL_ARGS);
80: static int pre_TP(DECL_ARGS);
1.137 schwarze 81: static int pre_UR(DECL_ARGS);
1.127 kristaps 82: static int pre_alternate(DECL_ARGS);
1.29 kristaps 83: static int pre_ign(DECL_ARGS);
1.83 kristaps 84: static int pre_in(DECL_ARGS);
1.84 kristaps 85: static int pre_literal(DECL_ARGS);
1.19 kristaps 86: static int pre_sp(DECL_ARGS);
1.1 kristaps 87:
1.22 kristaps 88: static void post_IP(DECL_ARGS);
1.20 kristaps 89: static void post_HP(DECL_ARGS);
1.26 kristaps 90: static void post_RS(DECL_ARGS);
1.1 kristaps 91: static void post_SH(DECL_ARGS);
92: static void post_SS(DECL_ARGS);
1.21 kristaps 93: static void post_TP(DECL_ARGS);
1.137 schwarze 94: static void post_UR(DECL_ARGS);
1.1 kristaps 95:
1.192 schwarze 96: static const struct termact __termacts[MAN_MAX - MAN_TH] = {
1.56 kristaps 97: { NULL, NULL, 0 }, /* TH */
98: { pre_SH, post_SH, 0 }, /* SH */
99: { pre_SS, post_SS, 0 }, /* SS */
100: { pre_TP, post_TP, 0 }, /* TP */
101: { pre_PP, NULL, 0 }, /* LP */
102: { pre_PP, NULL, 0 }, /* PP */
103: { pre_PP, NULL, 0 }, /* P */
104: { pre_IP, post_IP, 0 }, /* IP */
1.146 schwarze 105: { pre_HP, post_HP, 0 }, /* HP */
1.56 kristaps 106: { NULL, NULL, 0 }, /* SM */
107: { pre_B, NULL, 0 }, /* SB */
1.88 kristaps 108: { pre_alternate, NULL, 0 }, /* BI */
109: { pre_alternate, NULL, 0 }, /* IB */
110: { pre_alternate, NULL, 0 }, /* BR */
111: { pre_alternate, NULL, 0 }, /* RB */
1.56 kristaps 112: { NULL, NULL, 0 }, /* R */
113: { pre_B, NULL, 0 }, /* B */
114: { pre_I, NULL, 0 }, /* I */
1.88 kristaps 115: { pre_alternate, NULL, 0 }, /* IR */
116: { pre_alternate, NULL, 0 }, /* RI */
1.56 kristaps 117: { pre_sp, NULL, MAN_NOTEXT }, /* sp */
1.84 kristaps 118: { pre_literal, NULL, 0 }, /* nf */
119: { pre_literal, NULL, 0 }, /* fi */
1.56 kristaps 120: { NULL, NULL, 0 }, /* RE */
121: { pre_RS, post_RS, 0 }, /* RS */
122: { pre_ign, NULL, 0 }, /* DT */
1.158 schwarze 123: { pre_ign, NULL, MAN_NOTEXT }, /* UC */
1.134 schwarze 124: { pre_PD, NULL, MAN_NOTEXT }, /* PD */
1.70 joerg 125: { pre_ign, NULL, 0 }, /* AT */
1.83 kristaps 126: { pre_in, NULL, MAN_NOTEXT }, /* in */
1.127 kristaps 127: { pre_OP, NULL, 0 }, /* OP */
1.129 schwarze 128: { pre_literal, NULL, 0 }, /* EX */
129: { pre_literal, NULL, 0 }, /* EE */
1.137 schwarze 130: { pre_UR, post_UR, 0 }, /* UR */
131: { NULL, NULL, 0 }, /* UE */
1.1 kristaps 132: };
1.192 schwarze 133: static const struct termact *termacts = __termacts - MAN_TH;
1.1 kristaps 134:
135:
1.31 kristaps 136: void
1.180 schwarze 137: terminal_man(void *arg, const struct roff_man *man)
1.1 kristaps 138: {
1.36 kristaps 139: struct termp *p;
1.172 schwarze 140: struct roff_node *n;
1.36 kristaps 141: struct mtermp mt;
1.189 schwarze 142: size_t save_defindent;
1.36 kristaps 143:
144: p = (struct termp *)arg;
1.58 kristaps 145: p->overstep = 0;
1.151 schwarze 146: p->rmargin = p->maxrmargin = p->defrmargin;
1.77 kristaps 147: p->tabwidth = term_len(p, 5);
1.36 kristaps 148:
1.116 schwarze 149: memset(&mt, 0, sizeof(struct mtermp));
1.122 schwarze 150: mt.lmargin[mt.lmargincur] = term_len(p, p->defindent);
151: mt.offset = term_len(p, p->defindent);
1.134 schwarze 152: mt.pardist = 1;
1.24 kristaps 153:
1.181 schwarze 154: n = man->first->child;
1.151 schwarze 155: if (p->synopsisonly) {
156: while (n != NULL) {
157: if (n->tok == MAN_SH &&
1.171 schwarze 158: n->child->child->type == ROFFT_TEXT &&
1.151 schwarze 159: !strcmp(n->child->child->string, "SYNOPSIS")) {
160: if (n->child->next->child != NULL)
161: print_man_nodelist(p, &mt,
1.181 schwarze 162: n->child->next->child,
163: &man->meta);
1.151 schwarze 164: term_newln(p);
165: break;
166: }
167: n = n->next;
168: }
169: } else {
1.189 schwarze 170: save_defindent = p->defindent;
1.151 schwarze 171: if (p->defindent == 0)
172: p->defindent = 7;
1.181 schwarze 173: term_begin(p, print_man_head, print_man_foot, &man->meta);
1.151 schwarze 174: p->flags |= TERMP_NOSPACE;
175: if (n != NULL)
1.181 schwarze 176: print_man_nodelist(p, &mt, n, &man->meta);
1.151 schwarze 177: term_end(p);
1.189 schwarze 178: p->defindent = save_defindent;
1.151 schwarze 179: }
1.1 kristaps 180: }
181:
1.111 kristaps 182: /*
183: * Printing leading vertical space before a block.
184: * This is used for the paragraph macros.
185: * The rules are pretty simple, since there's very little nesting going
186: * on here. Basically, if we're the first within another block (SS/SH),
187: * then don't emit vertical space. If we are (RS), then do. If not the
188: * first, print it.
189: */
1.39 kristaps 190: static void
1.172 schwarze 191: print_bvspace(struct termp *p, const struct roff_node *n, int pardist)
1.18 kristaps 192: {
1.134 schwarze 193: int i;
1.111 kristaps 194:
1.39 kristaps 195: term_newln(p);
1.101 schwarze 196:
1.111 kristaps 197: if (n->body && n->body->child)
1.171 schwarze 198: if (n->body->child->type == ROFFT_TBL)
1.111 kristaps 199: return;
200:
1.171 schwarze 201: if (n->parent->type == ROFFT_ROOT || n->parent->tok != MAN_RS)
1.111 kristaps 202: if (NULL == n->prev)
203: return;
1.18 kristaps 204:
1.134 schwarze 205: for (i = 0; i < pardist; i++)
206: term_vspace(p);
1.18 kristaps 207: }
208:
1.146 schwarze 209:
1.1 kristaps 210: static int
1.29 kristaps 211: pre_ign(DECL_ARGS)
212: {
213:
1.185 schwarze 214: return 0;
1.29 kristaps 215: }
216:
217: static int
1.1 kristaps 218: pre_I(DECL_ARGS)
219: {
220:
1.52 kristaps 221: term_fontrepl(p, TERMFONT_UNDER);
1.185 schwarze 222: return 1;
1.19 kristaps 223: }
224:
1.3 kristaps 225: static int
1.84 kristaps 226: pre_literal(DECL_ARGS)
1.19 kristaps 227: {
228:
1.81 kristaps 229: term_newln(p);
1.88 kristaps 230:
1.129 schwarze 231: if (MAN_nf == n->tok || MAN_EX == n->tok)
1.84 kristaps 232: mt->fl |= MANT_LITERAL;
1.88 kristaps 233: else
1.84 kristaps 234: mt->fl &= ~MANT_LITERAL;
235:
1.117 schwarze 236: /*
237: * Unlike .IP and .TP, .HP does not have a HEAD.
238: * So in case a second call to term_flushln() is needed,
239: * indentation has to be set up explicitly.
240: */
241: if (MAN_HP == n->parent->tok && p->rmargin < p->maxrmargin) {
1.121 schwarze 242: p->offset = p->rmargin;
1.117 schwarze 243: p->rmargin = p->maxrmargin;
1.139 schwarze 244: p->trailspace = 0;
1.145 schwarze 245: p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
1.117 schwarze 246: p->flags |= TERMP_NOSPACE;
247: }
248:
1.185 schwarze 249: return 0;
1.19 kristaps 250: }
251:
252: static int
1.134 schwarze 253: pre_PD(DECL_ARGS)
254: {
1.160 schwarze 255: struct roffsu su;
1.134 schwarze 256:
257: n = n->child;
1.160 schwarze 258: if (n == NULL) {
1.134 schwarze 259: mt->pardist = 1;
1.185 schwarze 260: return 0;
1.134 schwarze 261: }
1.171 schwarze 262: assert(n->type == ROFFT_TEXT);
1.160 schwarze 263: if (a2roffsu(n->string, &su, SCALE_VS))
264: mt->pardist = term_vspan(p, &su);
1.185 schwarze 265: return 0;
1.134 schwarze 266: }
267:
268: static int
1.88 kristaps 269: pre_alternate(DECL_ARGS)
1.3 kristaps 270: {
1.88 kristaps 271: enum termfont font[2];
1.172 schwarze 272: struct roff_node *nn;
1.88 kristaps 273: int savelit, i;
1.3 kristaps 274:
1.88 kristaps 275: switch (n->tok) {
1.146 schwarze 276: case MAN_RB:
1.88 kristaps 277: font[0] = TERMFONT_NONE;
278: font[1] = TERMFONT_BOLD;
279: break;
1.146 schwarze 280: case MAN_RI:
1.88 kristaps 281: font[0] = TERMFONT_NONE;
282: font[1] = TERMFONT_UNDER;
283: break;
1.146 schwarze 284: case MAN_BR:
1.88 kristaps 285: font[0] = TERMFONT_BOLD;
286: font[1] = TERMFONT_NONE;
287: break;
1.146 schwarze 288: case MAN_BI:
1.88 kristaps 289: font[0] = TERMFONT_BOLD;
290: font[1] = TERMFONT_UNDER;
291: break;
1.146 schwarze 292: case MAN_IR:
1.88 kristaps 293: font[0] = TERMFONT_UNDER;
294: font[1] = TERMFONT_NONE;
295: break;
1.146 schwarze 296: case MAN_IB:
1.88 kristaps 297: font[0] = TERMFONT_UNDER;
298: font[1] = TERMFONT_BOLD;
299: break;
300: default:
301: abort();
302: }
1.35 kristaps 303:
1.88 kristaps 304: savelit = MANT_LITERAL & mt->fl;
305: mt->fl &= ~MANT_LITERAL;
1.35 kristaps 306:
1.88 kristaps 307: for (i = 0, nn = n->child; nn; nn = nn->next, i = 1 - i) {
308: term_fontrepl(p, font[i]);
309: if (savelit && NULL == nn->next)
310: mt->fl |= MANT_LITERAL;
1.179 schwarze 311: assert(nn->type == ROFFT_TEXT);
312: term_word(p, nn->string);
1.188 schwarze 313: if (nn->flags & NODE_EOS)
1.179 schwarze 314: p->flags |= TERMP_SENTENCE;
1.88 kristaps 315: if (nn->next)
1.4 kristaps 316: p->flags |= TERMP_NOSPACE;
1.3 kristaps 317: }
318:
1.185 schwarze 319: return 0;
1.3 kristaps 320: }
321:
1.1 kristaps 322: static int
323: pre_B(DECL_ARGS)
324: {
325:
1.52 kristaps 326: term_fontrepl(p, TERMFONT_BOLD);
1.185 schwarze 327: return 1;
1.127 kristaps 328: }
329:
330: static int
331: pre_OP(DECL_ARGS)
332: {
333:
334: term_word(p, "[");
335: p->flags |= TERMP_NOSPACE;
336:
337: if (NULL != (n = n->child)) {
338: term_fontrepl(p, TERMFONT_BOLD);
339: term_word(p, n->string);
340: }
341: if (NULL != n && NULL != n->next) {
342: term_fontrepl(p, TERMFONT_UNDER);
343: term_word(p, n->next->string);
344: }
345:
346: term_fontrepl(p, TERMFONT_NONE);
347: p->flags |= TERMP_NOSPACE;
348: term_word(p, "]");
1.185 schwarze 349: return 0;
1.83 kristaps 350: }
351:
352: static int
353: pre_in(DECL_ARGS)
354: {
1.163 schwarze 355: struct roffsu su;
356: const char *cp;
1.83 kristaps 357: size_t v;
1.163 schwarze 358: int less;
1.83 kristaps 359:
360: term_newln(p);
361:
362: if (NULL == n->child) {
363: p->offset = mt->offset;
1.185 schwarze 364: return 0;
1.83 kristaps 365: }
366:
367: cp = n->child->string;
368: less = 0;
369:
370: if ('-' == *cp)
371: less = -1;
372: else if ('+' == *cp)
373: less = 1;
374: else
375: cp--;
376:
1.163 schwarze 377: if ( ! a2roffsu(++cp, &su, SCALE_EN))
1.185 schwarze 378: return 0;
1.83 kristaps 379:
1.175 schwarze 380: v = (term_hspan(p, &su) + 11) / 24;
1.83 kristaps 381:
382: if (less < 0)
383: p->offset -= p->offset > v ? v : p->offset;
384: else if (less > 0)
385: p->offset += v;
1.146 schwarze 386: else
1.83 kristaps 387: p->offset = v;
1.164 schwarze 388: if (p->offset > SHRT_MAX)
389: p->offset = term_len(p, p->defindent);
1.95 kristaps 390:
1.185 schwarze 391: return 0;
1.1 kristaps 392: }
393:
394: static int
1.19 kristaps 395: pre_sp(DECL_ARGS)
396: {
1.162 schwarze 397: struct roffsu su;
1.163 schwarze 398: int i, len;
1.112 kristaps 399:
400: if ((NULL == n->prev && n->parent)) {
1.132 schwarze 401: switch (n->parent->tok) {
1.146 schwarze 402: case MAN_SH:
403: case MAN_SS:
404: case MAN_PP:
405: case MAN_LP:
406: case MAN_P:
1.185 schwarze 407: return 0;
1.132 schwarze 408: default:
409: break;
410: }
1.112 kristaps 411: }
1.19 kristaps 412:
1.194 schwarze 413: if (n->child == NULL)
1.163 schwarze 414: len = 1;
415: else {
416: if ( ! a2roffsu(n->child->string, &su, SCALE_VS))
1.162 schwarze 417: su.scale = 1.0;
418: len = term_vspan(p, &su);
1.82 kristaps 419: }
1.38 kristaps 420:
1.163 schwarze 421: if (len == 0)
1.19 kristaps 422: term_newln(p);
1.163 schwarze 423: else if (len < 0)
424: p->skipvsp -= len;
1.131 schwarze 425: else
426: for (i = 0; i < len; i++)
427: term_vspace(p);
1.183 schwarze 428:
429: /*
430: * Handle an explicit break request in the same way
431: * as an overflowing line.
432: */
433:
434: if (p->flags & TERMP_BRIND) {
435: p->offset = p->rmargin;
436: p->rmargin = p->maxrmargin;
437: p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
438: }
1.19 kristaps 439:
1.185 schwarze 440: return 0;
1.15 kristaps 441: }
442:
443: static int
1.19 kristaps 444: pre_HP(DECL_ARGS)
445: {
1.163 schwarze 446: struct roffsu su;
1.172 schwarze 447: const struct roff_node *nn;
1.163 schwarze 448: int len;
1.19 kristaps 449:
1.20 kristaps 450: switch (n->type) {
1.171 schwarze 451: case ROFFT_BLOCK:
1.134 schwarze 452: print_bvspace(p, n, mt->pardist);
1.185 schwarze 453: return 1;
1.171 schwarze 454: case ROFFT_BODY:
1.20 kristaps 455: break;
456: default:
1.185 schwarze 457: return 0;
1.20 kristaps 458: }
459:
1.130 schwarze 460: if ( ! (MANT_LITERAL & mt->fl)) {
1.145 schwarze 461: p->flags |= TERMP_NOBREAK | TERMP_BRIND;
1.139 schwarze 462: p->trailspace = 2;
1.130 schwarze 463: }
464:
1.24 kristaps 465: /* Calculate offset. */
466:
1.163 schwarze 467: if ((nn = n->parent->head->child) != NULL &&
468: a2roffsu(nn->string, &su, SCALE_EN)) {
1.175 schwarze 469: len = term_hspan(p, &su) / 24;
1.164 schwarze 470: if (len < 0 && (size_t)(-len) > mt->offset)
471: len = -mt->offset;
472: else if (len > SHRT_MAX)
473: len = term_len(p, p->defindent);
1.163 schwarze 474: mt->lmargin[mt->lmargincur] = len;
475: } else
476: len = mt->lmargin[mt->lmargincur];
1.24 kristaps 477:
1.26 kristaps 478: p->offset = mt->offset;
1.164 schwarze 479: p->rmargin = mt->offset + len;
1.185 schwarze 480: return 1;
1.19 kristaps 481: }
482:
1.20 kristaps 483: static void
484: post_HP(DECL_ARGS)
485: {
486:
487: switch (n->type) {
1.171 schwarze 488: case ROFFT_BODY:
1.136 schwarze 489: term_newln(p);
1.174 schwarze 490:
491: /*
492: * Compatibility with a groff bug.
493: * The .HP macro uses the undocumented .tag request
494: * which causes a line break and cancels no-space
495: * mode even if there isn't any output.
496: */
497:
498: if (n->child == NULL)
499: term_vspace(p);
500:
1.145 schwarze 501: p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
1.139 schwarze 502: p->trailspace = 0;
1.26 kristaps 503: p->offset = mt->offset;
1.20 kristaps 504: p->rmargin = p->maxrmargin;
505: break;
506: default:
507: break;
508: }
509: }
510:
1.19 kristaps 511: static int
1.1 kristaps 512: pre_PP(DECL_ARGS)
513: {
514:
1.19 kristaps 515: switch (n->type) {
1.171 schwarze 516: case ROFFT_BLOCK:
1.122 schwarze 517: mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
1.134 schwarze 518: print_bvspace(p, n, mt->pardist);
1.19 kristaps 519: break;
520: default:
1.26 kristaps 521: p->offset = mt->offset;
1.19 kristaps 522: break;
523: }
524:
1.185 schwarze 525: return n->type != ROFFT_HEAD;
1.1 kristaps 526: }
527:
528: static int
1.4 kristaps 529: pre_IP(DECL_ARGS)
530: {
1.163 schwarze 531: struct roffsu su;
1.172 schwarze 532: const struct roff_node *nn;
1.163 schwarze 533: int len, savelit;
1.18 kristaps 534:
1.22 kristaps 535: switch (n->type) {
1.171 schwarze 536: case ROFFT_BODY:
1.22 kristaps 537: p->flags |= TERMP_NOSPACE;
538: break;
1.171 schwarze 539: case ROFFT_HEAD:
1.22 kristaps 540: p->flags |= TERMP_NOBREAK;
1.139 schwarze 541: p->trailspace = 1;
1.22 kristaps 542: break;
1.171 schwarze 543: case ROFFT_BLOCK:
1.134 schwarze 544: print_bvspace(p, n, mt->pardist);
1.23 kristaps 545: /* FALLTHROUGH */
1.22 kristaps 546: default:
1.185 schwarze 547: return 1;
1.22 kristaps 548: }
1.18 kristaps 549:
1.94 schwarze 550: /* Calculate the offset from the optional second argument. */
1.163 schwarze 551: if ((nn = n->parent->head->child) != NULL &&
552: (nn = nn->next) != NULL &&
553: a2roffsu(nn->string, &su, SCALE_EN)) {
1.175 schwarze 554: len = term_hspan(p, &su) / 24;
1.163 schwarze 555: if (len < 0 && (size_t)(-len) > mt->offset)
556: len = -mt->offset;
1.164 schwarze 557: else if (len > SHRT_MAX)
558: len = term_len(p, p->defindent);
559: mt->lmargin[mt->lmargincur] = len;
1.163 schwarze 560: } else
561: len = mt->lmargin[mt->lmargincur];
1.4 kristaps 562:
1.22 kristaps 563: switch (n->type) {
1.171 schwarze 564: case ROFFT_HEAD:
1.26 kristaps 565: p->offset = mt->offset;
566: p->rmargin = mt->offset + len;
1.18 kristaps 567:
1.94 schwarze 568: savelit = MANT_LITERAL & mt->fl;
569: mt->fl &= ~MANT_LITERAL;
570:
571: if (n->child)
1.135 schwarze 572: print_man_node(p, mt, n->child, meta);
1.94 schwarze 573:
574: if (savelit)
575: mt->fl |= MANT_LITERAL;
576:
1.185 schwarze 577: return 0;
1.171 schwarze 578: case ROFFT_BODY:
1.26 kristaps 579: p->offset = mt->offset + len;
1.156 schwarze 580: p->rmargin = p->maxrmargin;
1.23 kristaps 581: break;
1.22 kristaps 582: default:
583: break;
1.18 kristaps 584: }
585:
1.185 schwarze 586: return 1;
1.22 kristaps 587: }
1.18 kristaps 588:
1.22 kristaps 589: static void
590: post_IP(DECL_ARGS)
591: {
1.4 kristaps 592:
1.22 kristaps 593: switch (n->type) {
1.171 schwarze 594: case ROFFT_HEAD:
1.22 kristaps 595: term_flushln(p);
596: p->flags &= ~TERMP_NOBREAK;
1.139 schwarze 597: p->trailspace = 0;
1.22 kristaps 598: p->rmargin = p->maxrmargin;
599: break;
1.171 schwarze 600: case ROFFT_BODY:
1.94 schwarze 601: term_newln(p);
1.138 schwarze 602: p->offset = mt->offset;
1.22 kristaps 603: break;
604: default:
605: break;
606: }
1.4 kristaps 607: }
608:
609: static int
1.1 kristaps 610: pre_TP(DECL_ARGS)
611: {
1.163 schwarze 612: struct roffsu su;
1.172 schwarze 613: struct roff_node *nn;
1.163 schwarze 614: int len, savelit;
1.1 kristaps 615:
1.21 kristaps 616: switch (n->type) {
1.171 schwarze 617: case ROFFT_HEAD:
1.184 schwarze 618: p->flags |= TERMP_NOBREAK | TERMP_BRTRSP;
1.139 schwarze 619: p->trailspace = 1;
1.21 kristaps 620: break;
1.171 schwarze 621: case ROFFT_BODY:
1.21 kristaps 622: p->flags |= TERMP_NOSPACE;
1.23 kristaps 623: break;
1.171 schwarze 624: case ROFFT_BLOCK:
1.134 schwarze 625: print_bvspace(p, n, mt->pardist);
1.23 kristaps 626: /* FALLTHROUGH */
627: default:
1.185 schwarze 628: return 1;
1.23 kristaps 629: }
630:
631: /* Calculate offset. */
632:
1.163 schwarze 633: if ((nn = n->parent->head->child) != NULL &&
1.188 schwarze 634: nn->string != NULL && ! (NODE_LINE & nn->flags) &&
1.163 schwarze 635: a2roffsu(nn->string, &su, SCALE_EN)) {
1.175 schwarze 636: len = term_hspan(p, &su) / 24;
1.163 schwarze 637: if (len < 0 && (size_t)(-len) > mt->offset)
638: len = -mt->offset;
1.164 schwarze 639: else if (len > SHRT_MAX)
640: len = term_len(p, p->defindent);
641: mt->lmargin[mt->lmargincur] = len;
1.163 schwarze 642: } else
643: len = mt->lmargin[mt->lmargincur];
1.23 kristaps 644:
645: switch (n->type) {
1.171 schwarze 646: case ROFFT_HEAD:
1.26 kristaps 647: p->offset = mt->offset;
648: p->rmargin = mt->offset + len;
1.23 kristaps 649:
1.94 schwarze 650: savelit = MANT_LITERAL & mt->fl;
651: mt->fl &= ~MANT_LITERAL;
652:
1.23 kristaps 653: /* Don't print same-line elements. */
1.141 schwarze 654: nn = n->child;
1.188 schwarze 655: while (NULL != nn && 0 == (NODE_LINE & nn->flags))
1.141 schwarze 656: nn = nn->next;
657:
658: while (NULL != nn) {
659: print_man_node(p, mt, nn, meta);
660: nn = nn->next;
661: }
1.24 kristaps 662:
1.94 schwarze 663: if (savelit)
664: mt->fl |= MANT_LITERAL;
1.185 schwarze 665: return 0;
1.171 schwarze 666: case ROFFT_BODY:
1.26 kristaps 667: p->offset = mt->offset + len;
1.156 schwarze 668: p->rmargin = p->maxrmargin;
1.139 schwarze 669: p->trailspace = 0;
1.184 schwarze 670: p->flags &= ~(TERMP_NOBREAK | TERMP_BRTRSP);
1.21 kristaps 671: break;
672: default:
673: break;
674: }
1.16 kristaps 675:
1.185 schwarze 676: return 1;
1.21 kristaps 677: }
1.1 kristaps 678:
1.21 kristaps 679: static void
680: post_TP(DECL_ARGS)
681: {
1.1 kristaps 682:
1.21 kristaps 683: switch (n->type) {
1.171 schwarze 684: case ROFFT_HEAD:
1.21 kristaps 685: term_flushln(p);
686: break;
1.171 schwarze 687: case ROFFT_BODY:
1.94 schwarze 688: term_newln(p);
1.138 schwarze 689: p->offset = mt->offset;
1.21 kristaps 690: break;
691: default:
692: break;
693: }
1.1 kristaps 694: }
695:
696: static int
697: pre_SS(DECL_ARGS)
698: {
1.134 schwarze 699: int i;
1.1 kristaps 700:
1.19 kristaps 701: switch (n->type) {
1.171 schwarze 702: case ROFFT_BLOCK:
1.113 kristaps 703: mt->fl &= ~MANT_LITERAL;
1.122 schwarze 704: mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
705: mt->offset = term_len(p, p->defindent);
1.158 schwarze 706:
707: /*
708: * No vertical space before the first subsection
709: * and after an empty subsection.
710: */
711:
712: do {
713: n = n->prev;
1.182 schwarze 714: } while (n != NULL && n->tok != TOKEN_NONE &&
1.170 schwarze 715: termacts[n->tok].flags & MAN_NOTEXT);
1.158 schwarze 716: if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
1.24 kristaps 717: break;
1.158 schwarze 718:
1.134 schwarze 719: for (i = 0; i < mt->pardist; i++)
720: term_vspace(p);
1.19 kristaps 721: break;
1.171 schwarze 722: case ROFFT_HEAD:
1.52 kristaps 723: term_fontrepl(p, TERMFONT_BOLD);
1.133 schwarze 724: p->offset = term_len(p, 3);
1.176 schwarze 725: p->rmargin = mt->offset;
726: p->trailspace = mt->offset;
727: p->flags |= TERMP_NOBREAK | TERMP_BRIND;
1.19 kristaps 728: break;
1.171 schwarze 729: case ROFFT_BODY:
1.26 kristaps 730: p->offset = mt->offset;
1.176 schwarze 731: p->rmargin = p->maxrmargin;
732: p->trailspace = 0;
733: p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
1.24 kristaps 734: break;
1.19 kristaps 735: default:
736: break;
737: }
738:
1.185 schwarze 739: return 1;
1.1 kristaps 740: }
741:
742: static void
743: post_SS(DECL_ARGS)
744: {
1.146 schwarze 745:
1.19 kristaps 746: switch (n->type) {
1.171 schwarze 747: case ROFFT_HEAD:
1.19 kristaps 748: term_newln(p);
749: break;
1.171 schwarze 750: case ROFFT_BODY:
1.24 kristaps 751: term_newln(p);
752: break;
1.19 kristaps 753: default:
754: break;
755: }
1.1 kristaps 756: }
757:
758: static int
759: pre_SH(DECL_ARGS)
760: {
1.134 schwarze 761: int i;
1.22 kristaps 762:
1.19 kristaps 763: switch (n->type) {
1.171 schwarze 764: case ROFFT_BLOCK:
1.113 kristaps 765: mt->fl &= ~MANT_LITERAL;
1.122 schwarze 766: mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
767: mt->offset = term_len(p, p->defindent);
1.158 schwarze 768:
769: /*
770: * No vertical space before the first section
771: * and after an empty section.
772: */
773:
774: do {
775: n = n->prev;
1.191 schwarze 776: } while (n != NULL && n->tok != TOKEN_NONE &&
1.190 schwarze 777: termacts[n->tok].flags & MAN_NOTEXT);
1.158 schwarze 778: if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
1.61 kristaps 779: break;
1.158 schwarze 780:
1.134 schwarze 781: for (i = 0; i < mt->pardist; i++)
782: term_vspace(p);
1.19 kristaps 783: break;
1.171 schwarze 784: case ROFFT_HEAD:
1.52 kristaps 785: term_fontrepl(p, TERMFONT_BOLD);
1.19 kristaps 786: p->offset = 0;
1.176 schwarze 787: p->rmargin = mt->offset;
788: p->trailspace = mt->offset;
789: p->flags |= TERMP_NOBREAK | TERMP_BRIND;
1.19 kristaps 790: break;
1.171 schwarze 791: case ROFFT_BODY:
1.26 kristaps 792: p->offset = mt->offset;
1.176 schwarze 793: p->rmargin = p->maxrmargin;
794: p->trailspace = 0;
795: p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
1.19 kristaps 796: break;
797: default:
798: break;
799: }
1.1 kristaps 800:
1.185 schwarze 801: return 1;
1.1 kristaps 802: }
803:
804: static void
805: post_SH(DECL_ARGS)
806: {
1.146 schwarze 807:
1.19 kristaps 808: switch (n->type) {
1.171 schwarze 809: case ROFFT_HEAD:
1.19 kristaps 810: term_newln(p);
811: break;
1.171 schwarze 812: case ROFFT_BODY:
1.19 kristaps 813: term_newln(p);
814: break;
815: default:
816: break;
817: }
1.1 kristaps 818: }
819:
1.26 kristaps 820: static int
821: pre_RS(DECL_ARGS)
822: {
1.163 schwarze 823: struct roffsu su;
1.26 kristaps 824:
825: switch (n->type) {
1.171 schwarze 826: case ROFFT_BLOCK:
1.26 kristaps 827: term_newln(p);
1.185 schwarze 828: return 1;
1.171 schwarze 829: case ROFFT_HEAD:
1.185 schwarze 830: return 0;
1.26 kristaps 831: default:
832: break;
833: }
834:
1.165 schwarze 835: n = n->parent->head;
836: n->aux = SHRT_MAX + 1;
1.177 schwarze 837: if (n->child == NULL)
838: n->aux = mt->lmargin[mt->lmargincur];
839: else if (a2roffsu(n->child->string, &su, SCALE_EN))
1.175 schwarze 840: n->aux = term_hspan(p, &su) / 24;
1.165 schwarze 841: if (n->aux < 0 && (size_t)(-n->aux) > mt->offset)
842: n->aux = -mt->offset;
843: else if (n->aux > SHRT_MAX)
844: n->aux = term_len(p, p->defindent);
1.26 kristaps 845:
1.165 schwarze 846: mt->offset += n->aux;
1.140 schwarze 847: p->offset = mt->offset;
1.156 schwarze 848: p->rmargin = p->maxrmargin;
1.26 kristaps 849:
1.116 schwarze 850: if (++mt->lmarginsz < MAXMARGINS)
851: mt->lmargincur = mt->lmarginsz;
852:
1.178 schwarze 853: mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
1.185 schwarze 854: return 1;
1.26 kristaps 855: }
856:
857: static void
858: post_RS(DECL_ARGS)
859: {
860:
861: switch (n->type) {
1.171 schwarze 862: case ROFFT_BLOCK:
1.110 kristaps 863: return;
1.171 schwarze 864: case ROFFT_HEAD:
1.110 kristaps 865: return;
1.26 kristaps 866: default:
867: term_newln(p);
868: break;
869: }
1.110 kristaps 870:
1.165 schwarze 871: mt->offset -= n->parent->head->aux;
1.110 kristaps 872: p->offset = mt->offset;
1.116 schwarze 873:
874: if (--mt->lmarginsz < MAXMARGINS)
875: mt->lmargincur = mt->lmarginsz;
1.137 schwarze 876: }
877:
878: static int
879: pre_UR(DECL_ARGS)
880: {
881:
1.185 schwarze 882: return n->type != ROFFT_HEAD;
1.137 schwarze 883: }
884:
885: static void
886: post_UR(DECL_ARGS)
887: {
888:
1.171 schwarze 889: if (n->type != ROFFT_BLOCK)
1.137 schwarze 890: return;
891:
892: term_word(p, "<");
893: p->flags |= TERMP_NOSPACE;
894:
895: if (NULL != n->child->child)
896: print_man_node(p, mt, n->child->child, meta);
897:
898: p->flags |= TERMP_NOSPACE;
899: term_word(p, ">");
1.26 kristaps 900: }
901:
1.1 kristaps 902: static void
1.45 kristaps 903: print_man_node(DECL_ARGS)
1.1 kristaps 904: {
1.65 joerg 905: size_t rm, rmax;
1.54 kristaps 906: int c;
1.1 kristaps 907:
908: switch (n->type) {
1.171 schwarze 909: case ROFFT_TEXT:
1.97 kristaps 910: /*
911: * If we have a blank line, output a vertical space.
912: * If we have a space as the first character, break
913: * before printing the line's data.
914: */
1.96 kristaps 915: if ('\0' == *n->string) {
1.4 kristaps 916: term_vspace(p);
1.98 schwarze 917: return;
1.188 schwarze 918: } else if (' ' == *n->string && NODE_LINE & n->flags)
1.96 kristaps 919: term_newln(p);
1.54 kristaps 920:
1.4 kristaps 921: term_word(p, n->string);
1.130 schwarze 922: goto out;
1.52 kristaps 923:
1.171 schwarze 924: case ROFFT_EQN:
1.188 schwarze 925: if ( ! (n->flags & NODE_LINE))
1.152 schwarze 926: p->flags |= TERMP_NOSPACE;
1.115 kristaps 927: term_eqn(p, n->eqn);
1.188 schwarze 928: if (n->next != NULL && ! (n->next->flags & NODE_LINE))
1.153 schwarze 929: p->flags |= TERMP_NOSPACE;
1.97 kristaps 930: return;
1.171 schwarze 931: case ROFFT_TBL:
1.169 schwarze 932: if (p->tbl.cols == NULL)
933: term_vspace(p);
1.92 kristaps 934: term_tbl(p, n->span);
1.97 kristaps 935: return;
1.1 kristaps 936: default:
937: break;
938: }
939:
1.193 schwarze 940: if (n->tok < ROFF_MAX) {
1.194 schwarze 941: roff_term_pre(p, n);
1.193 schwarze 942: return;
943: }
944:
945: assert(n->tok >= MAN_TH && n->tok <= MAN_MAX);
1.97 kristaps 946: if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
947: term_fontrepl(p, TERMFONT_NONE);
948:
949: c = 1;
950: if (termacts[n->tok].pre)
1.135 schwarze 951: c = (*termacts[n->tok].pre)(p, mt, n, meta);
1.97 kristaps 952:
1.1 kristaps 953: if (c && n->child)
1.135 schwarze 954: print_man_nodelist(p, mt, n->child, meta);
1.1 kristaps 955:
1.97 kristaps 956: if (termacts[n->tok].post)
1.135 schwarze 957: (*termacts[n->tok].post)(p, mt, n, meta);
1.97 kristaps 958: if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
959: term_fontrepl(p, TERMFONT_NONE);
1.63 kristaps 960:
1.130 schwarze 961: out:
962: /*
963: * If we're in a literal context, make sure that words
964: * together on the same line stay together. This is a
965: * POST-printing call, so we check the NEXT word. Since
966: * -man doesn't have nested macros, we don't need to be
967: * more specific than this.
968: */
1.157 schwarze 969: if (mt->fl & MANT_LITERAL &&
970: ! (p->flags & (TERMP_NOBREAK | TERMP_NONEWLINE)) &&
1.188 schwarze 971: (n->next == NULL || n->next->flags & NODE_LINE)) {
1.130 schwarze 972: rm = p->rmargin;
973: rmax = p->maxrmargin;
974: p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
975: p->flags |= TERMP_NOSPACE;
1.157 schwarze 976: if (n->string != NULL && *n->string != '\0')
1.130 schwarze 977: term_flushln(p);
978: else
979: term_newln(p);
980: if (rm < rmax && n->parent->tok == MAN_HP) {
981: p->offset = rm;
982: p->rmargin = rmax;
983: } else
984: p->rmargin = rm;
985: p->maxrmargin = rmax;
986: }
1.188 schwarze 987: if (NODE_EOS & n->flags)
1.63 kristaps 988: p->flags |= TERMP_SENTENCE;
1.1 kristaps 989: }
990:
991:
992: static void
1.52 kristaps 993: print_man_nodelist(DECL_ARGS)
1.1 kristaps 994: {
1.19 kristaps 995:
1.168 schwarze 996: while (n != NULL) {
997: print_man_node(p, mt, n, meta);
998: n = n->next;
999: }
1.1 kristaps 1000: }
1001:
1.31 kristaps 1002: static void
1.173 schwarze 1003: print_man_foot(struct termp *p, const struct roff_meta *meta)
1.1 kristaps 1004: {
1.147 schwarze 1005: char *title;
1.156 schwarze 1006: size_t datelen, titlen;
1.73 kristaps 1007:
1.125 schwarze 1008: assert(meta->title);
1009: assert(meta->msec);
1010: assert(meta->date);
1.1 kristaps 1011:
1.52 kristaps 1012: term_fontrepl(p, TERMFONT_NONE);
1.50 kristaps 1013:
1.149 schwarze 1014: if (meta->hasbody)
1015: term_vspace(p);
1.126 schwarze 1016:
1017: /*
1018: * Temporary, undocumented option to imitate mdoc(7) output.
1.173 schwarze 1019: * In the bottom right corner, use the operating system
1020: * instead of the title.
1.126 schwarze 1021: */
1022:
1023: if ( ! p->mdocstyle) {
1.149 schwarze 1024: if (meta->hasbody) {
1025: term_vspace(p);
1026: term_vspace(p);
1027: }
1.147 schwarze 1028: mandoc_asprintf(&title, "%s(%s)",
1029: meta->title, meta->msec);
1.173 schwarze 1030: } else if (meta->os) {
1031: title = mandoc_strdup(meta->os);
1.126 schwarze 1032: } else {
1.147 schwarze 1033: title = mandoc_strdup("");
1.126 schwarze 1034: }
1.125 schwarze 1035: datelen = term_strlen(p, meta->date);
1.1 kristaps 1036:
1.173 schwarze 1037: /* Bottom left corner: operating system. */
1.126 schwarze 1038:
1.1 kristaps 1039: p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
1.139 schwarze 1040: p->trailspace = 1;
1.1 kristaps 1041: p->offset = 0;
1.156 schwarze 1042: p->rmargin = p->maxrmargin > datelen ?
1043: (p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0;
1.1 kristaps 1044:
1.173 schwarze 1045: if (meta->os)
1046: term_word(p, meta->os);
1.1 kristaps 1047: term_flushln(p);
1048:
1.126 schwarze 1049: /* At the bottom in the middle: manual date. */
1050:
1.156 schwarze 1051: p->offset = p->rmargin;
1052: titlen = term_strlen(p, title);
1053: p->rmargin = p->maxrmargin > titlen ? p->maxrmargin - titlen : 0;
1.117 schwarze 1054: p->flags |= TERMP_NOSPACE;
1.123 schwarze 1055:
1.125 schwarze 1056: term_word(p, meta->date);
1.123 schwarze 1057: term_flushln(p);
1058:
1.126 schwarze 1059: /* Bottom right corner: manual title and section. */
1060:
1.123 schwarze 1061: p->flags &= ~TERMP_NOBREAK;
1062: p->flags |= TERMP_NOSPACE;
1.139 schwarze 1063: p->trailspace = 0;
1.123 schwarze 1064: p->offset = p->rmargin;
1.1 kristaps 1065: p->rmargin = p->maxrmargin;
1066:
1.123 schwarze 1067: term_word(p, title);
1.1 kristaps 1068: term_flushln(p);
1.147 schwarze 1069: free(title);
1.1 kristaps 1070: }
1071:
1.31 kristaps 1072: static void
1.173 schwarze 1073: print_man_head(struct termp *p, const struct roff_meta *meta)
1.1 kristaps 1074: {
1.148 schwarze 1075: const char *volume;
1.147 schwarze 1076: char *title;
1.148 schwarze 1077: size_t vollen, titlen;
1.73 kristaps 1078:
1.135 schwarze 1079: assert(meta->title);
1080: assert(meta->msec);
1.1 kristaps 1081:
1.148 schwarze 1082: volume = NULL == meta->vol ? "" : meta->vol;
1083: vollen = term_strlen(p, volume);
1.1 kristaps 1084:
1.126 schwarze 1085: /* Top left corner: manual title and section. */
1086:
1.147 schwarze 1087: mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec);
1.77 kristaps 1088: titlen = term_strlen(p, title);
1.1 kristaps 1089:
1.118 schwarze 1090: p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
1.139 schwarze 1091: p->trailspace = 1;
1.1 kristaps 1092: p->offset = 0;
1.148 schwarze 1093: p->rmargin = 2 * (titlen+1) + vollen < p->maxrmargin ?
1094: (p->maxrmargin - vollen + term_len(p, 1)) / 2 :
1.156 schwarze 1095: vollen < p->maxrmargin ? p->maxrmargin - vollen : 0;
1.1 kristaps 1096:
1097: term_word(p, title);
1098: term_flushln(p);
1099:
1.126 schwarze 1100: /* At the top in the middle: manual volume. */
1101:
1.117 schwarze 1102: p->flags |= TERMP_NOSPACE;
1.1 kristaps 1103: p->offset = p->rmargin;
1.148 schwarze 1104: p->rmargin = p->offset + vollen + titlen < p->maxrmargin ?
1.57 kristaps 1105: p->maxrmargin - titlen : p->maxrmargin;
1.1 kristaps 1106:
1.148 schwarze 1107: term_word(p, volume);
1.1 kristaps 1108: term_flushln(p);
1109:
1.126 schwarze 1110: /* Top right corner: title and section, again. */
1111:
1.1 kristaps 1112: p->flags &= ~TERMP_NOBREAK;
1.139 schwarze 1113: p->trailspace = 0;
1.57 kristaps 1114: if (p->rmargin + titlen <= p->maxrmargin) {
1.117 schwarze 1115: p->flags |= TERMP_NOSPACE;
1.57 kristaps 1116: p->offset = p->rmargin;
1117: p->rmargin = p->maxrmargin;
1118: term_word(p, title);
1119: term_flushln(p);
1120: }
1.1 kristaps 1121:
1.118 schwarze 1122: p->flags &= ~TERMP_NOSPACE;
1123: p->offset = 0;
1.1 kristaps 1124: p->rmargin = p->maxrmargin;
1.61 kristaps 1125:
1.146 schwarze 1126: /*
1.126 schwarze 1127: * Groff prints three blank lines before the content.
1128: * Do the same, except in the temporary, undocumented
1129: * mode imitating mdoc(7) output.
1.62 kristaps 1130: */
1131:
1.61 kristaps 1132: term_vspace(p);
1.126 schwarze 1133: if ( ! p->mdocstyle) {
1134: term_vspace(p);
1135: term_vspace(p);
1136: }
1.147 schwarze 1137: free(title);
1.1 kristaps 1138: }
CVSweb