aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitaf1a16ee46c535e7e97fe26fc4c6c05844de41e2 (patch)
treebdb915b10db4fb4c1abb8e6c595cfc2957cb98e2 /mdoc_html.c
parent0b20ee1ae342d058c3e78b46ba69335c80addfda (diff)
downloadmandoc-af1a16ee46c535e7e97fe26fc4c6c05844de41e2.tar.gz
mandoc-af1a16ee46c535e7e97fe26fc4c6c05844de41e2.tar.zst
mandoc-af1a16ee46c535e7e97fe26fc4c6c05844de41e2.zip
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.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 0df11dc3..302cecb8 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.79 2010/06/12 10:09:19 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.80 2010/06/12 11:21:44 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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");