From 8d0cb4701ac5891d39e391edc850d949676cbe04 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 20 Sep 2009 17:48:13 +0000 Subject: [PATCH] Bl -column in place for -Thtml. --- html.c | 30 ++++++++++++++++++++++++++---- mdoc_term.c | 4 ++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/html.c b/html.c index 358568f5..fb34e9fe 100644 --- a/html.c +++ b/html.c @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.37 2009/09/20 17:24:57 kristaps Exp $ */ +/* $Id: html.c,v 1.38 2009/09/20 17:48:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 91ccacf1..de4b9258 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.73 2009/09/20 17:24:57 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.74 2009/09/20 17:48:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 -- 2.47.1