tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: tech@mdocml.bsd.lv
Subject: Fix for BLINE removal
Date: Wed, 16 Nov 2011 15:12:39 +0100	[thread overview]
Message-ID: <20111116141239.GA15654@britannica.bec.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 192 bytes --]

Hi all,
the attached patch fixes the BLINE removal logic in man(7) for cases
like

	.TP 8
	.SH foo

This is one of the most popular issues with man pages in pkgsrc right
now. Comments?

Joerg

[-- Attachment #2: man.c.diff --]
[-- Type: text/x-diff, Size: 748 bytes --]

Index: man.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man.c,v
retrieving revision 1.113
diff -u -p -r1.113 man.c
--- man.c	7 Nov 2011 01:24:40 -0000	1.113
+++ man.c	16 Nov 2011 14:11:00 -0000
@@ -556,10 +556,15 @@ man_pmacro(struct man *m, int ln, char *
 	if ((m->flags & MAN_BLINE) &&
 	    (MAN_BSCOPE & man_macros[tok].flags)) {
 		n = m->last;
-		assert(MAN_TEXT != n->type);
 
-		/* Remove element that didn't end BLINE, if any. */
+		/* Might be a text node like 8 in
+		 * .TP 8
+		 * .SH foo
+		 */
+		if (MAN_TEXT == n->type)
+			n = n->parent;
 
+		/* Remove element that didn't end BLINE, if any. */
 		if ( ! (MAN_BSCOPE & man_macros[n->tok].flags))
 			n = n->parent;
 

             reply	other threads:[~2011-11-16 14:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16 14:12 Joerg Sonnenberger [this message]
2011-11-16 17:24 ` Ingo Schwarze

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=20111116141239.GA15654@britannica.bec.de \
    --to=joerg@britannica.bec.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).