source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: When <term> contains a macro-generating element, the
Date: Sun, 21 Apr 2019 10:24:35 -0500 (EST)	[thread overview]
Message-ID: <e3fe43faa050f48d@fantadrom.bsd.lv> (raw)

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 source+unsubscribe@mandoc.bsd.lv

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

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=e3fe43faa050f48d@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.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).