=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.54 retrieving revision 1.75 diff -u -p -r1.54 -r1.75 --- mandoc/mdoc_html.c 2010/01/30 08:42:20 1.54 +++ mandoc/mdoc_html.c 2010/06/04 22:16:27 1.75 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.54 2010/01/30 08:42:20 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.75 2010/06/04 22:16:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -27,6 +27,7 @@ #include #include +#include "mandoc.h" #include "out.h" #include "html.h" #include "mdoc.h" @@ -56,8 +57,6 @@ static void print_mdoc_nodelist(MDOC_ARGS); static void a2width(const char *, struct roffsu *); static void a2offs(const char *, struct roffsu *); -static int a2list(const struct mdoc_node *); - static void mdoc_root_post(MDOC_ARGS); static int mdoc_root_pre(MDOC_ARGS); @@ -85,6 +84,7 @@ static void mdoc_dq_post(MDOC_ARGS); static int mdoc_dq_pre(MDOC_ARGS); static int mdoc_dv_pre(MDOC_ARGS); static int mdoc_fa_pre(MDOC_ARGS); +static void mdoc_fd_post(MDOC_ARGS); static int mdoc_fd_pre(MDOC_ARGS); static int mdoc_fl_pre(MDOC_ARGS); static int mdoc_fn_pre(MDOC_ARGS); @@ -97,11 +97,12 @@ static void mdoc_fo_post(MDOC_ARGS); static int mdoc_fo_pre(MDOC_ARGS); static int mdoc_ic_pre(MDOC_ARGS); static int mdoc_in_pre(MDOC_ARGS); -static int mdoc_it_block_pre(MDOC_ARGS, int, int, - struct roffsu *, struct roffsu *); -static int mdoc_it_head_pre(MDOC_ARGS, int, +static int mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list, + int, struct roffsu *, struct roffsu *); +static int mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list, struct roffsu *); -static int mdoc_it_body_pre(MDOC_ARGS, int); +static int mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list, + struct roffsu *); static int mdoc_it_pre(MDOC_ARGS); static int mdoc_lb_pre(MDOC_ARGS); static int mdoc_li_pre(MDOC_ARGS); @@ -158,7 +159,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = { {mdoc_ev_pre, NULL}, /* Ev */ {mdoc_ex_pre, NULL}, /* Ex */ {mdoc_fa_pre, NULL}, /* Fa */ - {mdoc_fd_pre, NULL}, /* Fd */ + {mdoc_fd_pre, mdoc_fd_post}, /* Fd */ {mdoc_fl_pre, NULL}, /* Fl */ {mdoc_fn_pre, NULL}, /* Fn */ {mdoc_ft_pre, NULL}, /* Ft */ @@ -200,7 +201,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = { {NULL, NULL}, /* Dc */ {mdoc_dq_pre, mdoc_dq_post}, /* Do */ {mdoc_dq_pre, mdoc_dq_post}, /* Dq */ - {NULL, NULL}, /* Ec */ + {NULL, NULL}, /* Ec */ /* FIXME: no space */ {NULL, NULL}, /* Ef */ {mdoc_em_pre, NULL}, /* Em */ {NULL, NULL}, /* Eo */ @@ -255,6 +256,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = { {mdoc_sp_pre, NULL}, /* br */ {mdoc_sp_pre, NULL}, /* sp */ {mdoc__x_pre, mdoc__x_post}, /* %U */ + {NULL, NULL}, /* Ta */ }; @@ -276,50 +278,6 @@ html_mdoc(void *arg, const struct mdoc *m) /* - * Return the list type for `Bl', e.g., `Bl -column' returns - * MDOC_Column. This can ONLY be run for lists; it will abort() if no - * list type is found. - */ -static int -a2list(const struct mdoc_node *n) -{ - int i; - - assert(n->args); - for (i = 0; i < (int)n->args->argc; i++) - switch (n->args->argv[i].arg) { - case (MDOC_Enum): - /* FALLTHROUGH */ - case (MDOC_Dash): - /* FALLTHROUGH */ - case (MDOC_Hyphen): - /* FALLTHROUGH */ - case (MDOC_Bullet): - /* FALLTHROUGH */ - case (MDOC_Tag): - /* FALLTHROUGH */ - case (MDOC_Hang): - /* FALLTHROUGH */ - case (MDOC_Inset): - /* FALLTHROUGH */ - case (MDOC_Diag): - /* FALLTHROUGH */ - case (MDOC_Item): - /* FALLTHROUGH */ - case (MDOC_Column): - /* FALLTHROUGH */ - case (MDOC_Ohang): - return(n->args->argv[i].arg); - default: - break; - } - - abort(); - /* NOTREACHED */ -} - - -/* * Calculate the scaling unit passed in a `-width' argument. This uses * either a native scaling unit (e.g., 1i, 2m) or the string length of * the value. @@ -387,7 +345,7 @@ print_mdoc_head(MDOC_ARGS) print_gen_head(h); bufinit(h); - buffmt(h, "%s(%d)", m->title, m->msec); + buffmt(h, "%s(%s)", m->title, m->msec); if (m->arch) { bufcat(h, " ("); @@ -509,7 +467,7 @@ mdoc_root_pre(MDOC_ARGS) } (void)snprintf(title, BUFSIZ - 1, - "%s(%d)", m->title, m->msec); + "%s(%s)", m->title, m->msec); /* XXX: see note in mdoc_root_post() about divs. */ @@ -589,14 +547,9 @@ mdoc_sh_pre(MDOC_ARGS) html_idcat(buf, " ", BUFSIZ); } - /* - * TODO: make sure there are no duplicates, as HTML does not - * allow for multiple `id' tags of the same name. - */ - PAIR_CLASS_INIT(&tag[0], "sec-head"); - tag[1].key = ATTR_ID; - tag[1].val = buf; + PAIR_ID_INIT(&tag[1], buf); + print_otag(h, TAG_DIV, 2, tag); return(1); } @@ -648,8 +601,8 @@ mdoc_ss_pre(MDOC_ARGS) PAIR_CLASS_INIT(&tag[0], "ssec-head"); PAIR_STYLE_INIT(&tag[1], h); - tag[2].key = ATTR_ID; - tag[2].val = buf; + PAIR_ID_INIT(&tag[2], buf); + print_otag(h, TAG_DIV, 3, tag); return(1); } @@ -671,10 +624,10 @@ mdoc_fl_pre(MDOC_ARGS) print_text(h, "\\-"); - /* A blank `Fl' should incur a subsequent space. */ - if (n->child) h->flags |= HTML_NOSPACE; + else if (n->next && n->next->line == n->line) + h->flags |= HTML_NOSPACE; return(1); } @@ -734,7 +687,11 @@ mdoc_nm_pre(MDOC_ARGS) { struct htmlpair tag; - if (SEC_SYNOPSIS == n->sec && n->prev) { + if (NULL == n->child && NULL == m->name) + return(1); + + if (SEC_SYNOPSIS == n->sec && + n->prev && MDOC_LINE & n->flags) { bufcat_style(h, "clear", "both"); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_BR, 1, &tag); @@ -756,14 +713,16 @@ mdoc_xr_pre(MDOC_ARGS) struct htmlpair tag[2]; const struct mdoc_node *nn; + if (NULL == n->child) + return(0); + PAIR_CLASS_INIT(&tag[0], "link-man"); if (h->base_man) { buffmt_man(h, n->child->string, n->child->next ? n->child->next->string : NULL); - tag[1].key = ATTR_HREF; - tag[1].val = h->buf; + PAIR_HREF_INIT(&tag[1], h->buf); print_otag(h, TAG_A, 2, tag); } else print_otag(h, TAG_A, 1, tag); @@ -866,7 +825,7 @@ mdoc_bx_pre(MDOC_ARGS) /* ARGSUSED */ static int -mdoc_it_block_pre(MDOC_ARGS, int type, int comp, +mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int comp, struct roffsu *offs, struct roffsu *width) { struct htmlpair tag; @@ -874,17 +833,16 @@ mdoc_it_block_pre(MDOC_ARGS, int type, int comp, struct roffsu su; nn = n->parent->parent; - assert(nn->args); /* XXX: see notes in mdoc_it_pre(). */ - if (MDOC_Column == type) { + if (LIST_column == type) { /* Don't width-pad on the left. */ SCALE_HS_INIT(width, 0); /* Also disallow non-compact. */ comp = 1; } - if (MDOC_Diag == type) + if (LIST_diag == type) /* Mandate non-compact with empty prior. */ if (n->prev && NULL == n->prev->body->child) comp = 1; @@ -921,17 +879,23 @@ mdoc_it_block_pre(MDOC_ARGS, int type, int comp, /* ARGSUSED */ static int -mdoc_it_body_pre(MDOC_ARGS, int type) +mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type, struct roffsu *width) { struct htmlpair tag; struct roffsu su; switch (type) { - case (MDOC_Item): + case (LIST_item): /* FALLTHROUGH */ - case (MDOC_Ohang): + case (LIST_ohang): /* FALLTHROUGH */ - case (MDOC_Column): + case (LIST_column): + bufcat_su(h, "min-width", width); + bufcat_style(h, "clear", "none"); + if (n->next) + bufcat_style(h, "float", "left"); + PAIR_STYLE_INIT(&tag, h); + print_otag(h, TAG_DIV, 1, &tag); break; default: /* @@ -951,25 +915,19 @@ mdoc_it_body_pre(MDOC_ARGS, int type) /* ARGSUSED */ static int -mdoc_it_head_pre(MDOC_ARGS, int type, struct roffsu *width) +mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list type, struct roffsu *width) { struct htmlpair tag; struct ord *ord; char nbuf[BUFSIZ]; switch (type) { - case (MDOC_Item): + case (LIST_item): return(0); - case (MDOC_Ohang): + case (LIST_ohang): print_otag(h, TAG_DIV, 0, &tag); return(1); - case (MDOC_Column): - bufcat_su(h, "min-width", width); - bufcat_style(h, "clear", "none"); - if (n->next && MDOC_HEAD == n->next->type) - bufcat_style(h, "float", "left"); - PAIR_STYLE_INIT(&tag, h); - print_otag(h, TAG_DIV, 1, &tag); + case (LIST_column): break; default: bufcat_su(h, "min-width", width); @@ -987,24 +945,24 @@ mdoc_it_head_pre(MDOC_ARGS, int type, struct roffsu *w } switch (type) { - case (MDOC_Diag): + case (LIST_diag): PAIR_CLASS_INIT(&tag, "diag"); print_otag(h, TAG_SPAN, 1, &tag); break; - case (MDOC_Enum): + case (LIST_enum): ord = h->ords.head; assert(ord); nbuf[BUFSIZ - 1] = 0; (void)snprintf(nbuf, BUFSIZ - 1, "%d.", ord->pos++); print_text(h, nbuf); return(0); - case (MDOC_Dash): + case (LIST_dash): print_text(h, "\\(en"); return(0); - case (MDOC_Hyphen): + case (LIST_hyphen): print_text(h, "\\(hy"); return(0); - case (MDOC_Bullet): + case (LIST_bullet): print_text(h, "\\(bu"); return(0); default: @@ -1018,9 +976,10 @@ mdoc_it_head_pre(MDOC_ARGS, int type, struct roffsu *w static int mdoc_it_pre(MDOC_ARGS) { - int i, type, wp, comp; + int i, wp, comp; const struct mdoc_node *bl, *nn; struct roffsu width, offs; + enum mdoc_list type; /* * XXX: be very careful in changing anything, here. Lists in @@ -1032,20 +991,20 @@ mdoc_it_pre(MDOC_ARGS) if (MDOC_BLOCK != n->type) bl = bl->parent; - type = a2list(bl); + type = bl->data.list; /* Set default width and offset. */ SCALE_HS_INIT(&offs, 0); switch (type) { - case (MDOC_Enum): + case (LIST_enum): /* FALLTHROUGH */ - case (MDOC_Dash): + case (LIST_dash): /* FALLTHROUGH */ - case (MDOC_Hyphen): + case (LIST_hyphen): /* FALLTHROUGH */ - case (MDOC_Bullet): + case (LIST_bullet): SCALE_HS_INIT(&width, 2); break; default: @@ -1055,7 +1014,8 @@ mdoc_it_pre(MDOC_ARGS) /* Get width, offset, and compact arguments. */ - for (wp = -1, comp = i = 0; i < (int)bl->args->argc; i++) + wp = -1; + for (comp = i = 0; bl->args && i < (int)bl->args->argc; i++) switch (bl->args->argv[i].arg) { case (MDOC_Column): wp = i; /* Save for later. */ @@ -1076,13 +1036,13 @@ mdoc_it_pre(MDOC_ARGS) /* Override width in some cases. */ switch (type) { - case (MDOC_Ohang): + case (LIST_ohang): /* FALLTHROUGH */ - case (MDOC_Item): + case (LIST_item): /* FALLTHROUGH */ - case (MDOC_Inset): + case (LIST_inset): /* FALLTHROUGH */ - case (MDOC_Diag): + case (LIST_diag): SCALE_HS_INIT(&width, 0); break; default: @@ -1091,25 +1051,21 @@ mdoc_it_pre(MDOC_ARGS) break; } - /* Flip to body/block processing. */ - - if (MDOC_BODY == n->type) - return(mdoc_it_body_pre(m, n, h, type)); - if (MDOC_BLOCK == n->type) - return(mdoc_it_block_pre(m, n, h, type, comp, - &offs, &width)); - - /* Override column widths. */ - - if (MDOC_Column == type) { + if (LIST_column == type && MDOC_BODY == n->type) { nn = n->parent->child; - for (i = 0; nn && nn != n; nn = nn->next, i++) - /* Counter... */ ; + for (i = 0; nn && nn != n; nn = nn->next) + if (MDOC_BODY == nn->type) + i++; if (i < (int)bl->args->argv[wp].sz) a2width(bl->args->argv[wp].value[i], &width); } - return(mdoc_it_head_pre(m, n, h, type, &width)); + if (MDOC_HEAD == n->type) + return(mdoc_it_head_pre(m, n, h, type, &width)); + else if (MDOC_BODY == n->type) + return(mdoc_it_body_pre(m, n, h, type, &width)); + + return(mdoc_it_block_pre(m, n, h, type, comp, &offs, &width)); } @@ -1119,9 +1075,11 @@ mdoc_bl_pre(MDOC_ARGS) { struct ord *ord; + if (MDOC_HEAD == n->type) + return(0); if (MDOC_BLOCK != n->type) return(1); - if (MDOC_Enum != a2list(n)) + if (LIST_enum != n->data.list) return(1); ord = malloc(sizeof(struct ord)); @@ -1145,7 +1103,7 @@ mdoc_bl_post(MDOC_ARGS) if (MDOC_BLOCK != n->type) return; - if (MDOC_Enum != a2list(n)) + if (LIST_enum != n->data.list) return; ord = h->ords.head; @@ -1181,7 +1139,7 @@ mdoc_ex_pre(MDOC_ARGS) h->flags &= ~HTML_NOSPACE; } - if (n->child->next) + if (n->child && n->child->next) print_text(h, "utilities exit"); else print_text(h, "utility exits"); @@ -1289,7 +1247,7 @@ mdoc_d1_pre(MDOC_ARGS) /* FIXME: D1 shouldn't be literal. */ - SCALE_VS_INIT(&su, INDENT - 2); + SCALE_VS_INIT(&su, INDENT - 1); bufcat_su(h, "margin-left", &su); PAIR_CLASS_INIT(&tag[0], "lit"); PAIR_STYLE_INIT(&tag[1], h); @@ -1306,8 +1264,6 @@ mdoc_sx_pre(MDOC_ARGS) const struct mdoc_node *nn; char buf[BUFSIZ]; - /* FIXME: duplicates? */ - strlcpy(buf, "#", BUFSIZ); for (nn = n->child; nn; nn = nn->next) { html_idcat(buf, nn->string, BUFSIZ); @@ -1316,8 +1272,7 @@ mdoc_sx_pre(MDOC_ARGS) } PAIR_CLASS_INIT(&tag[0], "link-sec"); - tag[1].key = ATTR_HREF; - tag[1].val = buf; + PAIR_HREF_INIT(&tag[1], buf); print_otag(h, TAG_A, 2, tag); return(1); @@ -1368,7 +1323,7 @@ mdoc_bd_pre(MDOC_ARGS) SCALE_VS_INIT(&su, 0); type = comp = 0; - for (i = 0; i < (int)bl->args->argc; i++) + for (i = 0; bl->args && i < (int)bl->args->argc; i++) switch (bl->args->argv[i].arg) { case (MDOC_Offset): a2offs(bl->args->argv[i].value[0], &su); @@ -1392,6 +1347,7 @@ mdoc_bd_pre(MDOC_ARGS) } /* FIXME: -centered, etc. formatting. */ + /* FIXME: does not respect -offset ??? */ if (MDOC_BLOCK == n->type) { bufcat_su(h, "margin-left", &su); @@ -1404,7 +1360,8 @@ mdoc_bd_pre(MDOC_ARGS) break; } if (comp) { - print_otag(h, TAG_DIV, 0, tag); + PAIR_STYLE_INIT(&tag[0], h); + print_otag(h, TAG_DIV, 1, tag); return(1); } SCALE_VS_INIT(&su, 1); @@ -1554,22 +1511,20 @@ mdoc_fa_pre(MDOC_ARGS) /* ARGSUSED */ +static void +mdoc_fd_post(MDOC_ARGS) +{ + + print_otag(h, TAG_BR, 0, NULL); +} + + +/* ARGSUSED */ static int mdoc_fd_pre(MDOC_ARGS) { struct htmlpair tag; - struct roffsu su; - if (SEC_SYNOPSIS == n->sec) { - if (n->next && MDOC_Fd != n->next->tok) { - SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-bottom", &su); - PAIR_STYLE_INIT(&tag, h); - print_otag(h, TAG_DIV, 1, &tag); - } else - print_otag(h, TAG_DIV, 0, NULL); - } - PAIR_CLASS_INIT(&tag, "macro"); print_otag(h, TAG_SPAN, 1, &tag); return(1); @@ -1583,15 +1538,15 @@ mdoc_vt_pre(MDOC_ARGS) struct htmlpair tag; struct roffsu su; - if (MDOC_BLOCK == n->type) { - if (n->prev && MDOC_Vt != n->prev->tok) { + if (SEC_SYNOPSIS == n->sec && MDOC_BLOCK == n->type) { + if (n->next && MDOC_Vt != n->next->tok) { SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-top", &su); + bufcat_su(h, "margin-bottom", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_DIV, 1, &tag); } else print_otag(h, TAG_DIV, 0, NULL); - + return(1); } else if (MDOC_HEAD == n->type) return(0); @@ -1607,17 +1562,9 @@ static int mdoc_ft_pre(MDOC_ARGS) { struct htmlpair tag; - struct roffsu su; - if (SEC_SYNOPSIS == n->sec) { - if (n->prev && MDOC_Fo == n->prev->tok) { - SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-top", &su); - PAIR_STYLE_INIT(&tag, h); - print_otag(h, TAG_DIV, 1, &tag); - } else - print_otag(h, TAG_DIV, 0, NULL); - } + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) + print_otag(h, TAG_DIV, 0, NULL); PAIR_CLASS_INIT(&tag, "ftype"); print_otag(h, TAG_SPAN, 1, &tag); @@ -1637,6 +1584,7 @@ mdoc_fn_pre(MDOC_ARGS) int sz, i; struct roffsu su; + /* NB: MDOC_LINE has no effect on this macro! */ if (SEC_SYNOPSIS == n->sec) { SCALE_HS_INIT(&su, INDENT); bufcat_su(h, "margin-left", &su); @@ -1671,10 +1619,27 @@ mdoc_fn_pre(MDOC_ARGS) } PAIR_CLASS_INIT(&tag[0], "fname"); + + /* + * FIXME: only refer to IDs that we know exist. + */ + +#if 0 + if (SEC_SYNOPSIS == n->sec) { + nbuf[0] = '\0'; + html_idcat(nbuf, sp, BUFSIZ); + PAIR_ID_INIT(&tag[1], nbuf); + } else { + strlcpy(nbuf, "#", BUFSIZ); + html_idcat(nbuf, sp, BUFSIZ); + PAIR_HREF_INIT(&tag[1], nbuf); + } +#endif + t = print_otag(h, TAG_SPAN, 1, tag); if (sp) { - (void)strlcpy(nbuf, sp, BUFSIZ); + strlcpy(nbuf, sp, BUFSIZ); print_text(h, nbuf); } @@ -1775,8 +1740,7 @@ mdoc_lk_pre(MDOC_ARGS) nn = n->child; PAIR_CLASS_INIT(&tag[0], "link-ext"); - tag[1].key = ATTR_HREF; - tag[1].val = nn->string; + PAIR_HREF_INIT(&tag[1], nn->string); print_otag(h, TAG_A, 2, tag); if (NULL == nn->next) @@ -1803,7 +1767,7 @@ mdoc_mt_pre(MDOC_ARGS) bufinit(h); bufcat(h, "mailto:"); bufcat(h, nn->string); - PAIR_STYLE_INIT(&tag[1], h); + PAIR_HREF_INIT(&tag[1], h->buf); t = print_otag(h, TAG_A, 2, tag); print_text(h, nn->string); print_tagq(h, t); @@ -1818,14 +1782,20 @@ static int mdoc_fo_pre(MDOC_ARGS) { struct htmlpair tag; + struct roffsu su; if (MDOC_BODY == n->type) { h->flags |= HTML_NOSPACE; print_text(h, "("); h->flags |= HTML_NOSPACE; return(1); - } else if (MDOC_BLOCK == n->type) + } else if (MDOC_BLOCK == n->type && n->next) { + SCALE_VS_INIT(&su, 1); + bufcat_su(h, "margin-bottom", &su); + PAIR_STYLE_INIT(&tag, h); + print_otag(h, TAG_DIV, 1, &tag); return(1); + } PAIR_CLASS_INIT(&tag, "fname"); print_otag(h, TAG_SPAN, 1, &tag); @@ -1854,39 +1824,24 @@ mdoc_in_pre(MDOC_ARGS) struct tag *t; struct htmlpair tag[2]; int i; - struct roffsu su; - if (SEC_SYNOPSIS == n->sec) { - if (n->next && MDOC_In != n->next->tok) { - SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-bottom", &su); - PAIR_STYLE_INIT(&tag[0], h); - print_otag(h, TAG_DIV, 1, tag); - } else - print_otag(h, TAG_DIV, 0, NULL); - } - - /* FIXME: there's a buffer bug in here somewhere. */ - PAIR_CLASS_INIT(&tag[0], "includes"); print_otag(h, TAG_SPAN, 1, tag); - if (SEC_SYNOPSIS == n->sec) + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) print_text(h, "#include"); print_text(h, "<"); h->flags |= HTML_NOSPACE; - /* XXX -- see warning in termp_in_post(). */ - for (nn = n->child; nn; nn = nn->next) { PAIR_CLASS_INIT(&tag[0], "link-includes"); i = 1; bufinit(h); if (h->base_includes) { buffmt_includes(h, nn->string); - tag[i].key = ATTR_HREF; - tag[i++].val = h->buf; + PAIR_HREF_INIT(&tag[i], h->buf); + i++; } t = print_otag(h, TAG_A, i, tag); print_mdoc_node(m, nn, h); @@ -1896,6 +1851,9 @@ mdoc_in_pre(MDOC_ARGS) h->flags |= HTML_NOSPACE; print_text(h, ">"); + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) + print_otag(h, TAG_BR, 0, NULL); + return(0); } @@ -1938,7 +1896,7 @@ mdoc_rv_pre(MDOC_ARGS) print_text(h, "()"); } - if (n->child->next) + if (n->child && n->child->next) print_text(h, "functions return"); else print_text(h, "function returns"); @@ -2027,8 +1985,7 @@ mdoc_bf_pre(MDOC_ARGS) else if ( ! strcmp("Li", n->head->child->string)) PAIR_CLASS_INIT(&tag[0], "lit"); } else { - assert(n->args); - for (i = 0; i < (int)n->args->argc; i++) + for (i = 0; n->args && i < (int)n->args->argc; i++) switch (n->args->argv[i].arg) { case (MDOC_Symbolic): PAIR_CLASS_INIT(&tag[0], "symb"); @@ -2161,7 +2118,7 @@ mdoc_lb_pre(MDOC_ARGS) { struct htmlpair tag; - if (SEC_SYNOPSIS == n->sec) + if (SEC_LIBRARY == n->sec && MDOC_LINE & n->flags) print_otag(h, TAG_DIV, 0, NULL); PAIR_CLASS_INIT(&tag, "lib"); print_otag(h, TAG_SPAN, 1, &tag); @@ -2211,8 +2168,6 @@ mdoc__x_pre(MDOC_ARGS) break; case(MDOC__T): PAIR_CLASS_INIT(&tag[0], "ref-title"); - print_text(h, "\\(lq"); - h->flags |= HTML_NOSPACE; break; case(MDOC__U): PAIR_CLASS_INIT(&tag[0], "link-ref"); @@ -2241,14 +2196,8 @@ static void mdoc__x_post(MDOC_ARGS) { + /* TODO: %U */ + h->flags |= HTML_NOSPACE; - switch (n->tok) { - case (MDOC__T): - print_text(h, "\\(rq"); - h->flags |= HTML_NOSPACE; - break; - default: - break; - } print_text(h, n->next ? "," : "."); }