source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: docbook2mdoc: Properly handle multiple <term> for a <varlistentry>.
Date: Sun, 12 Oct 2014 11:48:42 -0400 (EDT)	[thread overview]
Message-ID: <201410121548.s9CFmgpU022924@krisdoz.my.domain> (raw)

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

                 reply	other threads:[~2014-10-12 15:48 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=201410121548.s9CFmgpU022924@krisdoz.my.domain \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@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).