tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: Re: mdocml version 1.10.6 available
Date: Tue, 28 Sep 2010 00:26:01 +0200	[thread overview]
Message-ID: <20100927222600.GA5616@iris.usta.de> (raw)
In-Reply-To: <4CA0912F.5040103@bsd.lv>

Hi Kristaps,

Kristaps Dzonsons wrote on Mon, Sep 27, 2010 at 02:42:23PM +0200:

> I'm pleased to announce mdocml 1.10.6, now at http://mdocml.bsd.lv/.
> This is mainly for the new mandoc calling conventions and improved
> pod2man preamble support.

... and you snoke in a few nice last-minute bug fixes,
shortening the TODO list.  :-)

This is now merged to OpenBSD as well.
While merging, i fixed a minor regression:
Two successive blank lines must both be printed,
even (horrors!) ouside literal mode.
Both old and new groff agree on that.

I fixed that by interpreting blank lines as .sp (instead of .Pp)
in mdoc.c, function mdoc_ptext(), and dropping .Pp before .sp
in exactly the same way as .Pp before .Pp.

For reference, here are the rules for handling explicit line breaks:

 .br  breaks the line, unless we are at the beginning of a line
 .Pp  adds a blank line, but collapses with a following -
      but not with a preceding! - blank line
 .sp  adds a blank line and doesn't collapse

A blank line is always the same as .sp.

Consequently, using the notation

 0 = break the line, no blank line
 1 = one blank line
 2 = two blank lines

we get the following combinations:

 single br = 0
 single Pp = 1
 single sp = 1

 double br = 0
 br Pp = Pp = 1
 Pp br = Pp = 1
 br sp = sp = 1
 sp br = sp = 1

 double Pp = Pp (collapse) = 1
 Pp sp = sp (collapse) = 1
 sp Pp = 2
 double sp = 2

Crazy as it is, this is now indeed implemented correctly in mandoc.


So, here is the diff from OpenBSD that i would like to merge to bsd.lv:

 * mdoc.c, first chunk:
   blank line = .sp, see above
 * mdoc.c, second chunk:
   Revert unneeded and wrong part of the .br\} fix.
   The parsing is completed in roff.c, the .br\} never propagates
   to the macro libraries, and when a backslash follows a real
   macro, that macro must *not* be recognized.
   This was never merged to OpenBSD; sorry for forgetting
   to report earlier...
 * mdoc_term.c:
   Two prototypes are better than one?
 * mdoc_validate.c:
   Drop .Pp before .sp; see above.
 * term_ps.c:
   fix off by one found by jsg@ with parfait,
   see OpenBSD term_ps.d rev. 1.12

OK?

Yours,
  Ingo


Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.164
diff -u -p -r1.164 mdoc.c
--- mdoc.c	29 Aug 2010 11:29:51 -0000	1.164
+++ mdoc.c	27 Sep 2010 21:37:24 -0000
@@ -691,11 +691,11 @@ mdoc_ptext(struct mdoc *m, int line, cha
 			return(0);
 
 		/*
-		 * Insert a `Pp' in the case of a blank line.  Technically,
+		 * Insert a `sp' in the case of a blank line.  Technically,
 		 * blank lines aren't allowed, but enough manuals assume this
 		 * behaviour that we want to work around it.
 		 */
-		if ( ! mdoc_elem_alloc(m, line, offs, MDOC_Pp, NULL))
+		if ( ! mdoc_elem_alloc(m, line, offs, MDOC_sp, NULL))
 			return(0);
 
 		m->next = MDOC_NEXT_SIBLING;
@@ -758,14 +758,11 @@ mdoc_pmacro(struct mdoc *m, int ln, char
 
 	/* 
 	 * Copy the first word into a nil-terminated buffer.
-	 * Stop copying when a tab, space, backslash, or eoln is encountered.
+	 * Stop copying when a tab, space, or eoln is encountered.
 	 */
 
 	j = 0;
-	while (j < 4 && '\0' != buf[i] && 
-			' ' != buf[i] && 
-			'\t' != buf[i] && 
-			'\\' != buf[i])
+	while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i])
 		mac[j++] = buf[i++];
 	mac[j] = '\0';
 
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.190
diff -u -p -r1.190 mdoc_term.c
--- mdoc_term.c	27 Sep 2010 11:21:39 -0000	1.190
+++ mdoc_term.c	27 Sep 2010 21:37:27 -0000
@@ -81,7 +81,6 @@ static	void	  termp_lb_post(DECL_ARGS);
 static	void	  termp_nm_post(DECL_ARGS);
 static	void	  termp_pf_post(DECL_ARGS);
 static	void	  termp_quote_post(DECL_ARGS);
-static	void	  termp_quote_post(DECL_ARGS);
 static	void	  termp_sh_post(DECL_ARGS);
 static	void	  termp_ss_post(DECL_ARGS);
 
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.118
diff -u -p -r1.118 mdoc_validate.c
--- mdoc_validate.c	27 Sep 2010 11:25:03 -0000	1.118
+++ mdoc_validate.c	27 Sep 2010 21:37:30 -0000
@@ -265,7 +265,7 @@ const	struct valids mdoc_valids[MDOC_MAX
 	{ NULL, NULL },				/* Dx */
 	{ NULL, posts_text },			/* %Q */
 	{ NULL, posts_notext },			/* br */
-	{ NULL, posts_sp },			/* sp */
+	{ pres_pp, posts_sp },			/* sp */
 	{ NULL, posts_text1 },			/* %U */
 	{ NULL, NULL },				/* Ta */
 };
Index: term_ps.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ps.c,v
retrieving revision 1.44
diff -u -p -r1.44 term_ps.c
--- term_ps.c	4 Sep 2010 20:18:53 -0000	1.44
+++ term_ps.c	27 Sep 2010 21:37:30 -0000
@@ -908,7 +908,7 @@ ps_pletter(struct termp *p, int c)
 
 	f = (int)p->engine.ps.lastf;
 
-	if (c <= 32 || (c - 32 > MAXCHAR)) {
+	if (c <= 32 || (c - 32 >= MAXCHAR)) {
 		ps_putchar(p, ' ');
 		p->engine.ps.pscol += (size_t)fonts[f].gly[0].wx;
 		return;


--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

       reply	other threads:[~2010-09-27 22:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4CA0912F.5040103@bsd.lv>
2010-09-27 22:26 ` Ingo Schwarze [this message]
2010-09-27 22:44   ` Kristaps Dzonsons
2010-09-27 23:29     ` 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=20100927222600.GA5616@iris.usta.de \
    --to=schwarze@usta.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).