source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: If a .Bd block has no arguments at all, drop the block and only
Date: Fri, 30 Oct 2015 14:04:47 -0500 (EST)	[thread overview]
Message-ID: <16189704011536921157.enqueue@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2015-10-30 19:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16189704011536921157.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).