summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-05 15:37:30 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-05 15:37:30 +0000
commit0b4127a628b0da28fe24f16107d14c5255d71a4a (patch)
treee50aa98f84d127316d90a7b81856012b83bc81b7 /mdoc_validate.c
parent627ca9c00340387199629fec275445d9acebc21d (diff)
downloadmandoc-0b4127a628b0da28fe24f16107d14c5255d71a4a.tar.gz
Merge schwarze@'s changes allowing nested displays. Tweak the patch by
making sure output doesn't add a superfluous newline with the nested displays. Also add a COMPATIBILITY note. Rename a macro (DATESIZ) to be in line with OpenBSD (DATESIZE).
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 912730bb..b728d52f 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -42,7 +42,7 @@
#define POST_ARGS struct mdoc *mdoc
#define NUMSIZ 32
-#define DATESIZ 32
+#define DATESIZE 32
enum check_ineq {
CHECK_LT,
@@ -575,22 +575,18 @@ pre_display(PRE_ARGS)
{
struct mdoc_node *node;
- /* Display elements (`Bd', `D1'...) cannot be nested. */
-
if (MDOC_BLOCK != n->type)
return(1);
- /* LINTED */
for (node = mdoc->last->parent; node; node = node->parent)
if (MDOC_BLOCK == node->type)
if (MDOC_Bd == node->tok)
break;
- if (NULL == node)
- return(1);
+ if (node)
+ mdoc_nmsg(mdoc, n, MANDOCERR_NESTEDDISP);
- mdoc_nmsg(mdoc, n, MANDOCERR_NESTEDDISP);
- return(0);
+ return(1);
}
@@ -1951,7 +1947,7 @@ pre_literal(PRE_ARGS)
static int
post_dd(POST_ARGS)
{
- char buf[DATESIZ];
+ char buf[DATESIZE];
struct mdoc_node *n;
n = mdoc->last;
@@ -1961,7 +1957,7 @@ post_dd(POST_ARGS)
return(1);
}
- if ( ! concat(mdoc, buf, n->child, DATESIZ))
+ if ( ! concat(mdoc, buf, n->child, DATESIZE))
return(0);
mdoc->meta.date = mandoc_a2time