From b35e18840fdc536364e4d41b021fe53af309bb59 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 5 Dec 2010 15:37:30 +0000 Subject: 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). --- mdoc_validate.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'mdoc_validate.c') 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 * @@ -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 -- cgit v1.2.3-56-ge451