[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mandoc-tech
Subject:    Re: operator(7) differences (groff vs mandoc)
From:       Ingo Schwarze <schwarze () usta ! de>
Date:       2010-08-19 23:02:20
Message-ID: 20100819230220.GC29289 () iris ! usta ! de
[Download RAW message or body]

Hi,

Ray Lai wrote on Thu, Aug 19, 2010 at 12:49:57AM -0700:

> There should be a space between the "->" and the ".".
> 
> --- -	Thu Aug 19 00:45:49 2010
> +++ /usr/share/man/cat7/operator.0	Wed Aug 11 08:56:18 2010
> @@ -6,7 +6,7 @@
>  DDEESSCCRRIIPPTTIIOONN
>             Operator                             Associativity
>             --------                             -------------
> -           () [] -> .                           left to right
> +           () [] ->.                            left to right
>             ! ~ ++ -- - (type) * & sizeof        right to left
>             * / %                                left to right
>             + -                                  left to right

Ray, thank you for reporting this, it is indeed a bug in mandoc
that i was not aware of.

The point is that .Bl -column phrases must be rendered using
TERMP_IGNDELIM, a requirement that we missed so far.

The following patch closes the most glaring issue
and fixes operator(7); OK to commit it for now?

Beyond that, i'm adding two entries to our TODO list:

 - inside `.Bl -column' phrases, punctuation is handled like normal
   text, e.g. `.Bl -column .It Fl x . Ta ...' gives "-x -."
 
 - inside `.Bl -column' phrases, TERMP_IGNDELIM handling by `Pf'
   is not safe, e.g. `.Bl -column .It Pf a b .' gives "ab."
   but should give "ab .": TERMP_IGNDELIM is reset early.

Anybody noticed yet that .Bl -column is a slightly nasty?  ;)

Yours,
  Ingo


Index: mdoc_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
retrieving revision 1.101
diff -u -p -r1.101 mdoc_term.c
--- mdoc_term.c	18 Aug 2010 01:45:22 -0000	1.101
+++ mdoc_term.c	19 Aug 2010 22:38:26 -0000
@@ -838,6 +838,8 @@ termp_it_pre(DECL_ARGS)
 		if (MDOC_BODY == n->prev->type) 
 			p->flags |= TERMP_NOLPAD;
 
+		p->flags |= TERMP_IGNDELIM;
+
 		break;
 	case (LIST_diag):
 		if (MDOC_HEAD == n->type)
@@ -996,6 +998,13 @@ termp_it_post(DECL_ARGS)
 	p->flags &= ~TERMP_TWOSPACE;
 	p->flags &= ~TERMP_NOLPAD;
 	p->flags &= ~TERMP_HANG;
+
+	/*
+	 * TERMP_IGNDELIM is also set by `Pf', but it is safe
+	 * to clear it here because `Pf' cannot contain `It'.
+	 */
+
+	p->flags &= ~TERMP_IGNDELIM;
 }
 
 
@@ -1800,6 +1809,10 @@ static void
 termp_pf_post(DECL_ARGS)
 {
 
+	/*
+	 * XXX Resetting TERMP_IGNDELIM here is not safe
+	 * because `Pf' can be used inside `Bl -column'.
+	 */
 	p->flags &= ~TERMP_IGNDELIM;
 	p->flags |= TERMP_NOSPACE;
 }
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic