source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: When <term> contains a macro-generating element, the
@ 2019-04-21 15:24 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-21 15:24 UTC (permalink / raw)
  To: source

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

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

only message in thread, other threads:[~2019-04-21 15:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-21 15:24 docbook2mdoc: When <term> contains a macro-generating element, the 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).