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