Annotation of mandoc/man_html.c, Revision 1.131
1.131 ! schwarze 1: /* $Id: man_html.c,v 1.130 2017/01/26 18:28:18 schwarze Exp $ */
1.1 kristaps 2: /*
1.104 kristaps 3: * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
1.122 schwarze 4: * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
1.1 kristaps 5: *
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.
9: *
1.113 schwarze 10: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1.1 kristaps 11: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1.113 schwarze 12: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1.1 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.
17: */
1.25 kristaps 18: #include "config.h"
19:
1.1 kristaps 20: #include <sys/types.h>
21:
1.5 kristaps 22: #include <assert.h>
23: #include <ctype.h>
1.2 kristaps 24: #include <stdio.h>
1.1 kristaps 25: #include <stdlib.h>
1.4 kristaps 26: #include <string.h>
1.1 kristaps 27:
1.94 schwarze 28: #include "mandoc_aux.h"
1.113 schwarze 29: #include "roff.h"
1.105 schwarze 30: #include "man.h"
1.7 kristaps 31: #include "out.h"
1.1 kristaps 32: #include "html.h"
1.10 kristaps 33: #include "main.h"
1.1 kristaps 34:
1.13 kristaps 35: /* FIXME: have PD set the default vspace width. */
1.6 kristaps 36:
37: #define INDENT 5
1.4 kristaps 38:
1.115 schwarze 39: #define MAN_ARGS const struct roff_meta *man, \
1.114 schwarze 40: const struct roff_node *n, \
1.45 kristaps 41: struct mhtml *mh, \
1.3 kristaps 42: struct html *h
43:
1.45 kristaps 44: struct mhtml {
1.130 schwarze 45: struct tag *nofill;
1.45 kristaps 46: };
47:
1.3 kristaps 48: struct htmlman {
49: int (*pre)(MAN_ARGS);
50: int (*post)(MAN_ARGS);
51: };
52:
1.93 schwarze 53: static void print_bvspace(struct html *,
1.114 schwarze 54: const struct roff_node *);
1.3 kristaps 55: static void print_man_head(MAN_ARGS);
1.4 kristaps 56: static void print_man_nodelist(MAN_ARGS);
57: static void print_man_node(MAN_ARGS);
1.114 schwarze 58: static int a2width(const struct roff_node *,
1.7 kristaps 59: struct roffsu *);
1.8 kristaps 60: static int man_B_pre(MAN_ARGS);
1.6 kristaps 61: static int man_HP_pre(MAN_ARGS);
1.86 kristaps 62: static int man_IP_pre(MAN_ARGS);
1.8 kristaps 63: static int man_I_pre(MAN_ARGS);
1.86 kristaps 64: static int man_OP_pre(MAN_ARGS);
1.4 kristaps 65: static int man_PP_pre(MAN_ARGS);
1.9 kristaps 66: static int man_RS_pre(MAN_ARGS);
1.4 kristaps 67: static int man_SH_pre(MAN_ARGS);
1.8 kristaps 68: static int man_SM_pre(MAN_ARGS);
1.4 kristaps 69: static int man_SS_pre(MAN_ARGS);
1.90 schwarze 70: static int man_UR_pre(MAN_ARGS);
1.86 kristaps 71: static int man_alt_pre(MAN_ARGS);
72: static int man_br_pre(MAN_ARGS);
1.130 schwarze 73: static int man_fill_pre(MAN_ARGS);
1.86 kristaps 74: static int man_ign_pre(MAN_ARGS);
75: static int man_in_pre(MAN_ARGS);
76: static void man_root_post(MAN_ARGS);
77: static void man_root_pre(MAN_ARGS);
1.4 kristaps 78:
1.3 kristaps 79: static const struct htmlman mans[MAN_MAX] = {
1.4 kristaps 80: { man_br_pre, NULL }, /* br */
1.3 kristaps 81: { NULL, NULL }, /* TH */
1.4 kristaps 82: { man_SH_pre, NULL }, /* SH */
83: { man_SS_pre, NULL }, /* SS */
1.6 kristaps 84: { man_IP_pre, NULL }, /* TP */
1.4 kristaps 85: { man_PP_pre, NULL }, /* LP */
86: { man_PP_pre, NULL }, /* PP */
87: { man_PP_pre, NULL }, /* P */
1.5 kristaps 88: { man_IP_pre, NULL }, /* IP */
1.93 schwarze 89: { man_HP_pre, NULL }, /* HP */
1.8 kristaps 90: { man_SM_pre, NULL }, /* SM */
1.56 kristaps 91: { man_SM_pre, NULL }, /* SB */
1.8 kristaps 92: { man_alt_pre, NULL }, /* BI */
93: { man_alt_pre, NULL }, /* IB */
94: { man_alt_pre, NULL }, /* BR */
95: { man_alt_pre, NULL }, /* RB */
1.3 kristaps 96: { NULL, NULL }, /* R */
1.8 kristaps 97: { man_B_pre, NULL }, /* B */
98: { man_I_pre, NULL }, /* I */
99: { man_alt_pre, NULL }, /* IR */
100: { man_alt_pre, NULL }, /* RI */
1.4 kristaps 101: { man_br_pre, NULL }, /* sp */
1.130 schwarze 102: { man_fill_pre, NULL }, /* nf */
103: { man_fill_pre, NULL }, /* fi */
1.3 kristaps 104: { NULL, NULL }, /* RE */
1.9 kristaps 105: { man_RS_pre, NULL }, /* RS */
1.8 kristaps 106: { man_ign_pre, NULL }, /* DT */
107: { man_ign_pre, NULL }, /* UC */
1.13 kristaps 108: { man_ign_pre, NULL }, /* PD */
1.34 joerg 109: { man_ign_pre, NULL }, /* AT */
1.45 kristaps 110: { man_in_pre, NULL }, /* in */
1.51 kristaps 111: { man_ign_pre, NULL }, /* ft */
1.86 kristaps 112: { man_OP_pre, NULL }, /* OP */
1.130 schwarze 113: { man_fill_pre, NULL }, /* EX */
114: { man_fill_pre, NULL }, /* EE */
1.90 schwarze 115: { man_UR_pre, NULL }, /* UR */
116: { NULL, NULL }, /* UE */
1.92 schwarze 117: { man_ign_pre, NULL }, /* ll */
1.3 kristaps 118: };
119:
1.93 schwarze 120:
1.74 kristaps 121: /*
122: * Printing leading vertical space before a block.
123: * This is used for the paragraph macros.
124: * The rules are pretty simple, since there's very little nesting going
125: * on here. Basically, if we're the first within another block (SS/SH),
126: * then don't emit vertical space. If we are (RS), then do. If not the
127: * first, print it.
128: */
129: static void
1.114 schwarze 130: print_bvspace(struct html *h, const struct roff_node *n)
1.74 kristaps 131: {
132:
133: if (n->body && n->body->child)
1.113 schwarze 134: if (n->body->child->type == ROFFT_TBL)
1.74 kristaps 135: return;
136:
1.113 schwarze 137: if (n->parent->type == ROFFT_ROOT || n->parent->tok != MAN_RS)
1.74 kristaps 138: if (NULL == n->prev)
139: return;
140:
1.103 kristaps 141: print_paragraph(h);
1.74 kristaps 142: }
1.1 kristaps 143:
144: void
1.116 schwarze 145: html_man(void *arg, const struct roff_man *man)
1.1 kristaps 146: {
1.45 kristaps 147: struct mhtml mh;
1.117 schwarze 148: struct html *h;
1.126 schwarze 149: struct tag *t;
1.82 kristaps 150:
1.130 schwarze 151: mh.nofill = NULL;
1.117 schwarze 152: h = (struct html *)arg;
1.3 kristaps 153:
1.126 schwarze 154: if ((h->oflags & HTML_FRAGMENT) == 0) {
1.82 kristaps 155: print_gen_decls(h);
1.126 schwarze 156: print_otag(h, TAG_HTML, "");
157: t = print_otag(h, TAG_HEAD, "");
1.117 schwarze 158: print_man_head(&man->meta, man->first, &mh, h);
1.126 schwarze 159: print_tagq(h, t);
1.122 schwarze 160: print_otag(h, TAG_BODY, "");
1.126 schwarze 161: }
1.53 kristaps 162:
1.127 schwarze 163: man_root_pre(&man->meta, man->first, &mh, h);
164: t = print_otag(h, TAG_DIV, "c", "manual-text");
165: print_man_nodelist(&man->meta, man->first->child, &mh, h);
166: print_tagq(h, t);
167: man_root_post(&man->meta, man->first, &mh, h);
1.126 schwarze 168: print_tagq(h, NULL);
1.3 kristaps 169: }
170:
171: static void
172: print_man_head(MAN_ARGS)
173: {
1.123 schwarze 174: char *cp;
1.3 kristaps 175:
176: print_gen_head(h);
1.123 schwarze 177: mandoc_asprintf(&cp, "%s(%s)", man->title, man->msec);
1.122 schwarze 178: print_otag(h, TAG_TITLE, "");
1.123 schwarze 179: print_text(h, cp);
180: free(cp);
1.1 kristaps 181: }
1.4 kristaps 182:
183: static void
184: print_man_nodelist(MAN_ARGS)
185: {
186:
1.110 schwarze 187: while (n != NULL) {
188: print_man_node(man, n, mh, h);
189: n = n->next;
190: }
1.4 kristaps 191: }
192:
193: static void
194: print_man_node(MAN_ARGS)
195: {
196: int child;
197: struct tag *t;
198:
199: child = 1;
1.131 ! schwarze 200: t = h->tag;
1.130 schwarze 201: if (t == mh->nofill)
202: t = t->next;
1.4 kristaps 203:
204: switch (n->type) {
1.113 schwarze 205: case ROFFT_TEXT:
1.63 kristaps 206: if ('\0' == *n->string) {
1.103 kristaps 207: print_paragraph(h);
1.63 kristaps 208: return;
1.78 kristaps 209: }
1.130 schwarze 210: if (mh->nofill == NULL &&
211: n->flags & NODE_LINE && *n->string == ' ')
1.122 schwarze 212: print_otag(h, TAG_BR, "");
1.4 kristaps 213: print_text(h, n->string);
1.130 schwarze 214: break;
1.113 schwarze 215: case ROFFT_EQN:
1.80 kristaps 216: print_eqn(h, n->eqn);
1.69 kristaps 217: break;
1.113 schwarze 218: case ROFFT_TBL:
1.66 kristaps 219: /*
220: * This will take care of initialising all of the table
221: * state data for the first table, then tearing it down
222: * for the last one.
223: */
1.60 kristaps 224: print_tbl(h, n->span);
1.64 kristaps 225: return;
1.4 kristaps 226: default:
1.93 schwarze 227: /*
1.21 kristaps 228: * Close out scope of font prior to opening a macro
1.66 kristaps 229: * scope.
1.21 kristaps 230: */
1.57 kristaps 231: if (HTMLFONT_NONE != h->metac) {
232: h->metal = h->metac;
233: h->metac = HTMLFONT_NONE;
1.66 kristaps 234: }
235:
236: /*
237: * Close out the current table, if it's open, and unset
238: * the "meta" table state. This will be reopened on the
239: * next table element.
240: */
241: if (h->tblt) {
242: print_tblclose(h);
1.131 ! schwarze 243: t = h->tag;
1.20 kristaps 244: }
1.4 kristaps 245: if (mans[n->tok].pre)
1.89 schwarze 246: child = (*mans[n->tok].pre)(man, n, mh, h);
1.4 kristaps 247: break;
248: }
249:
1.21 kristaps 250: if (child && n->child)
1.89 schwarze 251: print_man_nodelist(man, n->child, mh, h);
1.21 kristaps 252:
1.24 kristaps 253: /* This will automatically close out any font scope. */
1.130 schwarze 254: print_stagq(h, mh->nofill == NULL ? t : mh->nofill);
1.4 kristaps 255:
1.130 schwarze 256: if (n->type != ROFFT_TEXT && n->type != ROFFT_EQN &&
257: mans[n->tok].post != NULL)
258: (*mans[n->tok].post)(man, n, mh, h);
259:
260: if (mh->nofill != NULL &&
261: (n->next == NULL || n->next->flags & NODE_LINE))
262: print_endline(h);
1.4 kristaps 263: }
264:
1.5 kristaps 265: static int
1.114 schwarze 266: a2width(const struct roff_node *n, struct roffsu *su)
1.5 kristaps 267: {
268:
1.113 schwarze 269: if (n->type != ROFFT_TEXT)
1.119 schwarze 270: return 0;
1.107 schwarze 271: if (a2roffsu(n->string, su, SCALE_EN))
1.119 schwarze 272: return 1;
1.5 kristaps 273:
1.119 schwarze 274: return 0;
1.5 kristaps 275: }
276:
1.65 kristaps 277: static void
1.4 kristaps 278: man_root_pre(MAN_ARGS)
279: {
280: struct tag *t, *tt;
1.94 schwarze 281: char *title;
1.4 kristaps 282:
1.89 schwarze 283: assert(man->title);
284: assert(man->msec);
1.94 schwarze 285: mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
1.4 kristaps 286:
1.122 schwarze 287: t = print_otag(h, TAG_TABLE, "c", "head");
288: print_otag(h, TAG_TBODY, "");
289: tt = print_otag(h, TAG_TR, "");
1.4 kristaps 290:
1.122 schwarze 291: print_otag(h, TAG_TD, "c", "head-ltitle");
1.4 kristaps 292: print_text(h, title);
293: print_stagq(h, tt);
294:
1.122 schwarze 295: print_otag(h, TAG_TD, "c", "head-vol");
1.95 schwarze 296: if (NULL != man->vol)
297: print_text(h, man->vol);
1.4 kristaps 298: print_stagq(h, tt);
299:
1.122 schwarze 300: print_otag(h, TAG_TD, "c", "head-rtitle");
1.4 kristaps 301: print_text(h, title);
302: print_tagq(h, t);
1.94 schwarze 303: free(title);
1.4 kristaps 304: }
305:
306: static void
307: man_root_post(MAN_ARGS)
308: {
309: struct tag *t, *tt;
310:
1.122 schwarze 311: t = print_otag(h, TAG_TABLE, "c", "foot");
312: tt = print_otag(h, TAG_TR, "");
1.55 kristaps 313:
1.122 schwarze 314: print_otag(h, TAG_TD, "c", "foot-date");
1.89 schwarze 315: print_text(h, man->date);
1.4 kristaps 316: print_stagq(h, tt);
317:
1.122 schwarze 318: print_otag(h, TAG_TD, "c", "foot-os");
1.115 schwarze 319: if (man->os)
320: print_text(h, man->os);
1.4 kristaps 321: print_tagq(h, t);
322: }
323:
324:
325: static int
326: man_br_pre(MAN_ARGS)
327: {
1.7 kristaps 328: struct roffsu su;
1.4 kristaps 329:
1.7 kristaps 330: SCALE_VS_INIT(&su, 1);
331:
1.49 kristaps 332: if (MAN_sp == n->tok) {
1.75 kristaps 333: if (NULL != (n = n->child))
334: if ( ! a2roffsu(n->string, &su, SCALE_VS))
1.108 schwarze 335: su.scale = 1.0;
1.49 kristaps 336: } else
1.96 schwarze 337: su.scale = 0.0;
1.4 kristaps 338:
1.122 schwarze 339: print_otag(h, TAG_DIV, "suh", &su);
1.24 kristaps 340:
1.16 kristaps 341: /* So the div isn't empty: */
342: print_text(h, "\\~");
343:
1.119 schwarze 344: return 0;
1.4 kristaps 345: }
346:
347: static int
348: man_SH_pre(MAN_ARGS)
349: {
1.130 schwarze 350: if (n->type == ROFFT_BLOCK && mh->nofill != NULL) {
351: print_tagq(h, mh->nofill);
352: mh->nofill = NULL;
353: } else if (n->type == ROFFT_HEAD)
354: print_otag(h, TAG_H1, "c", "Sh");
1.119 schwarze 355: return 1;
1.4 kristaps 356: }
357:
358: static int
1.8 kristaps 359: man_alt_pre(MAN_ARGS)
360: {
1.114 schwarze 361: const struct roff_node *nn;
1.130 schwarze 362: int i;
1.57 kristaps 363: enum htmltag fp;
364: struct tag *t;
1.8 kristaps 365:
366: for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
367: switch (n->tok) {
1.93 schwarze 368: case MAN_BI:
1.57 kristaps 369: fp = i % 2 ? TAG_I : TAG_B;
1.8 kristaps 370: break;
1.93 schwarze 371: case MAN_IB:
1.57 kristaps 372: fp = i % 2 ? TAG_B : TAG_I;
1.8 kristaps 373: break;
1.93 schwarze 374: case MAN_RI:
1.57 kristaps 375: fp = i % 2 ? TAG_I : TAG_MAX;
1.8 kristaps 376: break;
1.93 schwarze 377: case MAN_IR:
1.57 kristaps 378: fp = i % 2 ? TAG_MAX : TAG_I;
1.8 kristaps 379: break;
1.93 schwarze 380: case MAN_BR:
1.57 kristaps 381: fp = i % 2 ? TAG_MAX : TAG_B;
1.8 kristaps 382: break;
1.93 schwarze 383: case MAN_RB:
1.57 kristaps 384: fp = i % 2 ? TAG_B : TAG_MAX;
1.8 kristaps 385: break;
386: default:
387: abort();
388: }
389:
390: if (i)
391: h->flags |= HTML_NOSPACE;
392:
1.130 schwarze 393: if (fp != TAG_MAX)
1.122 schwarze 394: t = print_otag(h, fp, "");
1.57 kristaps 395:
1.130 schwarze 396: print_text(h, nn->string);
1.57 kristaps 397:
1.130 schwarze 398: if (fp != TAG_MAX)
1.57 kristaps 399: print_tagq(h, t);
1.8 kristaps 400: }
1.119 schwarze 401: return 0;
1.8 kristaps 402: }
403:
404: static int
1.56 kristaps 405: man_SM_pre(MAN_ARGS)
1.8 kristaps 406: {
1.122 schwarze 407: print_otag(h, TAG_SMALL, "");
1.56 kristaps 408: if (MAN_SB == n->tok)
1.122 schwarze 409: print_otag(h, TAG_B, "");
1.119 schwarze 410: return 1;
1.8 kristaps 411: }
412:
413: static int
1.4 kristaps 414: man_SS_pre(MAN_ARGS)
415: {
1.130 schwarze 416: if (n->type == ROFFT_BLOCK && mh->nofill != NULL) {
417: print_tagq(h, mh->nofill);
418: mh->nofill = NULL;
419: } else if (n->type == ROFFT_HEAD)
420: print_otag(h, TAG_H2, "c", "Ss");
1.119 schwarze 421: return 1;
1.4 kristaps 422: }
423:
424: static int
425: man_PP_pre(MAN_ARGS)
426: {
427:
1.113 schwarze 428: if (n->type == ROFFT_HEAD)
1.119 schwarze 429: return 0;
1.113 schwarze 430: else if (n->type == ROFFT_BLOCK)
1.74 kristaps 431: print_bvspace(h, n);
1.47 kristaps 432:
1.119 schwarze 433: return 1;
1.5 kristaps 434: }
435:
436: static int
437: man_IP_pre(MAN_ARGS)
438: {
1.114 schwarze 439: const struct roff_node *nn;
1.5 kristaps 440:
1.113 schwarze 441: if (n->type == ROFFT_BODY) {
1.129 schwarze 442: print_otag(h, TAG_DD, "c", "It-tag");
1.119 schwarze 443: return 1;
1.113 schwarze 444: } else if (n->type != ROFFT_HEAD) {
1.129 schwarze 445: print_otag(h, TAG_DL, "c", "Bl-tag");
1.119 schwarze 446: return 1;
1.6 kristaps 447: }
448:
1.78 kristaps 449: /* FIXME: width specification. */
450:
1.129 schwarze 451: print_otag(h, TAG_DT, "c", "It-tag");
1.6 kristaps 452:
1.59 schwarze 453: /* For IP, only print the first header element. */
1.7 kristaps 454:
1.59 schwarze 455: if (MAN_IP == n->tok && n->child)
1.89 schwarze 456: print_man_node(man, n->child, mh, h);
1.27 kristaps 457:
1.59 schwarze 458: /* For TP, only print next-line header elements. */
1.6 kristaps 459:
1.91 schwarze 460: if (MAN_TP == n->tok) {
461: nn = n->child;
1.121 schwarze 462: while (NULL != nn && 0 == (NODE_LINE & nn->flags))
1.91 schwarze 463: nn = nn->next;
464: while (NULL != nn) {
465: print_man_node(man, nn, mh, h);
466: nn = nn->next;
467: }
468: }
1.6 kristaps 469:
1.119 schwarze 470: return 0;
1.6 kristaps 471: }
472:
473: static int
474: man_HP_pre(MAN_ARGS)
475: {
1.122 schwarze 476: struct roffsu sum, sui;
1.114 schwarze 477: const struct roff_node *np;
1.6 kristaps 478:
1.113 schwarze 479: if (n->type == ROFFT_HEAD)
1.119 schwarze 480: return 0;
1.113 schwarze 481: else if (n->type != ROFFT_BLOCK)
1.119 schwarze 482: return 1;
1.72 kristaps 483:
1.77 kristaps 484: np = n->head->child;
1.6 kristaps 485:
1.122 schwarze 486: if (np == NULL || !a2width(np, &sum))
487: SCALE_HS_INIT(&sum, INDENT);
1.6 kristaps 488:
1.122 schwarze 489: sui.unit = sum.unit;
490: sui.scale = -sum.scale;
1.5 kristaps 491:
1.77 kristaps 492: print_bvspace(h, n);
1.127 schwarze 493: print_otag(h, TAG_DIV, "csului", "Pp", &sum, &sui);
1.119 schwarze 494: return 1;
1.4 kristaps 495: }
1.86 kristaps 496:
497: static int
498: man_OP_pre(MAN_ARGS)
499: {
500: struct tag *tt;
501:
502: print_text(h, "[");
503: h->flags |= HTML_NOSPACE;
1.128 schwarze 504: tt = print_otag(h, TAG_SPAN, "c", "Op");
1.86 kristaps 505:
506: if (NULL != (n = n->child)) {
1.122 schwarze 507: print_otag(h, TAG_B, "");
1.86 kristaps 508: print_text(h, n->string);
509: }
510:
511: print_stagq(h, tt);
512:
513: if (NULL != n && NULL != n->next) {
1.122 schwarze 514: print_otag(h, TAG_I, "");
1.86 kristaps 515: print_text(h, n->next->string);
516: }
517:
518: print_stagq(h, tt);
519: h->flags |= HTML_NOSPACE;
520: print_text(h, "]");
1.119 schwarze 521: return 0;
1.86 kristaps 522: }
523:
1.8 kristaps 524: static int
525: man_B_pre(MAN_ARGS)
526: {
1.122 schwarze 527: print_otag(h, TAG_B, "");
1.119 schwarze 528: return 1;
1.8 kristaps 529: }
530:
531: static int
532: man_I_pre(MAN_ARGS)
533: {
1.122 schwarze 534: print_otag(h, TAG_I, "");
1.119 schwarze 535: return 1;
1.45 kristaps 536: }
537:
538: static int
1.130 schwarze 539: man_fill_pre(MAN_ARGS)
1.45 kristaps 540: {
1.88 schwarze 541: if (MAN_fi == n->tok || MAN_EE == n->tok) {
1.130 schwarze 542: if (mh->nofill != NULL) {
543: print_tagq(h, mh->nofill);
544: mh->nofill = NULL;
545: } else
546: print_otag(h, TAG_BR, "");
547: } else {
548: if (mh->nofill == NULL)
549: mh->nofill = print_otag(h, TAG_PRE, "");
550: else
551: print_otag(h, TAG_BR, "");
552: }
1.119 schwarze 553: return 0;
1.45 kristaps 554: }
555:
556: static int
557: man_in_pre(MAN_ARGS)
558: {
1.122 schwarze 559: print_otag(h, TAG_BR, "");
1.119 schwarze 560: return 0;
1.8 kristaps 561: }
562:
563: static int
564: man_ign_pre(MAN_ARGS)
565: {
566:
1.119 schwarze 567: return 0;
1.8 kristaps 568: }
1.9 kristaps 569:
570: static int
571: man_RS_pre(MAN_ARGS)
572: {
573: struct roffsu su;
574:
1.113 schwarze 575: if (n->type == ROFFT_HEAD)
1.119 schwarze 576: return 0;
1.113 schwarze 577: else if (n->type == ROFFT_BODY)
1.119 schwarze 578: return 1;
1.9 kristaps 579:
580: SCALE_HS_INIT(&su, INDENT);
1.56 kristaps 581: if (n->head->child)
1.9 kristaps 582: a2width(n->head->child, &su);
583:
1.122 schwarze 584: print_otag(h, TAG_DIV, "sul", &su);
1.119 schwarze 585: return 1;
1.90 schwarze 586: }
587:
588: static int
589: man_UR_pre(MAN_ARGS)
590: {
591: n = n->child;
1.113 schwarze 592: assert(n->type == ROFFT_HEAD);
1.120 schwarze 593: if (n->child != NULL) {
1.113 schwarze 594: assert(n->child->type == ROFFT_TEXT);
1.128 schwarze 595: print_otag(h, TAG_A, "ch", "Lk", n->child->string);
1.90 schwarze 596: }
597:
1.113 schwarze 598: assert(n->next->type == ROFFT_BODY);
1.120 schwarze 599: if (n->next->child != NULL)
1.90 schwarze 600: n = n->next;
601:
602: print_man_nodelist(man, n->child, mh, h);
603:
1.119 schwarze 604: return 0;
1.9 kristaps 605: }
CVSweb