tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: [PATCH] .Bk with invalid arguments
Date: Sun, 12 Dec 2010 01:07:25 +0100	[thread overview]
Message-ID: <20101212000725.GB19330@iris.usta.de> (raw)

Hi,

while looking at some regression tests and trying to get them committed,
i noticed that .Bk behaves differently when given invalid arguments.

 1. .Bk -words works the same with mandoc, old and new groff.
 2. .Bk without any arg should default to -words
     according to new groff.
 3. .Bk with invalid args (or -lines) should have no effect
     according to new groff.

The following mini-patch adjusts mandoc to do the same.
For now, -words is the only argument accepted by mandoc,
so to catch case 1, it's sufficient to check for any arguments
at all, and to catch 2, it's suffcient to check that the HEAD
has no children.

OK?


Index: mdoc_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
retrieving revision 1.115
diff -u -p -r1.115 mdoc_term.c
--- mdoc_term.c	6 Dec 2010 22:10:13 -0000	1.115
+++ mdoc_term.c	11 Dec 2010 23:58:41 -0000
@@ -2124,7 +2124,8 @@ termp_bk_pre(DECL_ARGS)
 	case (MDOC_HEAD):
 		return(0);
 	case (MDOC_BODY):
-		p->flags |= TERMP_PREKEEP;
+		if (n->parent->args || 0 == n->prev->nchild)
+			p->flags |= TERMP_PREKEEP;
 		break;
 	default:
 		abort();
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2010-12-12  0:07 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=20101212000725.GB19330@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=tech@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).