discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Jan Stary <hans@stare.cz>
Cc: discuss@mandoc.bsd.lv
Subject: Re: docbook2mdoc-1.0.0 released
Date: Sun, 21 Apr 2019 17:29:04 +0200	[thread overview]
Message-ID: <20190421152904.GC31325@athene.usta.de> (raw)
In-Reply-To: <20190420190331.GA36463@www.stare.cz>

Hi Jan,

Jan Stary wrote on Sat, Apr 20, 2019 at 09:03:31PM +0200:

> https://github.com/janstary/manpages/tree/master/wavpack
> 
> One thing I noticed with the mdoc output:
> 
>   .It Fl -clean, Fl -clear

You found a bug, and i fixed it with the commit below.

Thanks for reporting,
  Ingo


Log Message:
-----------
When <term> contains a macro-generating element,
the subsequent comma needs spacing.
Fixing a bug reported by Jan Stary <hans at stare dot cz>.

Modified Files:
--------------
    docbook2mdoc:
        docbook2mdoc.c

Revision Data
-------------
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.132 -r1.133
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -929,16 +929,17 @@ pnode_printrefentry(struct format *f, st
 static void
 pnode_printvarlistentry(struct format *f, struct pnode *n)
 {
-	struct pnode	*nc, *nn;
-	int		 first = 1;
+	struct pnode	*nc, *nn, *ncc;
+	int		 comma;
 
 	macro_open(f, "It");
 	f->parastate = PARA_HAVE;
 	f->flags |= FMT_IMPL;
+	comma = -1;
 	TAILQ_FOREACH_SAFE(nc, &n->childq, child, nn) {
 		if (nc->node != NODE_TERM && nc->node != NODE_GLOSSTERM)
 			continue;
-		if (first == 0) {
+		if (comma != -1) {
 			switch (f->linestate) {
 			case LINE_NEW:
 				break;
@@ -946,14 +947,15 @@ pnode_printvarlistentry(struct format *f
 				print_text(f, ",", 0);
 				break;
 			case LINE_MACRO:
-				macro_addarg(f, ",", 0);
+				macro_addarg(f, ",", comma);
 				break;
 			}
 		}
 		f->parastate = PARA_HAVE;
+		comma = (ncc = TAILQ_FIRST(&nc->childq)) == NULL ||
+		    pnode_class(ncc->node) == CLASS_TEXT ? 0 : ARG_SPACE;
 		pnode_print(f, nc);
 		pnode_unlink(nc);
-		first = 0;
 	}
 	macro_close(f);
 	f->parastate = PARA_HAVE;
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

      parent reply	other threads:[~2019-04-21 15:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 19:24 Ingo Schwarze
2019-04-20 19:03 ` Jan Stary
2019-04-20 22:56   ` Anthony J. Bentley
2019-04-21 12:32     ` hyphen-minus, was: " Ingo Schwarze
2019-04-21 16:32       ` Anthony J. Bentley
2019-04-21 11:26   ` Stephen Gregoratto
2019-04-25 17:02     ` Ingo Schwarze
2019-04-21 15:29   ` Ingo Schwarze [this message]

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=20190421152904.GC31325@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=discuss@mandoc.bsd.lv \
    --cc=hans@stare.cz \
    --subject='Re: docbook2mdoc-1.0.0 released' \
    /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

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).