tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Fix for BLINE removal
@ 2011-11-16 14:12 Joerg Sonnenberger
  2011-11-16 17:24 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Joerg Sonnenberger @ 2011-11-16 14:12 UTC (permalink / raw)
  To: tech

[-- 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;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix for BLINE removal
  2011-11-16 14:12 Fix for BLINE removal Joerg Sonnenberger
@ 2011-11-16 17:24 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2011-11-16 17:24 UTC (permalink / raw)
  To: Joerg Sonnenberger; +Cc: tech

Hi Joerg,

Joerg Sonnenberger wrote on Wed, Nov 16, 2011 at 03:12:39PM +0100:

> 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?

I can confirm both the problem and the fix, i see no regressions,
and have just committed your patch to OpenBSD.  If you want to commit
to bsd.lv, that's OK schwarze@.

Thanks!
  Ingo


> 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;
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-16 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-16 14:12 Fix for BLINE removal Joerg Sonnenberger
2011-11-16 17:24 ` Ingo 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).