summaryrefslogtreecommitdiffstats
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
commitf1be851316db6766465ba5fa434d98d9d17394d4 (patch)
tree1c289fced2bbca2b75490376acf02e80e879a391 /validate.c
parent298505dc44c0dc7c7349e4cc246e6cf76c55b5e5 (diff)
downloadmandoc-f1be851316db6766465ba5fa434d98d9d17394d4.tar.gz
Added support for dynamic -width detection for -tag lists.
Diffstat (limited to 'validate.c')
-rw-r--r--validate.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/validate.c b/validate.c
index 0a5fb8f3..197397dd 100644
--- a/validate.c
+++ b/validate.c
@@ -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);
}