tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Ray Lai <ray@cyth.net>, jmc@openbsd.org, kristaps@bsd.lv
Cc: tech@mdocml.bsd.lv
Subject: Re: operator(7) differences (groff vs mandoc)
Date: Fri, 20 Aug 2010 01:02:20 +0200	[thread overview]
Message-ID: <20100819230220.GC29289@iris.usta.de> (raw)
In-Reply-To: <alpine.BSO.2.00.1008190046480.16837@a.cyth.net>

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

           reply	other threads:[~2010-08-20  5:49 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <alpine.BSO.2.00.1008190046480.16837@a.cyth.net>]

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=20100819230220.GC29289@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=jmc@openbsd.org \
    --cc=kristaps@bsd.lv \
    --cc=ray@cyth.net \
    --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).