summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-12 11:21:44 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-12 11:21:44 +0000
commitdfe0c6ee455f4a355885a711c81c5ae06ac20160 (patch)
tree315130eeda507d9b21635e011e5e3fd44e81fec9 /mdoc_html.c
parent19a85530e5d01229ad79001edab4bec02b3acda3 (diff)
downloadmandoc-dfe0c6ee455f4a355885a711c81c5ae06ac20160.tar.gz
Cache all of `Bd's resolved arguments into mdoc_bd, which is stashed in
the "data" union in mdoc_node. Allows me to remove some ugly loops in the front-end and duplicate tests in mdoc_action.c. Add a regression test to make sure we're not doing anything bad (more to come).
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 66f005b1..04a313b1 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1353,31 +1353,19 @@ static int
mdoc_bd_pre(MDOC_ARGS)
{
struct htmlpair tag[2];
- int comp, i;
- const struct mdoc_node *bl, *nn;
+ int comp;
+ const struct mdoc_node *nn;
struct roffsu su;
- if (MDOC_BLOCK == n->type)
- bl = n;
- else if (MDOC_HEAD == n->type)
+ if (MDOC_HEAD == n->type)
return(0);
- else
- bl = n->parent;
SCALE_VS_INIT(&su, 0);
- comp = 0;
- 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);
- break;
- case (MDOC_Compact):
- comp = 1;
- break;
- default:
- break;
- }
+ if (n->data.Bd.offs)
+ a2offs(n->data.Bd.offs, &su);
+
+ comp = n->data.Bd.comp;
/* FIXME: -centered, etc. formatting. */
/* FIXME: does not respect -offset ??? */
@@ -1404,8 +1392,8 @@ mdoc_bd_pre(MDOC_ARGS)
return(1);
}
- if (DISP_unfilled != n->data.disp &&
- DISP_literal != n->data.disp)
+ if (DISP_unfilled != n->data.Bd.type &&
+ DISP_literal != n->data.Bd.type)
return(1);
PAIR_CLASS_INIT(&tag[0], "lit");