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).
-/* $Id: main.c,v 1.115 2010/12/02 20:41:46 schwarze Exp $ */
+/* $Id: main.c,v 1.116 2010/12/05 15:37:30 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
"NAME section must come first",
"bad Boolean value",
"child violates parent syntax",
+ "displays may not be nested",
"bad AT&T symbol",
"bad standard",
"list type repeated",
"generic fatal error",
"column syntax is inconsistent",
- "displays may not be nested",
"unsupported display type",
"blocks badly nested",
"no such block is open",
-/* $Id: mandoc.h,v 1.26 2010/12/01 16:54:25 kristaps Exp $ */
+/* $Id: mandoc.h,v 1.27 2010/12/05 15:37:30 kristaps Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
MANDOCERR_NAMESECFIRST, /* NAME section must come first */
MANDOCERR_BADBOOL, /* bad Boolean value */
MANDOCERR_CHILD, /* child violates parent syntax */
+ MANDOCERR_NESTEDDISP, /* displays may not be nested */
MANDOCERR_BADATT, /* bad AT&T symbol */
MANDOCERR_BADSTANDARD, /* bad standard */
MANDOCERR_LISTREP, /* list type repeated */
MANDOCERR_FATAL, /* ===== start of fatal errors ===== */
MANDOCERR_COLUMNS, /* column syntax is inconsistent */
- /* FIXME: this should be a MANDOCERR_ERROR */
- MANDOCERR_NESTEDDISP, /* displays may not be nested */
MANDOCERR_BADDISP, /* unsupported display type */
MANDOCERR_SCOPEFATAL, /* blocks badly nested */
MANDOCERR_SYNTNOSCOPE, /* no scope to rewind: syntax violated */
-.\" $Id: mdoc.7,v 1.167 2010/11/30 21:44:59 schwarze Exp $
+.\" $Id: mdoc.7,v 1.168 2010/12/05 15:37:30 kristaps Exp $
.\"
.\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 30 2010 $
+.Dd $Mdocdate: December 5 2010 $
.Dt MDOC 7
.Os
.Sh NAME
.Pp
.Bl -dash -compact
.It
+Display macros
+.Pq Sx \&Bd , Sx \&Dl , and Sx \&D1
+may not be nested.
+\*[hist]
+.It
.Sx \&At
with unknown arguments produces no output at all.
\*[hist]
-/* $Id: mdoc_html.c,v 1.113 2010/11/29 13:02:47 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.114 2010/12/05 15:37:30 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
/* FALLTHROUGH */
case (MDOC_Bl):
/* FALLTHROUGH */
+ case (MDOC_D1):
+ /* FALLTHROUGH */
+ case (MDOC_Dl):
+ /* FALLTHROUGH */
case (MDOC_Lp):
/* FALLTHROUGH */
case (MDOC_Pp):
-/* $Id: mdoc_term.c,v 1.195 2010/11/29 13:02:47 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.196 2010/12/05 15:37:30 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
/* FALLTHROUGH */
case (MDOC_Bl):
/* FALLTHROUGH */
+ case (MDOC_D1):
+ /* FALLTHROUGH */
+ case (MDOC_Dl):
+ /* FALLTHROUGH */
case (MDOC_Lp):
/* FALLTHROUGH */
case (MDOC_Pp):
-/* $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>
*
#define POST_ARGS struct mdoc *mdoc
#define NUMSIZ 32
-#define DATESIZ 32
+#define DATESIZE 32
enum check_ineq {
CHECK_LT,
{
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);
}
static int
post_dd(POST_ARGS)
{
- char buf[DATESIZ];
+ char buf[DATESIZE];
struct mdoc_node *n;
n = mdoc->last;
return(1);
}
- if ( ! concat(mdoc, buf, n->child, DATESIZ))
+ if ( ! concat(mdoc, buf, n->child, DATESIZE))
return(0);
mdoc->meta.date = mandoc_a2time