Annotation of src/usr.bin/mandoc/man_html.c, Revision 1.13
1.13 ! schwarze 1: /* $Id: man_html.c,v 1.12 2010/05/20 00:58:02 schwarze Exp $ */
1.1 schwarze 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:
19: #include <assert.h>
20: #include <ctype.h>
21: #include <stdio.h>
22: #include <stdlib.h>
23: #include <string.h>
24:
25: #include "out.h"
26: #include "html.h"
27: #include "man.h"
28: #include "main.h"
29:
30: /* TODO: preserve ident widths. */
1.2 schwarze 31: /* FIXME: have PD set the default vspace width. */
1.1 schwarze 32:
33: #define INDENT 5
34: #define HALFINDENT 3
35:
36: #define MAN_ARGS const struct man_meta *m, \
37: const struct man_node *n, \
38: struct html *h
39:
40: struct htmlman {
41: int (*pre)(MAN_ARGS);
42: int (*post)(MAN_ARGS);
43: };
44:
45: static void print_man(MAN_ARGS);
46: static void print_man_head(MAN_ARGS);
47: static void print_man_nodelist(MAN_ARGS);
48: static void print_man_node(MAN_ARGS);
49:
50: static int a2width(const struct man_node *,
51: struct roffsu *);
52:
53: static int man_alt_pre(MAN_ARGS);
54: static int man_br_pre(MAN_ARGS);
55: static int man_ign_pre(MAN_ARGS);
56: static void man_root_post(MAN_ARGS);
57: static int man_root_pre(MAN_ARGS);
58: static int man_B_pre(MAN_ARGS);
59: static int man_HP_pre(MAN_ARGS);
60: static int man_I_pre(MAN_ARGS);
61: static int man_IP_pre(MAN_ARGS);
62: static int man_PP_pre(MAN_ARGS);
63: static int man_RS_pre(MAN_ARGS);
64: static int man_SB_pre(MAN_ARGS);
65: static int man_SH_pre(MAN_ARGS);
66: static int man_SM_pre(MAN_ARGS);
67: static int man_SS_pre(MAN_ARGS);
68:
69: static const struct htmlman mans[MAN_MAX] = {
70: { man_br_pre, NULL }, /* br */
71: { NULL, NULL }, /* TH */
72: { man_SH_pre, NULL }, /* SH */
73: { man_SS_pre, NULL }, /* SS */
74: { man_IP_pre, NULL }, /* TP */
75: { man_PP_pre, NULL }, /* LP */
76: { man_PP_pre, NULL }, /* PP */
77: { man_PP_pre, NULL }, /* P */
78: { man_IP_pre, NULL }, /* IP */
79: { man_HP_pre, NULL }, /* HP */
80: { man_SM_pre, NULL }, /* SM */
81: { man_SB_pre, NULL }, /* SB */
82: { man_alt_pre, NULL }, /* BI */
83: { man_alt_pre, NULL }, /* IB */
84: { man_alt_pre, NULL }, /* BR */
85: { man_alt_pre, NULL }, /* RB */
86: { NULL, NULL }, /* R */
87: { man_B_pre, NULL }, /* B */
88: { man_I_pre, NULL }, /* I */
89: { man_alt_pre, NULL }, /* IR */
90: { man_alt_pre, NULL }, /* RI */
91: { NULL, NULL }, /* na */
92: { NULL, NULL }, /* i */
93: { man_br_pre, NULL }, /* sp */
94: { NULL, NULL }, /* nf */
95: { NULL, NULL }, /* fi */
96: { NULL, NULL }, /* r */
97: { NULL, NULL }, /* RE */
98: { man_RS_pre, NULL }, /* RS */
99: { man_ign_pre, NULL }, /* DT */
100: { man_ign_pre, NULL }, /* UC */
1.2 schwarze 101: { man_ign_pre, NULL }, /* PD */
1.6 schwarze 102: { man_br_pre, NULL }, /* Sp */
1.8 schwarze 103: { man_ign_pre, NULL }, /* Vb */
104: { NULL, NULL }, /* Ve */
1.13 ! schwarze 105: { man_ign_pre, NULL }, /* AT */
1.1 schwarze 106: };
107:
108:
109: void
110: html_man(void *arg, const struct man *m)
111: {
112: struct html *h;
113: struct tag *t;
114:
115: h = (struct html *)arg;
116:
1.5 schwarze 117: print_gen_decls(h);
1.1 schwarze 118:
119: t = print_otag(h, TAG_HTML, 0, NULL);
120: print_man(man_meta(m), man_node(m), h);
121: print_tagq(h, t);
122:
123: printf("\n");
124: }
125:
126:
127: static void
128: print_man(MAN_ARGS)
129: {
130: struct tag *t;
131: struct htmlpair tag;
132:
133: t = print_otag(h, TAG_HEAD, 0, NULL);
134:
135: print_man_head(m, n, h);
136: print_tagq(h, t);
137: t = print_otag(h, TAG_BODY, 0, NULL);
138:
139: tag.key = ATTR_CLASS;
140: tag.val = "body";
141: print_otag(h, TAG_DIV, 1, &tag);
142:
143: print_man_nodelist(m, n, h);
144:
145: print_tagq(h, t);
146: }
147:
148:
149: /* ARGSUSED */
150: static void
151: print_man_head(MAN_ARGS)
152: {
153:
154: print_gen_head(h);
155: bufinit(h);
1.10 schwarze 156: buffmt(h, "%s(%s)", m->title, m->msec);
1.1 schwarze 157:
158: print_otag(h, TAG_TITLE, 0, NULL);
159: print_text(h, h->buf);
160: }
161:
162:
163: static void
164: print_man_nodelist(MAN_ARGS)
165: {
166:
167: print_man_node(m, n, h);
168: if (n->next)
169: print_man_nodelist(m, n->next, h);
170: }
171:
172:
173: static void
174: print_man_node(MAN_ARGS)
175: {
176: int child;
177: struct tag *t;
178:
179: child = 1;
1.2 schwarze 180: t = h->tags.head;
1.1 schwarze 181:
182: bufinit(h);
183:
1.7 schwarze 184: /*
185: * FIXME: embedded elements within next-line scopes (e.g., `br'
186: * within an empty `B') will cause formatting to be forgotten
187: * due to scope closing out.
188: */
189:
1.1 schwarze 190: switch (n->type) {
191: case (MAN_ROOT):
192: child = man_root_pre(m, n, h);
193: break;
194: case (MAN_TEXT):
195: print_text(h, n->string);
1.4 schwarze 196: return;
1.1 schwarze 197: default:
1.4 schwarze 198: /*
199: * Close out scope of font prior to opening a macro
200: * scope. Assert that the metafont is on the top of the
201: * stack (it's never nested).
202: */
203: if (h->metaf) {
204: assert(h->metaf == t);
205: print_tagq(h, h->metaf);
206: assert(NULL == h->metaf);
207: t = h->tags.head;
208: }
1.1 schwarze 209: if (mans[n->tok].pre)
210: child = (*mans[n->tok].pre)(m, n, h);
211: break;
212: }
213:
214: if (child && n->child)
215: print_man_nodelist(m, n->child, h);
216:
1.4 schwarze 217: /* This will automatically close out any font scope. */
1.1 schwarze 218: print_stagq(h, t);
219:
220: bufinit(h);
221:
222: switch (n->type) {
223: case (MAN_ROOT):
224: man_root_post(m, n, h);
225: break;
226: case (MAN_TEXT):
227: break;
228: default:
229: if (mans[n->tok].post)
230: (*mans[n->tok].post)(m, n, h);
231: break;
232: }
233: }
234:
235:
236: static int
237: a2width(const struct man_node *n, struct roffsu *su)
238: {
239:
240: if (MAN_TEXT != n->type)
241: return(0);
242: if (a2roffsu(n->string, su, SCALE_BU))
243: return(1);
244:
245: return(0);
246: }
247:
248:
249: /* ARGSUSED */
250: static int
251: man_root_pre(MAN_ARGS)
252: {
1.3 schwarze 253: struct htmlpair tag[3];
1.1 schwarze 254: struct tag *t, *tt;
255: char b[BUFSIZ], title[BUFSIZ];
256:
257: b[0] = 0;
258: if (m->vol)
259: (void)strlcat(b, m->vol, BUFSIZ);
260:
1.10 schwarze 261: snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec);
1.1 schwarze 262:
263: PAIR_CLASS_INIT(&tag[0], "header");
264: bufcat_style(h, "width", "100%");
265: PAIR_STYLE_INIT(&tag[1], h);
1.3 schwarze 266: PAIR_SUMMARY_INIT(&tag[2], "header");
267:
268: t = print_otag(h, TAG_TABLE, 3, tag);
1.1 schwarze 269: tt = print_otag(h, TAG_TR, 0, NULL);
270:
271: bufinit(h);
272: bufcat_style(h, "width", "10%");
273: PAIR_STYLE_INIT(&tag[0], h);
274: print_otag(h, TAG_TD, 1, tag);
275: print_text(h, title);
276: print_stagq(h, tt);
277:
278: bufinit(h);
279: bufcat_style(h, "width", "80%");
280: bufcat_style(h, "white-space", "nowrap");
281: bufcat_style(h, "text-align", "center");
282: PAIR_STYLE_INIT(&tag[0], h);
283: print_otag(h, TAG_TD, 1, tag);
284: print_text(h, b);
285: print_stagq(h, tt);
286:
287: bufinit(h);
288: bufcat_style(h, "width", "10%");
289: bufcat_style(h, "text-align", "right");
290: PAIR_STYLE_INIT(&tag[0], h);
291: print_otag(h, TAG_TD, 1, tag);
292: print_text(h, title);
293: print_tagq(h, t);
294: return(1);
295: }
296:
297:
298: /* ARGSUSED */
299: static void
300: man_root_post(MAN_ARGS)
301: {
1.3 schwarze 302: struct htmlpair tag[3];
1.1 schwarze 303: struct tag *t, *tt;
1.2 schwarze 304: char b[DATESIZ];
1.1 schwarze 305:
1.2 schwarze 306: time2a(m->date, b, DATESIZ);
1.1 schwarze 307:
308: PAIR_CLASS_INIT(&tag[0], "footer");
309: bufcat_style(h, "width", "100%");
310: PAIR_STYLE_INIT(&tag[1], h);
1.3 schwarze 311: PAIR_SUMMARY_INIT(&tag[2], "footer");
312:
313: t = print_otag(h, TAG_TABLE, 3, tag);
1.1 schwarze 314: tt = print_otag(h, TAG_TR, 0, NULL);
315:
316: bufinit(h);
317: bufcat_style(h, "width", "50%");
318: PAIR_STYLE_INIT(&tag[0], h);
319: print_otag(h, TAG_TD, 1, tag);
320: print_text(h, b);
321: print_stagq(h, tt);
322:
323: bufinit(h);
324: bufcat_style(h, "width", "50%");
325: bufcat_style(h, "text-align", "right");
326: PAIR_STYLE_INIT(&tag[0], h);
327: print_otag(h, TAG_TD, 1, tag);
328: if (m->source)
329: print_text(h, m->source);
330: print_tagq(h, t);
331: }
332:
333:
334:
335: /* ARGSUSED */
336: static int
337: man_br_pre(MAN_ARGS)
338: {
339: struct roffsu su;
340: struct htmlpair tag;
341:
342: SCALE_VS_INIT(&su, 1);
343:
1.8 schwarze 344: switch (n->tok) {
345: case (MAN_Sp):
346: SCALE_VS_INIT(&su, 0.5);
347: break;
348: case (MAN_sp):
349: if (n->child)
350: a2roffsu(n->child->string, &su, SCALE_VS);
351: break;
352: default:
1.1 schwarze 353: su.scale = 0;
1.8 schwarze 354: break;
355: }
1.1 schwarze 356:
357: bufcat_su(h, "height", &su);
358: PAIR_STYLE_INIT(&tag, h);
359: print_otag(h, TAG_DIV, 1, &tag);
1.4 schwarze 360:
1.3 schwarze 361: /* So the div isn't empty: */
362: print_text(h, "\\~");
363:
1.1 schwarze 364: return(0);
365: }
366:
367:
368: /* ARGSUSED */
369: static int
370: man_SH_pre(MAN_ARGS)
371: {
372: struct htmlpair tag[2];
373: struct roffsu su;
374:
375: if (MAN_BODY == n->type) {
376: SCALE_HS_INIT(&su, INDENT);
377: bufcat_su(h, "margin-left", &su);
378: PAIR_CLASS_INIT(&tag[0], "sec-body");
379: PAIR_STYLE_INIT(&tag[1], h);
380: print_otag(h, TAG_DIV, 2, tag);
381: return(1);
382: } else if (MAN_BLOCK == n->type) {
383: PAIR_CLASS_INIT(&tag[0], "sec-block");
384: if (n->prev && MAN_SH == n->prev->tok)
385: if (NULL == n->prev->body->child) {
386: print_otag(h, TAG_DIV, 1, tag);
387: return(1);
388: }
389:
390: SCALE_VS_INIT(&su, 1);
391: bufcat_su(h, "margin-top", &su);
392: if (NULL == n->next)
393: bufcat_su(h, "margin-bottom", &su);
394: PAIR_STYLE_INIT(&tag[1], h);
395: print_otag(h, TAG_DIV, 2, tag);
396: return(1);
397: }
398:
399: PAIR_CLASS_INIT(&tag[0], "sec-head");
400: print_otag(h, TAG_DIV, 1, tag);
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);
448: print_man_node(m, nn, h);
449: print_tagq(h, t);
1.1 schwarze 450: }
451:
452: return(0);
453: }
454:
455:
456: /* ARGSUSED */
457: static int
458: man_SB_pre(MAN_ARGS)
459: {
460: struct htmlpair tag;
461:
1.4 schwarze 462: /* FIXME: print_ofont(). */
1.1 schwarze 463: PAIR_CLASS_INIT(&tag, "small bold");
464: print_otag(h, TAG_SPAN, 1, &tag);
465: return(1);
466: }
467:
468:
469: /* ARGSUSED */
470: static int
471: man_SM_pre(MAN_ARGS)
472: {
473: struct htmlpair tag;
474:
475: PAIR_CLASS_INIT(&tag, "small");
476: print_otag(h, TAG_SPAN, 1, &tag);
477: return(1);
478: }
479:
480:
481: /* ARGSUSED */
482: static int
483: man_SS_pre(MAN_ARGS)
484: {
485: struct htmlpair tag[3];
486: struct roffsu su;
487:
488: SCALE_VS_INIT(&su, 1);
489:
490: if (MAN_BODY == n->type) {
491: PAIR_CLASS_INIT(&tag[0], "ssec-body");
492: if (n->parent->next && n->child) {
493: bufcat_su(h, "margin-bottom", &su);
494: PAIR_STYLE_INIT(&tag[1], h);
495: print_otag(h, TAG_DIV, 2, tag);
496: return(1);
497: }
498:
499: print_otag(h, TAG_DIV, 1, tag);
500: return(1);
501: } else if (MAN_BLOCK == n->type) {
502: PAIR_CLASS_INIT(&tag[0], "ssec-block");
503: if (n->prev && MAN_SS == n->prev->tok)
504: if (n->prev->body->child) {
505: bufcat_su(h, "margin-top", &su);
506: PAIR_STYLE_INIT(&tag[1], h);
507: print_otag(h, TAG_DIV, 2, tag);
508: return(1);
509: }
510:
511: print_otag(h, TAG_DIV, 1, tag);
512: return(1);
513: }
514:
515: SCALE_HS_INIT(&su, INDENT - HALFINDENT);
516: bufcat_su(h, "margin-left", &su);
517: PAIR_CLASS_INIT(&tag[0], "ssec-head");
518: PAIR_STYLE_INIT(&tag[1], h);
519: print_otag(h, TAG_DIV, 2, tag);
520: return(1);
521: }
522:
523:
524: /* ARGSUSED */
525: static int
526: man_PP_pre(MAN_ARGS)
527: {
528: struct htmlpair tag;
529: struct roffsu su;
530: int i;
531:
532: if (MAN_BLOCK != n->type)
533: return(1);
534:
535: i = 0;
536:
1.4 schwarze 537: if (MAN_ROOT == n->parent->type) {
1.1 schwarze 538: SCALE_HS_INIT(&su, INDENT);
539: bufcat_su(h, "margin-left", &su);
1.4 schwarze 540: i = 1;
1.1 schwarze 541: }
1.4 schwarze 542: if (n->prev) {
1.1 schwarze 543: SCALE_VS_INIT(&su, 1);
1.4 schwarze 544: bufcat_su(h, "margin-top", &su);
545: i = 1;
1.1 schwarze 546: }
547:
548: PAIR_STYLE_INIT(&tag, h);
1.4 schwarze 549: print_otag(h, TAG_DIV, i, &tag);
1.1 schwarze 550: return(1);
551: }
552:
553:
554: /* ARGSUSED */
555: static int
556: man_IP_pre(MAN_ARGS)
557: {
558: struct roffsu su;
559: struct htmlpair tag;
560: const struct man_node *nn;
561: int width;
562:
563: /*
564: * This scattering of 1-BU margins and pads is to make sure that
565: * when text overruns its box, the subsequent text isn't flush
566: * up against it. However, the rest of the right-hand box must
567: * also be adjusted in consideration of this 1-BU space.
568: */
569:
570: if (MAN_BODY == n->type) {
571: SCALE_HS_INIT(&su, INDENT);
572: bufcat_su(h, "margin-left", &su);
573: PAIR_STYLE_INIT(&tag, h);
574: print_otag(h, TAG_DIV, 1, &tag);
575: return(1);
576: }
577:
578: nn = MAN_BLOCK == n->type ?
579: n->head->child : n->parent->head->child;
580:
581: SCALE_HS_INIT(&su, INDENT);
582: width = 0;
583:
1.7 schwarze 584: /* Width is the last token. */
585:
1.1 schwarze 586: if (MAN_IP == n->tok && NULL != nn)
587: if (NULL != (nn = nn->next)) {
588: for ( ; nn->next; nn = nn->next)
589: /* Do nothing. */ ;
590: width = a2width(nn, &su);
591: }
592:
1.7 schwarze 593: /* Width is the first token. */
594:
595: if (MAN_TP == n->tok && NULL != nn) {
596: /* Skip past non-text children. */
597: while (nn && MAN_TEXT != nn->type)
598: nn = nn->next;
599: if (nn)
600: width = a2width(nn, &su);
601: }
1.1 schwarze 602:
603: if (MAN_BLOCK == n->type) {
604: bufcat_su(h, "margin-left", &su);
605: SCALE_VS_INIT(&su, 1);
606: bufcat_su(h, "margin-top", &su);
607: bufcat_style(h, "clear", "both");
608: PAIR_STYLE_INIT(&tag, h);
609: print_otag(h, TAG_DIV, 1, &tag);
610: return(1);
611: }
612:
613: bufcat_su(h, "min-width", &su);
614: SCALE_INVERT(&su);
615: bufcat_su(h, "margin-left", &su);
616: SCALE_HS_INIT(&su, 1);
617: bufcat_su(h, "margin-right", &su);
618: bufcat_style(h, "clear", "left");
619:
620: if (n->next && n->next->child)
621: bufcat_style(h, "float", "left");
622:
623: PAIR_STYLE_INIT(&tag, h);
624: print_otag(h, TAG_DIV, 1, &tag);
625:
1.7 schwarze 626: /*
627: * Without a length string, we can print all of our children.
628: */
1.1 schwarze 629:
630: if ( ! width)
631: return(1);
1.7 schwarze 632:
633: /*
634: * When a length has been specified, we need to carefully print
635: * our child context: IP gets all children printed but the last
636: * (the width), while TP gets all children printed but the first
637: * (the width).
638: */
1.1 schwarze 639:
640: if (MAN_IP == n->tok)
641: for (nn = n->child; nn->next; nn = nn->next)
642: print_man_node(m, nn, h);
643: if (MAN_TP == n->tok)
644: for (nn = n->child->next; nn; nn = nn->next)
645: print_man_node(m, nn, h);
646:
647: return(0);
648: }
649:
650:
651: /* ARGSUSED */
652: static int
653: man_HP_pre(MAN_ARGS)
654: {
655: const struct man_node *nn;
656: struct htmlpair tag;
657: struct roffsu su;
658:
659: if (MAN_HEAD == n->type)
660: return(0);
661:
662: nn = MAN_BLOCK == n->type ?
663: n->head->child : n->parent->head->child;
664:
665: SCALE_HS_INIT(&su, INDENT);
666:
667: if (NULL != nn)
668: (void)a2width(nn, &su);
669:
670: if (MAN_BLOCK == n->type) {
671: bufcat_su(h, "margin-left", &su);
672: SCALE_VS_INIT(&su, 1);
673: bufcat_su(h, "margin-top", &su);
674: bufcat_style(h, "clear", "both");
675: PAIR_STYLE_INIT(&tag, h);
676: print_otag(h, TAG_DIV, 1, &tag);
677: return(1);
678: }
679:
680: bufcat_su(h, "margin-left", &su);
681: SCALE_INVERT(&su);
682: bufcat_su(h, "text-indent", &su);
683:
684: PAIR_STYLE_INIT(&tag, h);
685: print_otag(h, TAG_DIV, 1, &tag);
686: return(1);
687: }
688:
689:
690: /* ARGSUSED */
691: static int
692: man_B_pre(MAN_ARGS)
693: {
694:
1.4 schwarze 695: print_ofont(h, HTMLFONT_BOLD);
1.1 schwarze 696: return(1);
697: }
698:
699:
700: /* ARGSUSED */
701: static int
702: man_I_pre(MAN_ARGS)
703: {
1.4 schwarze 704:
705: print_ofont(h, HTMLFONT_ITALIC);
1.1 schwarze 706: return(1);
707: }
708:
709:
710: /* ARGSUSED */
711: static int
712: man_ign_pre(MAN_ARGS)
713: {
714:
715: return(0);
716: }
717:
718:
719: /* ARGSUSED */
720: static int
721: man_RS_pre(MAN_ARGS)
722: {
723: struct htmlpair tag;
724: struct roffsu su;
725:
726: if (MAN_HEAD == n->type)
727: return(0);
728: else if (MAN_BODY == n->type)
729: return(1);
730:
731: SCALE_HS_INIT(&su, INDENT);
732: bufcat_su(h, "margin-left", &su);
733:
734: if (n->head->child) {
735: SCALE_VS_INIT(&su, 1);
736: a2width(n->head->child, &su);
737: bufcat_su(h, "margin-top", &su);
738: }
739:
740: PAIR_STYLE_INIT(&tag, h);
741: print_otag(h, TAG_DIV, 1, &tag);
742: return(1);
743: }