source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Merge schwarze@'s changes allowing nested displays.
@ 2010-12-05 15:37 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-12-05 15:37 UTC (permalink / raw)
  To: source

Log Message:
-----------
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).

Modified Files:
--------------
    mdocml:
        main.c
        mandoc.h
        mdoc.7
        mdoc_html.c
        mdoc_term.c
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.134 -r1.135
--- mdoc_validate.c
+++ 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
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.113 -r1.114
--- mdoc_html.c
+++ mdoc_html.c
@@ -1331,6 +1331,10 @@ mdoc_bd_pre(MDOC_ARGS)
 			/* FALLTHROUGH */
 		case (MDOC_Bl):
 			/* FALLTHROUGH */
+		case (MDOC_D1):
+			/* FALLTHROUGH */
+		case (MDOC_Dl):
+			/* FALLTHROUGH */
 		case (MDOC_Lp):
 			/* FALLTHROUGH */
 		case (MDOC_Pp):
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.195 -r1.196
--- mdoc_term.c
+++ mdoc_term.c
@@ -1592,6 +1592,10 @@ termp_bd_pre(DECL_ARGS)
 			/* FALLTHROUGH */
 		case (MDOC_Bl):
 			/* FALLTHROUGH */
+		case (MDOC_D1):
+			/* FALLTHROUGH */
+		case (MDOC_Dl):
+			/* FALLTHROUGH */
 		case (MDOC_Lp):
 			/* FALLTHROUGH */
 		case (MDOC_Pp):
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lmandoc.h -Lmandoc.h -u -p -r1.26 -r1.27
--- mandoc.h
+++ mandoc.h
@@ -69,6 +69,7 @@ enum	mandocerr {
 	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 */
@@ -106,8 +107,6 @@ enum	mandocerr {
 
 	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 */
Index: mdoc.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.7,v
retrieving revision 1.167
retrieving revision 1.168
diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.167 -r1.168
--- mdoc.7
+++ mdoc.7
@@ -2739,6 +2739,11 @@ The following problematic behaviour is f
 .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]
Index: main.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/main.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -Lmain.c -Lmain.c -u -p -r1.115 -r1.116
--- main.c
+++ main.c
@@ -146,6 +146,7 @@ static	const char * const	mandocerrs[MAN
 	"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",
@@ -183,7 +184,6 @@ static	const char * const	mandocerrs[MAN
 	"generic fatal error",
 
 	"column syntax is inconsistent",
-	"displays may not be nested",
 	"unsupported display type",
 	"blocks badly nested",
 	"no such block is open",
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-05 15:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-05 15:37 mdocml: Merge schwarze@'s changes allowing nested displays kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).