Annotation of src/usr.bin/mandoc/man_html.c, Revision 1.26
1.26 ! schwarze 1: /* $Id: man_html.c,v 1.25 2010/12/19 09:22:35 schwarze Exp $ */
1.1 schwarze 2: /*
1.17 schwarze 3: * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
1.1 schwarze 4: *
5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
8: *
9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: */
17: #include <sys/types.h>
18:
19: #include <assert.h>
20: #include <ctype.h>
21: #include <stdio.h>
22: #include <stdlib.h>
23: #include <string.h>
24:
1.14 schwarze 25: #include "mandoc.h"
1.1 schwarze 26: #include "out.h"
27: #include "html.h"
28: #include "man.h"
29: #include "main.h"
30:
31: /* TODO: preserve ident widths. */
1.2 schwarze 32: /* FIXME: have PD set the default vspace width. */
1.1 schwarze 33:
34: #define INDENT 5
35: #define HALFINDENT 3
36:
37: #define MAN_ARGS const struct man_meta *m, \
38: const struct man_node *n, \
1.18 schwarze 39: struct mhtml *mh, \
1.1 schwarze 40: struct html *h
41:
1.18 schwarze 42: struct mhtml {
43: int fl;
44: #define MANH_LITERAL (1 << 0) /* literal context */
45: };
46:
1.1 schwarze 47: struct htmlman {
48: int (*pre)(MAN_ARGS);
49: int (*post)(MAN_ARGS);
50: };
51:
52: static void print_man(MAN_ARGS);
53: static void print_man_head(MAN_ARGS);
54: static void print_man_nodelist(MAN_ARGS);
55: static void print_man_node(MAN_ARGS);
56:
57: static int a2width(const struct man_node *,
58: struct roffsu *);
59:
60: static int man_alt_pre(MAN_ARGS);
61: static int man_br_pre(MAN_ARGS);
62: static int man_ign_pre(MAN_ARGS);
1.18 schwarze 63: static int man_in_pre(MAN_ARGS);
64: static int man_literal_pre(MAN_ARGS);
1.1 schwarze 65: static void man_root_post(MAN_ARGS);
66: static int man_root_pre(MAN_ARGS);
67: static int man_B_pre(MAN_ARGS);
68: static int man_HP_pre(MAN_ARGS);
69: static int man_I_pre(MAN_ARGS);
70: static int man_IP_pre(MAN_ARGS);
71: static int man_PP_pre(MAN_ARGS);
72: static int man_RS_pre(MAN_ARGS);
73: static int man_SH_pre(MAN_ARGS);
74: static int man_SM_pre(MAN_ARGS);
75: static int man_SS_pre(MAN_ARGS);
76:
77: static const struct htmlman mans[MAN_MAX] = {
78: { man_br_pre, NULL }, /* br */
79: { NULL, NULL }, /* TH */
80: { man_SH_pre, NULL }, /* SH */
81: { man_SS_pre, NULL }, /* SS */
82: { man_IP_pre, NULL }, /* TP */
83: { man_PP_pre, NULL }, /* LP */
84: { man_PP_pre, NULL }, /* PP */
85: { man_PP_pre, NULL }, /* P */
86: { man_IP_pre, NULL }, /* IP */
87: { man_HP_pre, NULL }, /* HP */
88: { man_SM_pre, NULL }, /* SM */
1.26 ! schwarze 89: { man_SM_pre, NULL }, /* SB */
1.1 schwarze 90: { man_alt_pre, NULL }, /* BI */
91: { man_alt_pre, NULL }, /* IB */
92: { man_alt_pre, NULL }, /* BR */
93: { man_alt_pre, NULL }, /* RB */
94: { NULL, NULL }, /* R */
95: { man_B_pre, NULL }, /* B */
96: { man_I_pre, NULL }, /* I */
97: { man_alt_pre, NULL }, /* IR */
98: { man_alt_pre, NULL }, /* RI */
99: { NULL, NULL }, /* na */
100: { man_br_pre, NULL }, /* sp */
1.18 schwarze 101: { man_literal_pre, NULL }, /* nf */
102: { man_literal_pre, NULL }, /* fi */
1.1 schwarze 103: { NULL, NULL }, /* RE */
104: { man_RS_pre, NULL }, /* RS */
105: { man_ign_pre, NULL }, /* DT */
106: { man_ign_pre, NULL }, /* UC */
1.2 schwarze 107: { man_ign_pre, NULL }, /* PD */
1.13 schwarze 108: { man_ign_pre, NULL }, /* AT */
1.18 schwarze 109: { man_in_pre, NULL }, /* in */
1.19 schwarze 110: { NULL, NULL }, /* TS */
111: { NULL, NULL }, /* TE */
1.23 schwarze 112: { man_ign_pre, NULL }, /* ft */
1.1 schwarze 113: };
114:
115:
116: void
117: html_man(void *arg, const struct man *m)
118: {
119: struct html *h;
120: struct tag *t;
1.18 schwarze 121: struct mhtml mh;
1.1 schwarze 122:
123: h = (struct html *)arg;
124:
1.5 schwarze 125: print_gen_decls(h);
1.1 schwarze 126:
1.18 schwarze 127: memset(&mh, 0, sizeof(struct mhtml));
128:
1.1 schwarze 129: t = print_otag(h, TAG_HTML, 0, NULL);
1.18 schwarze 130: print_man(man_meta(m), man_node(m), &mh, h);
1.1 schwarze 131: print_tagq(h, t);
132:
133: printf("\n");
134: }
135:
136:
137: static void
138: print_man(MAN_ARGS)
139: {
140: struct tag *t;
141:
142: t = print_otag(h, TAG_HEAD, 0, NULL);
1.18 schwarze 143: print_man_head(m, n, mh, h);
1.1 schwarze 144: print_tagq(h, t);
1.25 schwarze 145:
1.1 schwarze 146: t = print_otag(h, TAG_BODY, 0, NULL);
1.18 schwarze 147: print_man_nodelist(m, n, mh, h);
1.1 schwarze 148: print_tagq(h, t);
149: }
150:
151:
152: /* ARGSUSED */
153: static void
154: print_man_head(MAN_ARGS)
155: {
156:
157: print_gen_head(h);
158: bufinit(h);
1.10 schwarze 159: buffmt(h, "%s(%s)", m->title, m->msec);
1.1 schwarze 160:
161: print_otag(h, TAG_TITLE, 0, NULL);
162: print_text(h, h->buf);
163: }
164:
165:
166: static void
167: print_man_nodelist(MAN_ARGS)
168: {
169:
1.18 schwarze 170: print_man_node(m, n, mh, h);
1.1 schwarze 171: if (n->next)
1.18 schwarze 172: print_man_nodelist(m, n->next, mh, h);
1.1 schwarze 173: }
174:
175:
176: static void
177: print_man_node(MAN_ARGS)
178: {
179: int child;
180: struct tag *t;
181:
182: child = 1;
1.2 schwarze 183: t = h->tags.head;
1.1 schwarze 184:
185: bufinit(h);
186:
1.7 schwarze 187: /*
188: * FIXME: embedded elements within next-line scopes (e.g., `br'
189: * within an empty `B') will cause formatting to be forgotten
190: * due to scope closing out.
191: */
192:
1.1 schwarze 193: switch (n->type) {
194: case (MAN_ROOT):
1.18 schwarze 195: child = man_root_pre(m, n, mh, h);
1.1 schwarze 196: break;
197: case (MAN_TEXT):
198: print_text(h, n->string);
1.18 schwarze 199:
200: if (MANH_LITERAL & mh->fl)
201: print_otag(h, TAG_BR, 0, NULL);
202:
1.4 schwarze 203: return;
1.1 schwarze 204: default:
1.4 schwarze 205: /*
206: * Close out scope of font prior to opening a macro
207: * scope. Assert that the metafont is on the top of the
208: * stack (it's never nested).
209: */
210: if (h->metaf) {
211: assert(h->metaf == t);
212: print_tagq(h, h->metaf);
213: assert(NULL == h->metaf);
214: t = h->tags.head;
215: }
1.1 schwarze 216: if (mans[n->tok].pre)
1.18 schwarze 217: child = (*mans[n->tok].pre)(m, n, mh, h);
1.1 schwarze 218: break;
219: }
220:
221: if (child && n->child)
1.18 schwarze 222: print_man_nodelist(m, n->child, mh, h);
1.1 schwarze 223:
1.4 schwarze 224: /* This will automatically close out any font scope. */
1.1 schwarze 225: print_stagq(h, t);
226:
227: bufinit(h);
228:
229: switch (n->type) {
230: case (MAN_ROOT):
1.18 schwarze 231: man_root_post(m, n, mh, h);
1.1 schwarze 232: break;
233: case (MAN_TEXT):
234: break;
235: default:
236: if (mans[n->tok].post)
1.18 schwarze 237: (*mans[n->tok].post)(m, n, mh, h);
1.1 schwarze 238: break;
239: }
240: }
241:
242:
243: static int
244: a2width(const struct man_node *n, struct roffsu *su)
245: {
246:
247: if (MAN_TEXT != n->type)
248: return(0);
249: if (a2roffsu(n->string, su, SCALE_BU))
250: return(1);
251:
252: return(0);
253: }
254:
255:
256: /* ARGSUSED */
257: static int
258: man_root_pre(MAN_ARGS)
259: {
1.26 ! schwarze 260: struct htmlpair tag[3];
1.1 schwarze 261: struct tag *t, *tt;
262: char b[BUFSIZ], title[BUFSIZ];
263:
264: b[0] = 0;
265: if (m->vol)
266: (void)strlcat(b, m->vol, BUFSIZ);
267:
1.10 schwarze 268: snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec);
1.1 schwarze 269:
1.26 ! schwarze 270: PAIR_SUMMARY_INIT(&tag[0], "Document Header");
! 271: PAIR_CLASS_INIT(&tag[1], "head");
! 272: if (NULL == h->style) {
! 273: PAIR_INIT(&tag[2], ATTR_WIDTH, "100%");
! 274: t = print_otag(h, TAG_TABLE, 3, tag);
! 275: PAIR_INIT(&tag[0], ATTR_WIDTH, "30%");
! 276: print_otag(h, TAG_COL, 1, tag);
! 277: print_otag(h, TAG_COL, 1, tag);
! 278: print_otag(h, TAG_COL, 1, tag);
! 279: } else
! 280: t = print_otag(h, TAG_TABLE, 2, tag);
! 281:
! 282: print_otag(h, TAG_TBODY, 0, NULL);
1.3 schwarze 283:
1.1 schwarze 284: tt = print_otag(h, TAG_TR, 0, NULL);
285:
1.25 schwarze 286: PAIR_CLASS_INIT(&tag[0], "head-ltitle");
1.1 schwarze 287: print_otag(h, TAG_TD, 1, tag);
1.25 schwarze 288:
1.1 schwarze 289: print_text(h, title);
290: print_stagq(h, tt);
291:
1.25 schwarze 292: PAIR_CLASS_INIT(&tag[0], "head-vol");
1.26 ! schwarze 293: if (NULL == h->style) {
! 294: PAIR_INIT(&tag[1], ATTR_ALIGN, "center");
! 295: print_otag(h, TAG_TD, 2, tag);
! 296: } else
! 297: print_otag(h, TAG_TD, 1, tag);
1.25 schwarze 298:
1.1 schwarze 299: print_text(h, b);
300: print_stagq(h, tt);
301:
1.25 schwarze 302: PAIR_CLASS_INIT(&tag[0], "head-rtitle");
1.26 ! schwarze 303: if (NULL == h->style) {
! 304: PAIR_INIT(&tag[1], ATTR_ALIGN, "right");
! 305: print_otag(h, TAG_TD, 2, tag);
! 306: } else
! 307: print_otag(h, TAG_TD, 1, tag);
1.25 schwarze 308:
1.1 schwarze 309: print_text(h, title);
310: print_tagq(h, t);
311: return(1);
312: }
313:
314:
315: /* ARGSUSED */
316: static void
317: man_root_post(MAN_ARGS)
318: {
1.26 ! schwarze 319: struct htmlpair tag[3];
1.1 schwarze 320: struct tag *t, *tt;
1.2 schwarze 321: char b[DATESIZ];
1.1 schwarze 322:
1.15 schwarze 323: if (m->rawdate)
324: strlcpy(b, m->rawdate, DATESIZ);
325: else
326: time2a(m->date, b, DATESIZ);
1.1 schwarze 327:
1.26 ! schwarze 328: PAIR_SUMMARY_INIT(&tag[0], "Document Footer");
! 329: PAIR_CLASS_INIT(&tag[1], "foot");
! 330: if (NULL == h->style) {
! 331: PAIR_INIT(&tag[2], ATTR_WIDTH, "100%");
! 332: t = print_otag(h, TAG_TABLE, 3, tag);
! 333: PAIR_INIT(&tag[0], ATTR_WIDTH, "50%");
! 334: print_otag(h, TAG_COL, 1, tag);
! 335: print_otag(h, TAG_COL, 1, tag);
! 336: } else
! 337: t = print_otag(h, TAG_TABLE, 2, tag);
1.3 schwarze 338:
1.1 schwarze 339: tt = print_otag(h, TAG_TR, 0, NULL);
340:
1.25 schwarze 341: PAIR_CLASS_INIT(&tag[0], "foot-date");
1.1 schwarze 342: print_otag(h, TAG_TD, 1, tag);
1.25 schwarze 343:
1.1 schwarze 344: print_text(h, b);
345: print_stagq(h, tt);
346:
1.25 schwarze 347: PAIR_CLASS_INIT(&tag[0], "foot-os");
1.26 ! schwarze 348: if (NULL == h->style) {
! 349: PAIR_INIT(&tag[1], ATTR_ALIGN, "right");
! 350: print_otag(h, TAG_TD, 2, tag);
! 351: } else
! 352: print_otag(h, TAG_TD, 1, tag);
1.25 schwarze 353:
1.1 schwarze 354: if (m->source)
355: print_text(h, m->source);
356: print_tagq(h, t);
357: }
358:
359:
360:
361: /* ARGSUSED */
362: static int
363: man_br_pre(MAN_ARGS)
364: {
365: struct roffsu su;
366: struct htmlpair tag;
367:
368: SCALE_VS_INIT(&su, 1);
369:
1.21 schwarze 370: if (MAN_sp == n->tok) {
1.8 schwarze 371: if (n->child)
372: a2roffsu(n->child->string, &su, SCALE_VS);
1.21 schwarze 373: } else
1.1 schwarze 374: su.scale = 0;
375:
376: bufcat_su(h, "height", &su);
377: PAIR_STYLE_INIT(&tag, h);
378: print_otag(h, TAG_DIV, 1, &tag);
1.4 schwarze 379:
1.3 schwarze 380: /* So the div isn't empty: */
381: print_text(h, "\\~");
382:
1.1 schwarze 383: return(0);
384: }
385:
386:
387: /* ARGSUSED */
388: static int
389: man_SH_pre(MAN_ARGS)
390: {
1.25 schwarze 391: struct htmlpair tag;
1.1 schwarze 392:
1.25 schwarze 393: if (MAN_BLOCK == n->type) {
394: PAIR_CLASS_INIT(&tag, "section");
395: print_otag(h, TAG_DIV, 1, &tag);
1.1 schwarze 396: return(1);
1.25 schwarze 397: } else if (MAN_BODY == n->type)
1.1 schwarze 398: return(1);
399:
1.25 schwarze 400: print_otag(h, TAG_H1, 0, NULL);
1.1 schwarze 401: return(1);
402: }
403:
404:
405: /* ARGSUSED */
406: static int
407: man_alt_pre(MAN_ARGS)
408: {
409: const struct man_node *nn;
410: struct tag *t;
411: int i;
1.4 schwarze 412: enum htmlfont fp;
1.1 schwarze 413:
414: for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
415: switch (n->tok) {
416: case (MAN_BI):
1.4 schwarze 417: fp = i % 2 ? HTMLFONT_ITALIC : HTMLFONT_BOLD;
1.1 schwarze 418: break;
419: case (MAN_IB):
1.4 schwarze 420: fp = i % 2 ? HTMLFONT_BOLD : HTMLFONT_ITALIC;
1.1 schwarze 421: break;
422: case (MAN_RI):
1.4 schwarze 423: fp = i % 2 ? HTMLFONT_ITALIC : HTMLFONT_NONE;
1.1 schwarze 424: break;
425: case (MAN_IR):
1.4 schwarze 426: fp = i % 2 ? HTMLFONT_NONE : HTMLFONT_ITALIC;
1.1 schwarze 427: break;
428: case (MAN_BR):
1.4 schwarze 429: fp = i % 2 ? HTMLFONT_NONE : HTMLFONT_BOLD;
1.1 schwarze 430: break;
431: case (MAN_RB):
1.4 schwarze 432: fp = i % 2 ? HTMLFONT_BOLD : HTMLFONT_NONE;
1.1 schwarze 433: break;
434: default:
435: abort();
436: /* NOTREACHED */
437: }
438:
439: if (i)
440: h->flags |= HTML_NOSPACE;
441:
1.4 schwarze 442: /*
443: * Open and close the scope with each argument, so that
444: * internal \f escapes, which are common, are also
445: * closed out with the scope.
446: */
447: t = print_ofont(h, fp);
1.18 schwarze 448: print_man_node(m, nn, mh, h);
1.4 schwarze 449: print_tagq(h, t);
1.1 schwarze 450: }
451:
452: return(0);
453: }
454:
455:
456: /* ARGSUSED */
457: static int
1.26 ! schwarze 458: man_SM_pre(MAN_ARGS)
1.1 schwarze 459: {
460: struct htmlpair tag;
461:
1.4 schwarze 462: /* FIXME: print_ofont(). */
1.1 schwarze 463: PAIR_CLASS_INIT(&tag, "small");
464: print_otag(h, TAG_SPAN, 1, &tag);
1.26 ! schwarze 465: if (MAN_SB == n->tok)
! 466: print_ofont(h, HTMLFONT_BOLD);
1.1 schwarze 467: return(1);
468: }
469:
470:
471: /* ARGSUSED */
472: static int
473: man_SS_pre(MAN_ARGS)
474: {
1.25 schwarze 475: struct htmlpair tag;
1.1 schwarze 476:
1.25 schwarze 477: if (MAN_BLOCK == n->type) {
478: PAIR_CLASS_INIT(&tag, "subsection");
479: print_otag(h, TAG_DIV, 1, &tag);
1.1 schwarze 480: return(1);
1.25 schwarze 481: } else if (MAN_BODY == n->type)
1.1 schwarze 482: return(1);
483:
1.25 schwarze 484: print_otag(h, TAG_H2, 0, NULL);
1.1 schwarze 485: return(1);
486: }
487:
488:
489: /* ARGSUSED */
490: static int
491: man_PP_pre(MAN_ARGS)
492: {
493:
1.22 schwarze 494: if (MAN_HEAD == n->type)
495: return(0);
1.26 ! schwarze 496: else if (MAN_BODY == n->type && n->prev)
! 497: print_otag(h, TAG_P, 0, NULL);
1.22 schwarze 498:
1.1 schwarze 499: return(1);
500: }
501:
502:
503: /* ARGSUSED */
504: static int
505: man_IP_pre(MAN_ARGS)
506: {
507: struct roffsu su;
508: struct htmlpair tag;
509: const struct man_node *nn;
510: int width;
511:
512: /*
513: * This scattering of 1-BU margins and pads is to make sure that
514: * when text overruns its box, the subsequent text isn't flush
515: * up against it. However, the rest of the right-hand box must
516: * also be adjusted in consideration of this 1-BU space.
517: */
518:
519: if (MAN_BODY == n->type) {
1.26 ! schwarze 520: print_otag(h, TAG_TD, 0, NULL);
1.1 schwarze 521: return(1);
522: }
523:
524: nn = MAN_BLOCK == n->type ?
525: n->head->child : n->parent->head->child;
526:
527: SCALE_HS_INIT(&su, INDENT);
528: width = 0;
529:
1.7 schwarze 530: /* Width is the last token. */
531:
1.1 schwarze 532: if (MAN_IP == n->tok && NULL != nn)
533: if (NULL != (nn = nn->next)) {
534: for ( ; nn->next; nn = nn->next)
535: /* Do nothing. */ ;
536: width = a2width(nn, &su);
537: }
538:
1.7 schwarze 539: /* Width is the first token. */
540:
541: if (MAN_TP == n->tok && NULL != nn) {
542: /* Skip past non-text children. */
543: while (nn && MAN_TEXT != nn->type)
544: nn = nn->next;
545: if (nn)
546: width = a2width(nn, &su);
547: }
1.1 schwarze 548:
549: if (MAN_BLOCK == n->type) {
1.26 ! schwarze 550: print_otag(h, TAG_P, 0, NULL);
! 551: print_otag(h, TAG_TABLE, 0, NULL);
! 552: bufcat_su(h, "width", &su);
1.1 schwarze 553: PAIR_STYLE_INIT(&tag, h);
1.26 ! schwarze 554: print_otag(h, TAG_COL, 1, &tag);
! 555: print_otag(h, TAG_COL, 0, NULL);
! 556: print_otag(h, TAG_TBODY, 0, NULL);
! 557: print_otag(h, TAG_TR, 0, NULL);
1.1 schwarze 558: return(1);
559: }
560:
1.26 ! schwarze 561: print_otag(h, TAG_TD, 0, NULL);
1.1 schwarze 562:
1.7 schwarze 563: /*
564: * Without a length string, we can print all of our children.
565: */
1.1 schwarze 566:
567: if ( ! width)
568: return(1);
1.7 schwarze 569:
570: /*
571: * When a length has been specified, we need to carefully print
572: * our child context: IP gets all children printed but the last
573: * (the width), while TP gets all children printed but the first
574: * (the width).
575: */
1.1 schwarze 576:
577: if (MAN_IP == n->tok)
578: for (nn = n->child; nn->next; nn = nn->next)
1.18 schwarze 579: print_man_node(m, nn, mh, h);
1.1 schwarze 580: if (MAN_TP == n->tok)
581: for (nn = n->child->next; nn; nn = nn->next)
1.18 schwarze 582: print_man_node(m, nn, mh, h);
1.1 schwarze 583:
584: return(0);
585: }
586:
587:
588: /* ARGSUSED */
589: static int
590: man_HP_pre(MAN_ARGS)
591: {
1.26 ! schwarze 592: struct htmlpair tag;
! 593: struct roffsu su;
! 594: const struct man_node *np;
1.1 schwarze 595:
1.26 ! schwarze 596: np = MAN_BLOCK == n->type ?
! 597: n->head->child :
! 598: n->parent->head->child;
1.1 schwarze 599:
1.26 ! schwarze 600: if (NULL == np || ! a2width(np, &su))
! 601: SCALE_HS_INIT(&su, INDENT);
1.1 schwarze 602:
1.26 ! schwarze 603: if (MAN_HEAD == n->type) {
! 604: print_otag(h, TAG_TD, 0, NULL);
! 605: return(0);
! 606: } else if (MAN_BLOCK == n->type) {
! 607: print_otag(h, TAG_P, 0, NULL);
! 608: print_otag(h, TAG_TABLE, 0, NULL);
! 609: bufcat_su(h, "width", &su);
1.1 schwarze 610: PAIR_STYLE_INIT(&tag, h);
1.26 ! schwarze 611: print_otag(h, TAG_COL, 1, &tag);
! 612: print_otag(h, TAG_COL, 0, NULL);
! 613: print_otag(h, TAG_TBODY, 0, NULL);
! 614: print_otag(h, TAG_TR, 0, NULL);
1.1 schwarze 615: return(1);
616: }
617:
1.26 ! schwarze 618: su.scale = -su.scale;
1.1 schwarze 619: bufcat_su(h, "text-indent", &su);
620: PAIR_STYLE_INIT(&tag, h);
1.26 ! schwarze 621: print_otag(h, TAG_TD, 1, &tag);
1.1 schwarze 622: return(1);
623: }
624:
625:
626: /* ARGSUSED */
627: static int
628: man_B_pre(MAN_ARGS)
629: {
630:
1.4 schwarze 631: print_ofont(h, HTMLFONT_BOLD);
1.1 schwarze 632: return(1);
633: }
634:
635:
636: /* ARGSUSED */
637: static int
638: man_I_pre(MAN_ARGS)
639: {
1.4 schwarze 640:
641: print_ofont(h, HTMLFONT_ITALIC);
1.1 schwarze 642: return(1);
1.18 schwarze 643: }
644:
645:
646: /* ARGSUSED */
647: static int
648: man_literal_pre(MAN_ARGS)
649: {
650:
1.21 schwarze 651: if (MAN_nf == n->tok) {
1.18 schwarze 652: print_otag(h, TAG_BR, 0, NULL);
653: mh->fl |= MANH_LITERAL;
1.21 schwarze 654: } else
1.18 schwarze 655: mh->fl &= ~MANH_LITERAL;
656:
657: return(1);
658: }
659:
660:
661: /* ARGSUSED */
662: static int
663: man_in_pre(MAN_ARGS)
664: {
665:
666: print_otag(h, TAG_BR, 0, NULL);
667: return(0);
1.1 schwarze 668: }
669:
670:
671: /* ARGSUSED */
672: static int
673: man_ign_pre(MAN_ARGS)
674: {
675:
676: return(0);
677: }
678:
679:
680: /* ARGSUSED */
681: static int
682: man_RS_pre(MAN_ARGS)
683: {
684: struct htmlpair tag;
685: struct roffsu su;
686:
687: if (MAN_HEAD == n->type)
688: return(0);
689: else if (MAN_BODY == n->type)
690: return(1);
691:
692: SCALE_HS_INIT(&su, INDENT);
1.26 ! schwarze 693: if (n->head->child)
1.1 schwarze 694: a2width(n->head->child, &su);
695:
1.26 ! schwarze 696: bufcat_su(h, "margin-left", &su);
1.1 schwarze 697: PAIR_STYLE_INIT(&tag, h);
698: print_otag(h, TAG_DIV, 1, &tag);
699: return(1);
700: }