source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: Properly handle multiple <term> for a <varlistentry>.
@ 2014-10-12 15:48 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2014-10-12 15:48 UTC (permalink / raw)
  To: source

Log Message:
-----------
Properly handle multiple <term> for a <varlistentry>.

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

Revision Data
-------------
Index: docbook2mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.41 -r1.42
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -917,13 +917,13 @@ pnode_printmath(struct parse *p, struct 
 
 	switch (pn->node) {
 	case (NODE_MML_MSUP):
-		printf(" sup ");
+		fputs(" sup ", stdout);
 		break;
 	case (NODE_MML_MFRAC):
-		printf(" over ");
+		fputs(" over ", stdout);
 		break;
 	case (NODE_MML_MSUB):
-		printf(" sub ");
+		fputs(" sub ", stdout);
 		break;
 	default:
 		break;
@@ -1068,24 +1068,31 @@ pnode_printprologue(struct parse *p, str
 	}
 }
 
+/*
+ * We can have multiple <term> elements within a <varlistentry>, which
+ * we should comma-separate as list headers.
+ */
 static void
 pnode_printvarlistentry(struct parse *p, struct pnode *pn)
 {
 	struct pnode	*pp;
+	int		 first = 1;
 
 	assert(p->newln);
+	fputs(".It", stdout);
+	p->newln = 0;
+
 	TAILQ_FOREACH(pp, &pn->childq, child)
 		if (NODE_TERM == pp->node) {
-			assert(p->newln);
-			fputs(".It", stdout);
-			p->newln = 0;
+			if ( ! first)
+				putchar(',');
 			pnode_print(p, pp);
 			pnode_unlink(pp);
-			pnode_printmclose(p, 1);
-			return;
-		} 
+			first = 0;
+		} else
+			break;
 
-	puts(".It");
+	putchar('\n');
 	p->newln = 1;
 }
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

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

only message in thread, other threads:[~2014-10-12 15:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-12 15:48 docbook2mdoc: Properly handle multiple <term> for a <varlistentry> kristaps

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