summaryrefslogtreecommitdiffstatshomepage
path: root/validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-28 13:47:36 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-28 13:47:36 +0000
commit144a953361b31d61aa5ffd0785aad13f5469f3d6 (patch)
tree67406a99e3d01a2d8c36f7a241304074a4afc3c5 /validate.c
parent7539dc2101f097466da8b895b680b64f5015d3ef (diff)
downloadmandoc-144a953361b31d61aa5ffd0785aad13f5469f3d6.tar.gz
mandoc-144a953361b31d61aa5ffd0785aad13f5469f3d6.tar.zst
mandoc-144a953361b31d61aa5ffd0785aad13f5469f3d6.zip
Added support for dynamic -width detection for -tag lists.
Diffstat (limited to 'validate.c')
-rw-r--r--validate.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/validate.c b/validate.c
index ea91d92f..5673e094 100644
--- a/validate.c
+++ b/validate.c
@@ -1,4 +1,4 @@
-/* $Id: validate.c,v 1.63 2009/02/27 09:39:40 kristaps Exp $ */
+/* $Id: validate.c,v 1.64 2009/02/28 13:47:36 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -36,9 +36,7 @@
typedef int (*v_pre)(PRE_ARGS);
typedef int (*v_post)(POST_ARGS);
-/* FIXME: some sections should only occur in specific msecs. */
-/* FIXME: ignoring Pp. */
-/* FIXME: math symbols. */
+/* TODO: ignoring Pp (it's superfluous in some invocations). */
struct valids {
v_pre *pre;
@@ -626,11 +624,11 @@ pre_bl(PRE_ARGS)
"superfluous -%s argument",
mdoc_argnames[MDOC_Width]));
case (MDOC_Tag):
- if (-1 != width)
- break;
- return(mdoc_nwarn(mdoc, n, WARN_SYNTAX,
- "suggest -%s argument",
- mdoc_argnames[MDOC_Width]));
+ if (-1 == width && ! mdoc_nwarn(mdoc, n, WARN_SYNTAX,
+ "suggest -%s argument",
+ mdoc_argnames[MDOC_Width]))
+ return(0);
+ break;
default:
break;
}
@@ -706,8 +704,6 @@ static int
pre_it(PRE_ARGS)
{
- /* TODO: children too big for -width? */
-
if (MDOC_BLOCK != n->type)
return(1);
return(check_parent(mdoc, n, MDOC_Bl, MDOC_BODY));
@@ -1056,19 +1052,25 @@ post_bl(POST_ARGS)
if (MDOC_BODY != mdoc->last->type)
return(1);
+ if (NULL == (mdoc->last->child))
+ return(1);
+
+ /*
+ * Only allow `It' macros to be the immediate descendants of the
+ * `Bl' list.
+ */
/* LINTED */
for (n = mdoc->last->child; n; n = n->next) {
if (MDOC_BLOCK == n->type)
if (MDOC_It == n->tok)
continue;
- break;
- }
- if (NULL == n)
- return(1);
+ return(mdoc_nerr(mdoc, n, "bad child of parent %s",
+ mdoc_macronames[mdoc->last->tok]));
+ }
- return(mdoc_nerr(mdoc, n, "bad child of parent list"));
+ return(1);
}