source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: If a .Bd block has no arguments at all, drop the block and only
@ 2015-10-30 19:04 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-10-30 19:04 UTC (permalink / raw)
  To: source

Log Message:
-----------
If a .Bd block has no arguments at all, drop the block and only keep
its contents.  Removing a gratuitious difference to groff output
found after a related bug report from krw@.

Modified Files:
--------------
    mdocml:
        mandoc.1
        mandoc.h
        mdoc.c
        mdoc_validate.c
        read.c

Revision Data
-------------
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.162
retrieving revision 1.163
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.162 -r1.163
--- mandoc.1
+++ mandoc.1
@@ -1600,6 +1600,13 @@ By requesting the inclusion of a sensiti
 might otherwise trick a privileged user into inadvertently displaying
 the file on the screen, revealing the file content to bystanders.
 The argument is ignored including the file name following it.
+.It Sy "skipping display without arguments"
+.Pq mdoc
+A
+.Ic \&Bd
+block macro does not have any arguments.
+The block is discarded, and the block content is displayed in
+whatever mode was active before the block.
 .It Sy "missing list type, using -item"
 .Pq mdoc
 A
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v
retrieving revision 1.206
retrieving revision 1.207
diff -Lmandoc.h -Lmandoc.h -u -p -r1.206 -r1.207
--- mandoc.h
+++ mandoc.h
@@ -172,6 +172,7 @@ enum	mandocerr {
 	/* related to request and macro arguments */
 	MANDOCERR_NAMESC, /* escaped character not allowed in a name: name */
 	MANDOCERR_BD_FILE, /* NOT IMPLEMENTED: Bd -file */
+	MANDOCERR_BD_NOARG, /* skipping display without arguments: Bd */
 	MANDOCERR_BL_NOTYPE, /* missing list type, using -item: Bl */
 	MANDOCERR_NM_NONAME, /* missing manual name, using "": Nm */
 	MANDOCERR_OS_UNAME, /* uname(3) system call failed, using UNKNOWN */
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.299
retrieving revision 1.300
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.299 -r1.300
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -895,6 +895,16 @@ post_display(POST_ARGS)
 		break;
 	case ROFFT_BLOCK:
 		if (n->tok == MDOC_Bd) {
+			if (n->args == NULL) {
+				mandoc_msg(MANDOCERR_BD_NOARG,
+				    mdoc->parse, n->line, n->pos, "Bd");
+				mdoc->next = ROFF_NEXT_SIBLING;
+				while (n->body->child != NULL)
+					mdoc_node_relink(mdoc,
+					    n->body->child);
+				roff_node_delete(mdoc, n);
+				break;
+			}
 			post_bd(mdoc);
 			post_prevpar(mdoc);
 		}
Index: mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc.c,v
retrieving revision 1.255
retrieving revision 1.256
diff -Lmdoc.c -Lmdoc.c -u -p -r1.255 -r1.256
--- mdoc.c
+++ mdoc.c
@@ -205,6 +205,7 @@ mdoc_node_relink(struct roff_man *mdoc, 
 {
 
 	roff_node_unlink(mdoc, p);
+	p->prev = p->next = NULL;
 	roff_node_append(mdoc, p);
 }
 
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -Lread.c -Lread.c -u -p -r1.144 -r1.145
--- read.c
+++ read.c
@@ -215,6 +215,7 @@ static	const char * const	mandocerrs[MAN
 	/* related to request and macro arguments */
 	"escaped character not allowed in a name",
 	"NOT IMPLEMENTED: Bd -file",
+	"skipping display without arguments",
 	"missing list type, using -item",
 	"missing manual name, using \"\"",
 	"uname(3) system call failed, using UNKNOWN",
--
 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:[~2015-10-30 19:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-30 19:04 mdocml: If a .Bd block has no arguments at all, drop the block and only schwarze

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).