summaryrefslogtreecommitdiffstats
path: root/mdoc_action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-03 13:44:36 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-03 13:44:36 +0000
commit07dfb14a298c0d0ed7988ffc395a5402873c61b2 (patch)
tree26859b601b8f0fc89617847b6dbcaf89de68c07a /mdoc_action.c
parenta101b1f81e1c47960a700d0827125c765f47544f (diff)
downloadmandoc-07dfb14a298c0d0ed7988ffc395a5402873c61b2.tar.gz
Consolidated list processing to a single loop in mdoc_validate.c. This
relieves having to repeat running over the argument list in mdoc_action.c and mdoc_validate.c. Default to LIST_item for type-less lists (groff technically doesn't do this: it just ignores the `It' lines altogether). Make MANDOC_LISTTYPE be a recoverable error.
Diffstat (limited to 'mdoc_action.c')
-rw-r--r--mdoc_action.c62
1 files changed, 4 insertions, 58 deletions
diff --git a/mdoc_action.c b/mdoc_action.c
index 68e04210..43b92d9c 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -948,8 +948,7 @@ pre_offset(PRE_ARGS)
* stipulated by mdoc.samples.
*/
- assert(n->args);
- for (i = 0; i < (int)n->args->argc; i++) {
+ for (i = 0; n->args && i < (int)n->args->argc; i++) {
if (MDOC_Offset != n->args->argv[i].arg)
continue;
if (n->args->argv[i].sz)
@@ -969,63 +968,10 @@ pre_offset(PRE_ARGS)
static int
pre_bl(PRE_ARGS)
{
- int pos;
-
- if (MDOC_BLOCK != n->type) {
- assert(n->parent);
- assert(MDOC_BLOCK == n->parent->type);
- assert(MDOC_Bl == n->parent->tok);
- assert(LIST__NONE != n->parent->data.list);
- n->data.list = n->parent->data.list;
- return(1);
- }
-
- assert(LIST__NONE == n->data.list);
-
- for (pos = 0; pos < (int)n->args->argc; pos++) {
- switch (n->args->argv[pos].arg) {
- case (MDOC_Bullet):
- n->data.list = LIST_bullet;
- break;
- case (MDOC_Dash):
- n->data.list = LIST_dash;
- break;
- case (MDOC_Enum):
- n->data.list = LIST_enum;
- break;
- case (MDOC_Hyphen):
- n->data.list = LIST_hyphen;
- break;
- case (MDOC_Item):
- n->data.list = LIST_item;
- break;
- case (MDOC_Tag):
- n->data.list = LIST_tag;
- break;
- case (MDOC_Diag):
- n->data.list = LIST_diag;
- break;
- case (MDOC_Hang):
- n->data.list = LIST_hang;
- break;
- case (MDOC_Ohang):
- n->data.list = LIST_ohang;
- break;
- case (MDOC_Inset):
- n->data.list = LIST_inset;
- break;
- case (MDOC_Column):
- n->data.list = LIST_column;
- break;
- default:
- break;
- }
- if (LIST__NONE != n->data.list)
- break;
- }
- assert(LIST__NONE != n->data.list);
- return(pre_offset(m, n));
+ if (MDOC_BLOCK == n->type)
+ return(pre_offset(m, n));
+ return(1);
}