Annotation of src/usr.bin/mandoc/man_html.c, Revision 1.1
1.1 ! schwarze 1: /* $Id: man_html.c,v 1.11 2009/10/18 19:03:36 kristaps Exp $ */
! 2: /*
! 3: * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
! 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: #include <sys/queue.h>
! 19:
! 20: #include <assert.h>
! 21: #include <ctype.h>
! 22: #include <err.h>
! 23: #include <stdio.h>
! 24: #include <stdlib.h>
! 25: #include <string.h>
! 26:
! 27: #include "out.h"
! 28: #include "html.h"
! 29: #include "man.h"
! 30: #include "main.h"
! 31:
! 32: /* TODO: preserve ident widths. */
! 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, \
! 39: struct html *h
! 40:
! 41: struct htmlman {
! 42: int (*pre)(MAN_ARGS);
! 43: int (*post)(MAN_ARGS);
! 44: };
! 45:
! 46: static void print_man(MAN_ARGS);
! 47: static void print_man_head(MAN_ARGS);
! 48: static void print_man_nodelist(MAN_ARGS);
! 49: static void print_man_node(MAN_ARGS);
! 50:
! 51: static int a2width(const struct man_node *,
! 52: struct roffsu *);
! 53:
! 54: static int man_alt_pre(MAN_ARGS);
! 55: static int man_br_pre(MAN_ARGS);
! 56: static int man_ign_pre(MAN_ARGS);
! 57: static void man_root_post(MAN_ARGS);
! 58: static int man_root_pre(MAN_ARGS);
! 59: static int man_B_pre(MAN_ARGS);
! 60: static int man_HP_pre(MAN_ARGS);
! 61: static int man_I_pre(MAN_ARGS);
! 62: static int man_IP_pre(MAN_ARGS);
! 63: static int man_PP_pre(MAN_ARGS);
! 64: static int man_RS_pre(MAN_ARGS);
! 65: static int man_SB_pre(MAN_ARGS);
! 66: static int man_SH_pre(MAN_ARGS);
! 67: static int man_SM_pre(MAN_ARGS);
! 68: static int man_SS_pre(MAN_ARGS);
! 69:
! 70: static const struct htmlman mans[MAN_MAX] = {
! 71: { man_br_pre, NULL }, /* br */
! 72: { NULL, NULL }, /* TH */
! 73: { man_SH_pre, NULL }, /* SH */
! 74: { man_SS_pre, NULL }, /* SS */
! 75: { man_IP_pre, NULL }, /* TP */
! 76: { man_PP_pre, NULL }, /* LP */
! 77: { man_PP_pre, NULL }, /* PP */
! 78: { man_PP_pre, NULL }, /* P */
! 79: { man_IP_pre, NULL }, /* IP */
! 80: { man_HP_pre, NULL }, /* HP */
! 81: { man_SM_pre, NULL }, /* SM */
! 82: { man_SB_pre, NULL }, /* SB */
! 83: { man_alt_pre, NULL }, /* BI */
! 84: { man_alt_pre, NULL }, /* IB */
! 85: { man_alt_pre, NULL }, /* BR */
! 86: { man_alt_pre, NULL }, /* RB */
! 87: { NULL, NULL }, /* R */
! 88: { man_B_pre, NULL }, /* B */
! 89: { man_I_pre, NULL }, /* I */
! 90: { man_alt_pre, NULL }, /* IR */
! 91: { man_alt_pre, NULL }, /* RI */
! 92: { NULL, NULL }, /* na */
! 93: { NULL, NULL }, /* i */
! 94: { man_br_pre, NULL }, /* sp */
! 95: { NULL, NULL }, /* nf */
! 96: { NULL, NULL }, /* fi */
! 97: { NULL, NULL }, /* r */
! 98: { NULL, NULL }, /* RE */
! 99: { man_RS_pre, NULL }, /* RS */
! 100: { man_ign_pre, NULL }, /* DT */
! 101: { man_ign_pre, NULL }, /* UC */
! 102: };
! 103:
! 104:
! 105: void
! 106: html_man(void *arg, const struct man *m)
! 107: {
! 108: struct html *h;
! 109: struct tag *t;
! 110:
! 111: h = (struct html *)arg;
! 112:
! 113: print_gen_doctype(h);
! 114:
! 115: t = print_otag(h, TAG_HTML, 0, NULL);
! 116: print_man(man_meta(m), man_node(m), h);
! 117: print_tagq(h, t);
! 118:
! 119: printf("\n");
! 120: }
! 121:
! 122:
! 123: static void
! 124: print_man(MAN_ARGS)
! 125: {
! 126: struct tag *t;
! 127: struct htmlpair tag;
! 128:
! 129: t = print_otag(h, TAG_HEAD, 0, NULL);
! 130:
! 131: print_man_head(m, n, h);
! 132: print_tagq(h, t);
! 133: t = print_otag(h, TAG_BODY, 0, NULL);
! 134:
! 135: tag.key = ATTR_CLASS;
! 136: tag.val = "body";
! 137: print_otag(h, TAG_DIV, 1, &tag);
! 138:
! 139: print_man_nodelist(m, n, h);
! 140:
! 141: print_tagq(h, t);
! 142: }
! 143:
! 144:
! 145: /* ARGSUSED */
! 146: static void
! 147: print_man_head(MAN_ARGS)
! 148: {
! 149:
! 150: print_gen_head(h);
! 151: bufinit(h);
! 152: buffmt(h, "%s(%d)", m->title, m->msec);
! 153:
! 154: print_otag(h, TAG_TITLE, 0, NULL);
! 155: print_text(h, h->buf);
! 156: }
! 157:
! 158:
! 159: static void
! 160: print_man_nodelist(MAN_ARGS)
! 161: {
! 162:
! 163: print_man_node(m, n, h);
! 164: if (n->next)
! 165: print_man_nodelist(m, n->next, h);
! 166: }
! 167:
! 168:
! 169: static void
! 170: print_man_node(MAN_ARGS)
! 171: {
! 172: int child;
! 173: struct tag *t;
! 174:
! 175: child = 1;
! 176: t = SLIST_FIRST(&h->tags);
! 177:
! 178: bufinit(h);
! 179:
! 180: switch (n->type) {
! 181: case (MAN_ROOT):
! 182: child = man_root_pre(m, n, h);
! 183: break;
! 184: case (MAN_TEXT):
! 185: print_text(h, n->string);
! 186: break;
! 187: default:
! 188: if (mans[n->tok].pre)
! 189: child = (*mans[n->tok].pre)(m, n, h);
! 190: break;
! 191: }
! 192:
! 193: if (child && n->child)
! 194: print_man_nodelist(m, n->child, h);
! 195:
! 196: print_stagq(h, t);
! 197:
! 198: bufinit(h);
! 199:
! 200: switch (n->type) {
! 201: case (MAN_ROOT):
! 202: man_root_post(m, n, h);
! 203: break;
! 204: case (MAN_TEXT):
! 205: break;
! 206: default:
! 207: if (mans[n->tok].post)
! 208: (*mans[n->tok].post)(m, n, h);
! 209: break;
! 210: }
! 211: }
! 212:
! 213:
! 214: static int
! 215: a2width(const struct man_node *n, struct roffsu *su)
! 216: {
! 217:
! 218: if (MAN_TEXT != n->type)
! 219: return(0);
! 220: if (a2roffsu(n->string, su, SCALE_BU))
! 221: return(1);
! 222:
! 223: return(0);
! 224: }
! 225:
! 226:
! 227: /* ARGSUSED */
! 228: static int
! 229: man_root_pre(MAN_ARGS)
! 230: {
! 231: struct htmlpair tag[2];
! 232: struct tag *t, *tt;
! 233: char b[BUFSIZ], title[BUFSIZ];
! 234:
! 235: b[0] = 0;
! 236: if (m->vol)
! 237: (void)strlcat(b, m->vol, BUFSIZ);
! 238:
! 239: (void)snprintf(title, BUFSIZ - 1,
! 240: "%s(%d)", m->title, m->msec);
! 241:
! 242: PAIR_CLASS_INIT(&tag[0], "header");
! 243: bufcat_style(h, "width", "100%");
! 244: PAIR_STYLE_INIT(&tag[1], h);
! 245: t = print_otag(h, TAG_TABLE, 2, tag);
! 246: tt = print_otag(h, TAG_TR, 0, NULL);
! 247:
! 248: bufinit(h);
! 249: bufcat_style(h, "width", "10%");
! 250: PAIR_STYLE_INIT(&tag[0], h);
! 251: print_otag(h, TAG_TD, 1, tag);
! 252: print_text(h, title);
! 253: print_stagq(h, tt);
! 254:
! 255: bufinit(h);
! 256: bufcat_style(h, "width", "80%");
! 257: bufcat_style(h, "white-space", "nowrap");
! 258: bufcat_style(h, "text-align", "center");
! 259: PAIR_STYLE_INIT(&tag[0], h);
! 260: print_otag(h, TAG_TD, 1, tag);
! 261: print_text(h, b);
! 262: print_stagq(h, tt);
! 263:
! 264: bufinit(h);
! 265: bufcat_style(h, "width", "10%");
! 266: bufcat_style(h, "text-align", "right");
! 267: PAIR_STYLE_INIT(&tag[0], h);
! 268: print_otag(h, TAG_TD, 1, tag);
! 269: print_text(h, title);
! 270: print_tagq(h, t);
! 271: return(1);
! 272: }
! 273:
! 274:
! 275: /* ARGSUSED */
! 276: static void
! 277: man_root_post(MAN_ARGS)
! 278: {
! 279: struct tm tm;
! 280: struct htmlpair tag[2];
! 281: struct tag *t, *tt;
! 282: char b[BUFSIZ];
! 283:
! 284: (void)localtime_r(&m->date, &tm);
! 285:
! 286: if (0 == strftime(b, BUFSIZ - 1, "%B %e, %Y", &tm))
! 287: err(EXIT_FAILURE, "strftime");
! 288:
! 289: PAIR_CLASS_INIT(&tag[0], "footer");
! 290: bufcat_style(h, "width", "100%");
! 291: PAIR_STYLE_INIT(&tag[1], h);
! 292: t = print_otag(h, TAG_TABLE, 2, tag);
! 293: tt = print_otag(h, TAG_TR, 0, NULL);
! 294:
! 295: bufinit(h);
! 296: bufcat_style(h, "width", "50%");
! 297: PAIR_STYLE_INIT(&tag[0], h);
! 298: print_otag(h, TAG_TD, 1, tag);
! 299: print_text(h, b);
! 300: print_stagq(h, tt);
! 301:
! 302: bufinit(h);
! 303: bufcat_style(h, "width", "50%");
! 304: bufcat_style(h, "text-align", "right");
! 305: PAIR_STYLE_INIT(&tag[0], h);
! 306: print_otag(h, TAG_TD, 1, tag);
! 307: if (m->source)
! 308: print_text(h, m->source);
! 309: print_tagq(h, t);
! 310: }
! 311:
! 312:
! 313:
! 314: /* ARGSUSED */
! 315: static int
! 316: man_br_pre(MAN_ARGS)
! 317: {
! 318: struct roffsu su;
! 319: struct htmlpair tag;
! 320:
! 321: SCALE_VS_INIT(&su, 1);
! 322:
! 323: if (MAN_sp == n->tok && n->child)
! 324: a2roffsu(n->child->string, &su, SCALE_VS);
! 325: else if (MAN_br == n->tok)
! 326: su.scale = 0;
! 327:
! 328: bufcat_su(h, "height", &su);
! 329: PAIR_STYLE_INIT(&tag, h);
! 330: print_otag(h, TAG_DIV, 1, &tag);
! 331: return(0);
! 332: }
! 333:
! 334:
! 335: /* ARGSUSED */
! 336: static int
! 337: man_SH_pre(MAN_ARGS)
! 338: {
! 339: struct htmlpair tag[2];
! 340: struct roffsu su;
! 341:
! 342: if (MAN_BODY == n->type) {
! 343: SCALE_HS_INIT(&su, INDENT);
! 344: bufcat_su(h, "margin-left", &su);
! 345: PAIR_CLASS_INIT(&tag[0], "sec-body");
! 346: PAIR_STYLE_INIT(&tag[1], h);
! 347: print_otag(h, TAG_DIV, 2, tag);
! 348: return(1);
! 349: } else if (MAN_BLOCK == n->type) {
! 350: PAIR_CLASS_INIT(&tag[0], "sec-block");
! 351: if (n->prev && MAN_SH == n->prev->tok)
! 352: if (NULL == n->prev->body->child) {
! 353: print_otag(h, TAG_DIV, 1, tag);
! 354: return(1);
! 355: }
! 356:
! 357: SCALE_VS_INIT(&su, 1);
! 358: bufcat_su(h, "margin-top", &su);
! 359: if (NULL == n->next)
! 360: bufcat_su(h, "margin-bottom", &su);
! 361: PAIR_STYLE_INIT(&tag[1], h);
! 362: print_otag(h, TAG_DIV, 2, tag);
! 363: return(1);
! 364: }
! 365:
! 366: PAIR_CLASS_INIT(&tag[0], "sec-head");
! 367: print_otag(h, TAG_DIV, 1, tag);
! 368: return(1);
! 369: }
! 370:
! 371:
! 372: /* ARGSUSED */
! 373: static int
! 374: man_alt_pre(MAN_ARGS)
! 375: {
! 376: const struct man_node *nn;
! 377: struct tag *t;
! 378: int i;
! 379: struct htmlpair tagi, tagb, *tagp;
! 380:
! 381: PAIR_CLASS_INIT(&tagi, "italic");
! 382: PAIR_CLASS_INIT(&tagb, "bold");
! 383:
! 384: for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
! 385: switch (n->tok) {
! 386: case (MAN_BI):
! 387: tagp = i % 2 ? &tagi : &tagb;
! 388: break;
! 389: case (MAN_IB):
! 390: tagp = i % 2 ? &tagb : &tagi;
! 391: break;
! 392: case (MAN_RI):
! 393: tagp = i % 2 ? &tagi : NULL;
! 394: break;
! 395: case (MAN_IR):
! 396: tagp = i % 2 ? NULL : &tagi;
! 397: break;
! 398: case (MAN_BR):
! 399: tagp = i % 2 ? NULL : &tagb;
! 400: break;
! 401: case (MAN_RB):
! 402: tagp = i % 2 ? &tagb : NULL;
! 403: break;
! 404: default:
! 405: abort();
! 406: /* NOTREACHED */
! 407: }
! 408:
! 409: if (i)
! 410: h->flags |= HTML_NOSPACE;
! 411:
! 412: if (tagp) {
! 413: t = print_otag(h, TAG_SPAN, 1, tagp);
! 414: print_man_node(m, nn, h);
! 415: print_tagq(h, t);
! 416: } else
! 417: print_man_node(m, nn, h);
! 418: }
! 419:
! 420: return(0);
! 421: }
! 422:
! 423:
! 424: /* ARGSUSED */
! 425: static int
! 426: man_SB_pre(MAN_ARGS)
! 427: {
! 428: struct htmlpair tag;
! 429:
! 430: PAIR_CLASS_INIT(&tag, "small bold");
! 431: print_otag(h, TAG_SPAN, 1, &tag);
! 432: return(1);
! 433: }
! 434:
! 435:
! 436: /* ARGSUSED */
! 437: static int
! 438: man_SM_pre(MAN_ARGS)
! 439: {
! 440: struct htmlpair tag;
! 441:
! 442: PAIR_CLASS_INIT(&tag, "small");
! 443: print_otag(h, TAG_SPAN, 1, &tag);
! 444: return(1);
! 445: }
! 446:
! 447:
! 448: /* ARGSUSED */
! 449: static int
! 450: man_SS_pre(MAN_ARGS)
! 451: {
! 452: struct htmlpair tag[3];
! 453: struct roffsu su;
! 454:
! 455: SCALE_VS_INIT(&su, 1);
! 456:
! 457: if (MAN_BODY == n->type) {
! 458: PAIR_CLASS_INIT(&tag[0], "ssec-body");
! 459: if (n->parent->next && n->child) {
! 460: bufcat_su(h, "margin-bottom", &su);
! 461: PAIR_STYLE_INIT(&tag[1], h);
! 462: print_otag(h, TAG_DIV, 2, tag);
! 463: return(1);
! 464: }
! 465:
! 466: print_otag(h, TAG_DIV, 1, tag);
! 467: return(1);
! 468: } else if (MAN_BLOCK == n->type) {
! 469: PAIR_CLASS_INIT(&tag[0], "ssec-block");
! 470: if (n->prev && MAN_SS == n->prev->tok)
! 471: if (n->prev->body->child) {
! 472: bufcat_su(h, "margin-top", &su);
! 473: PAIR_STYLE_INIT(&tag[1], h);
! 474: print_otag(h, TAG_DIV, 2, tag);
! 475: return(1);
! 476: }
! 477:
! 478: print_otag(h, TAG_DIV, 1, tag);
! 479: return(1);
! 480: }
! 481:
! 482: SCALE_HS_INIT(&su, INDENT - HALFINDENT);
! 483: bufcat_su(h, "margin-left", &su);
! 484: PAIR_CLASS_INIT(&tag[0], "ssec-head");
! 485: PAIR_STYLE_INIT(&tag[1], h);
! 486: print_otag(h, TAG_DIV, 2, tag);
! 487: return(1);
! 488: }
! 489:
! 490:
! 491: /* ARGSUSED */
! 492: static int
! 493: man_PP_pre(MAN_ARGS)
! 494: {
! 495: struct htmlpair tag;
! 496: struct roffsu su;
! 497: int i;
! 498:
! 499: if (MAN_BLOCK != n->type)
! 500: return(1);
! 501:
! 502: i = 0;
! 503:
! 504: if (MAN_ROOT == n->parent->tok) {
! 505: SCALE_HS_INIT(&su, INDENT);
! 506: bufcat_su(h, "margin-left", &su);
! 507: i++;
! 508: }
! 509: if (n->next && n->next->child) {
! 510: SCALE_VS_INIT(&su, 1);
! 511: bufcat_su(h, "margin-bottom", &su);
! 512: i++;
! 513: }
! 514:
! 515: PAIR_STYLE_INIT(&tag, h);
! 516: print_otag(h, TAG_DIV, i ? 1 : 0, &tag);
! 517: return(1);
! 518: }
! 519:
! 520:
! 521: /* ARGSUSED */
! 522: static int
! 523: man_IP_pre(MAN_ARGS)
! 524: {
! 525: struct roffsu su;
! 526: struct htmlpair tag;
! 527: const struct man_node *nn;
! 528: int width;
! 529:
! 530: /*
! 531: * This scattering of 1-BU margins and pads is to make sure that
! 532: * when text overruns its box, the subsequent text isn't flush
! 533: * up against it. However, the rest of the right-hand box must
! 534: * also be adjusted in consideration of this 1-BU space.
! 535: */
! 536:
! 537: if (MAN_BODY == n->type) {
! 538: SCALE_HS_INIT(&su, INDENT);
! 539: bufcat_su(h, "margin-left", &su);
! 540: PAIR_STYLE_INIT(&tag, h);
! 541: print_otag(h, TAG_DIV, 1, &tag);
! 542: return(1);
! 543: }
! 544:
! 545: nn = MAN_BLOCK == n->type ?
! 546: n->head->child : n->parent->head->child;
! 547:
! 548: SCALE_HS_INIT(&su, INDENT);
! 549: width = 0;
! 550:
! 551: if (MAN_IP == n->tok && NULL != nn)
! 552: if (NULL != (nn = nn->next)) {
! 553: for ( ; nn->next; nn = nn->next)
! 554: /* Do nothing. */ ;
! 555: width = a2width(nn, &su);
! 556: }
! 557:
! 558: if (MAN_TP == n->tok && NULL != nn)
! 559: width = a2width(nn, &su);
! 560:
! 561: if (MAN_BLOCK == n->type) {
! 562: bufcat_su(h, "margin-left", &su);
! 563: SCALE_VS_INIT(&su, 1);
! 564: bufcat_su(h, "margin-top", &su);
! 565: bufcat_style(h, "clear", "both");
! 566: PAIR_STYLE_INIT(&tag, h);
! 567: print_otag(h, TAG_DIV, 1, &tag);
! 568: return(1);
! 569: }
! 570:
! 571: bufcat_su(h, "min-width", &su);
! 572: SCALE_INVERT(&su);
! 573: bufcat_su(h, "margin-left", &su);
! 574: SCALE_HS_INIT(&su, 1);
! 575: bufcat_su(h, "margin-right", &su);
! 576: bufcat_style(h, "clear", "left");
! 577:
! 578: if (n->next && n->next->child)
! 579: bufcat_style(h, "float", "left");
! 580:
! 581: PAIR_STYLE_INIT(&tag, h);
! 582: print_otag(h, TAG_DIV, 1, &tag);
! 583:
! 584: /* With a length string, manually omit the last child. */
! 585:
! 586: if ( ! width)
! 587: return(1);
! 588:
! 589: if (MAN_IP == n->tok)
! 590: for (nn = n->child; nn->next; nn = nn->next)
! 591: print_man_node(m, nn, h);
! 592: if (MAN_TP == n->tok)
! 593: for (nn = n->child->next; nn; nn = nn->next)
! 594: print_man_node(m, nn, h);
! 595:
! 596: return(0);
! 597: }
! 598:
! 599:
! 600: /* ARGSUSED */
! 601: static int
! 602: man_HP_pre(MAN_ARGS)
! 603: {
! 604: const struct man_node *nn;
! 605: struct htmlpair tag;
! 606: struct roffsu su;
! 607:
! 608: if (MAN_HEAD == n->type)
! 609: return(0);
! 610:
! 611: nn = MAN_BLOCK == n->type ?
! 612: n->head->child : n->parent->head->child;
! 613:
! 614: SCALE_HS_INIT(&su, INDENT);
! 615:
! 616: if (NULL != nn)
! 617: (void)a2width(nn, &su);
! 618:
! 619: if (MAN_BLOCK == n->type) {
! 620: bufcat_su(h, "margin-left", &su);
! 621: SCALE_VS_INIT(&su, 1);
! 622: bufcat_su(h, "margin-top", &su);
! 623: bufcat_style(h, "clear", "both");
! 624: PAIR_STYLE_INIT(&tag, h);
! 625: print_otag(h, TAG_DIV, 1, &tag);
! 626: return(1);
! 627: }
! 628:
! 629: bufcat_su(h, "margin-left", &su);
! 630: SCALE_INVERT(&su);
! 631: bufcat_su(h, "text-indent", &su);
! 632:
! 633: PAIR_STYLE_INIT(&tag, h);
! 634: print_otag(h, TAG_DIV, 1, &tag);
! 635: return(1);
! 636: }
! 637:
! 638:
! 639: /* ARGSUSED */
! 640: static int
! 641: man_B_pre(MAN_ARGS)
! 642: {
! 643: struct htmlpair tag;
! 644:
! 645: PAIR_CLASS_INIT(&tag, "bold");
! 646: print_otag(h, TAG_SPAN, 1, &tag);
! 647: return(1);
! 648: }
! 649:
! 650:
! 651: /* ARGSUSED */
! 652: static int
! 653: man_I_pre(MAN_ARGS)
! 654: {
! 655: struct htmlpair tag;
! 656:
! 657: PAIR_CLASS_INIT(&tag, "italic");
! 658: print_otag(h, TAG_SPAN, 1, &tag);
! 659: return(1);
! 660: }
! 661:
! 662:
! 663: /* ARGSUSED */
! 664: static int
! 665: man_ign_pre(MAN_ARGS)
! 666: {
! 667:
! 668: return(0);
! 669: }
! 670:
! 671:
! 672: /* ARGSUSED */
! 673: static int
! 674: man_RS_pre(MAN_ARGS)
! 675: {
! 676: struct htmlpair tag;
! 677: struct roffsu su;
! 678:
! 679: if (MAN_HEAD == n->type)
! 680: return(0);
! 681: else if (MAN_BODY == n->type)
! 682: return(1);
! 683:
! 684: SCALE_HS_INIT(&su, INDENT);
! 685: bufcat_su(h, "margin-left", &su);
! 686:
! 687: if (n->head->child) {
! 688: SCALE_VS_INIT(&su, 1);
! 689: a2width(n->head->child, &su);
! 690: bufcat_su(h, "margin-top", &su);
! 691: }
! 692:
! 693: PAIR_STYLE_INIT(&tag, h);
! 694: print_otag(h, TAG_DIV, 1, &tag);
! 695: return(1);
! 696: }