diff options
-rw-r--r-- | html.c | 28 | ||||
-rw-r--r-- | mdoc_term.c | 2 |
2 files changed, 26 insertions, 4 deletions
@@ -1271,6 +1271,8 @@ mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int c) struct htmlpair tag; switch (t) { + case (MDOC_Column): + /* FALLTHROUGH */ case (MDOC_Item): /* FALLTHROUGH */ case (MDOC_Ohang): @@ -1281,7 +1283,6 @@ mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int c) break; } - if ( ! c && n->prev && n->prev->body->child) bufcat("padding-top: 1em;"); @@ -1316,6 +1317,15 @@ mdoc_tbl_head_pre(MDOC_ARGS, int t, int w) case (MDOC_Ohang): print_otag(h, TAG_DIV, 0, NULL); break; + case (MDOC_Column): + buffmt("min-width: %dem;", w); + bufcat("clear: none;"); + if (n->next && MDOC_HEAD == n->next->type) + bufcat("float: left;"); + tag.key = ATTR_STYLE; + tag.val = buf; + print_otag(h, TAG_DIV, 1, &tag); + break; default: buffmt("margin-left: -%dem;", w); bufcat("clear: left;"); @@ -1360,8 +1370,8 @@ mdoc_tbl_head_pre(MDOC_ARGS, int t, int w) static int mdoc_tbl_pre(MDOC_ARGS, int type) { - int i, w, o, c; - const struct mdoc_node *bl; + int i, w, o, c, wp; + const struct mdoc_node *bl, *nn; bl = n->parent->parent; if (MDOC_BLOCK != n->type) @@ -1372,16 +1382,28 @@ mdoc_tbl_pre(MDOC_ARGS, int type) assert(bl->args); w = o = c = 0; + wp = -1; for (i = 0; i < (int)bl->args->argc; i++) if (MDOC_Width == bl->args->argv[i].arg) { assert(bl->args->argv[i].sz); + wp = i; w = a2width(bl->args->argv[i].value[0]); } else if (MDOC_Offset == bl->args->argv[i].arg) { assert(bl->args->argv[i].sz); o = a2offs(bl->args->argv[i].value[0]); } else if (MDOC_Compact == bl->args->argv[i].arg) c = 1; + + if (MDOC_HEAD == n->type && MDOC_Column == type) { + nn = n->parent->child; + assert(nn && MDOC_HEAD == nn->type); + for (i = 0; nn && nn != n; nn = nn->next, i++) + /* Counter... */ ; + assert(nn); + if (wp >= 0 && i < (int)bl->args[wp].argv->sz) + w = a2width(bl->args->argv[wp].value[i]); + } switch (type) { case (MDOC_Enum): diff --git a/mdoc_term.c b/mdoc_term.c index bac7d0f0..09d21c73 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -762,7 +762,7 @@ termp_it_pre(DECL_ARGS) * the 0 will be adjusted to default 10 or, if in the * last column case, set to stretch to the margin). */ - for (i = 0, n = node->prev; n && n && + for (i = 0, n = node->prev; n && i < (int)bl->args[vals[2]].argv->sz; n = n->prev, i++) offset += arg_width |