=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.68 retrieving revision 1.72 diff -u -p -r1.68 -r1.72 --- mandoc/mdoc_html.c 2010/05/29 18:47:54 1.68 +++ mandoc/mdoc_html.c 2010/06/03 13:44:36 1.72 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.68 2010/05/29 18:47:54 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.72 2010/06/03 13:44:36 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -100,7 +100,8 @@ static int mdoc_it_block_pre(MDOC_ARGS, enum mdoc_l 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, enum mdoc_list); +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); @@ -254,6 +255,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 */ }; @@ -830,7 +832,6 @@ mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int struct roffsu su; nn = n->parent->parent; - assert(nn->args); /* XXX: see notes in mdoc_it_pre(). */ @@ -877,7 +878,7 @@ mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int /* ARGSUSED */ static int -mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type) +mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type, struct roffsu *width) { struct htmlpair tag; struct roffsu su; @@ -888,6 +889,12 @@ mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type) case (LIST_ohang): /* FALLTHROUGH */ 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: /* @@ -920,12 +927,6 @@ mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list type, struc print_otag(h, TAG_DIV, 0, &tag); return(1); case (LIST_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); break; default: bufcat_su(h, "min-width", width); @@ -1012,7 +1013,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. */ @@ -1048,25 +1050,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 (LIST_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)); } @@ -1324,7 +1322,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); @@ -1999,8 +1997,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"); @@ -2091,8 +2088,6 @@ mdoc_li_pre(MDOC_ARGS) PAIR_CLASS_INIT(&tag, "lit"); print_otag(h, TAG_SPAN, 1, &tag); - if (NULL == n->child) - print_text(h, ""); return(1); }