tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Re: operator(7) differences (groff vs mandoc)
       [not found] <alpine.BSO.2.00.1008190046480.16837@a.cyth.net>
@ 2010-08-19 23:02 ` Ingo Schwarze
  0 siblings, 0 replies; only message in thread
From: Ingo Schwarze @ 2010-08-19 23:02 UTC (permalink / raw)
  To: Ray Lai, jmc, kristaps; +Cc: tech

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 @@
>  D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
>             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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-20  5:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <alpine.BSO.2.00.1008190046480.16837@a.cyth.net>
2010-08-19 23:02 ` operator(7) differences (groff vs mandoc) 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).