aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitb35e18840fdc536364e4d41b021fe53af309bb59 (patch)
treee3a70878bf36aefdb4f8f568eb3a38a112e3dbda /mdoc_validate.c
parent41593da964a8b2d9a3a505a574df65af794a486c (diff)
downloadmandoc-b35e18840fdc536364e4d41b021fe53af309bb59.tar.gz
mandoc-b35e18840fdc536364e4d41b021fe53af309bb59.tar.zst
mandoc-b35e18840fdc536364e4d41b021fe53af309bb59.zip
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.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index c5dd3934..2b10fd06 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.134 2010/12/01 13:05:13 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.135 2010/12/05 15:37:30 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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