source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: print tables containing two columns as .Bl -tag
Date: Wed, 3 Apr 2019 07:30:18 -0500 (EST)	[thread overview]
Message-ID: <e3fd3196a3b1acdb@fantadrom.bsd.lv> (raw)

Log Message:
-----------
print tables containing two columns as .Bl -tag

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

Revision Data
-------------
Index: statistics.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lstatistics.c -Lstatistics.c -u -p -r1.5 -r1.6
--- statistics.c
+++ statistics.c
@@ -348,7 +348,26 @@ main(int argc, char *argv[])
 
 	/* Exclude relations that are already fully implemented. */
 	if (show_all == 0) {
+		table_add("chapter", "title");
+		table_add("entry", NULL);
+		table_add("informaltable", "tgroup");
 		table_add("para", NULL);
+		table_add("refsect1", "title");
+		table_add("refsect2", "title");
+		table_add("row", "entry");
+		table_add("section", "title");
+		table_add("sect1", "title");
+		table_add("sect2", "title");
+		table_add("sect3", "title");
+		table_add("sect4", "title");
+		table_add("table", "tgroup");
+		table_add("table", "title");
+		table_add("tbody", "row");
+		table_add("tgroup", "colspec");
+		table_add("tgroup", "tbody");
+		table_add("tgroup", "thead");
+		table_add("thead", "row");
+		table_add("title", "TEXT");
 	}
 	table_add(NULL, NULL);
 
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.82 -r1.83
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -540,39 +540,63 @@ pnode_printrow(struct format *p, struct 
 }
 
 static void
-pnode_printtgroup1(struct format *p, struct pnode *n)
+pnode_printtgroup1(struct format *f, struct pnode *n)
 {
 	struct pnode	*nc;
 
-	macro_line(p, "Bl -bullet -compact");
+	macro_line(f, "Bl -bullet -compact");
 	while ((nc = pnode_findfirst(n, NODE_ENTRY)) != NULL) {
-		macro_line(p, "It");
-		pnode_print(p, nc);
+		macro_line(f, "It");
+		pnode_print(f, nc);
 		pnode_unlink(nc);
 	}
-	macro_line(p, "El");
+	macro_line(f, "El");
 	pnode_unlinksub(n);
 }
 
 static void
-pnode_printtgroup(struct format *p, struct pnode *n)
+pnode_printtgroup2(struct format *f, struct pnode *n)
+{
+	struct pnode	*nr, *ne;
+
+	macro_line(f, "Bl -tag -width Ds");
+	while ((nr = pnode_findfirst(n, NODE_ROW)) != NULL) {
+		if ((ne = pnode_findfirst(n, NODE_ENTRY)) == NULL)
+			break;
+		macro_open(f, "It");
+		pnode_print(f, ne);
+		if (f->linestate == LINE_MACRO)
+			macro_close(f);
+		pnode_unlink(ne);
+		pnode_print(f, nr);
+		pnode_unlink(nr);
+	}
+	macro_line(f, "El");
+	pnode_unlinksub(n);
+}
+
+static void
+pnode_printtgroup(struct format *f, struct pnode *n)
 {
 	struct pnode	*nc;
 
 	switch (atoi(pnode_getattr_raw(n, ATTRKEY_COLS, "0"))) {
 	case 1:
-		pnode_printtgroup1(p, n);
+		pnode_printtgroup1(f, n);
+		return;
+	case 2:
+		pnode_printtgroup2(f, n);
 		return;
 	default:
 		break;
 	}
 
-	macro_line(p, "Bl -ohang");
+	macro_line(f, "Bl -ohang");
 	while ((nc = pnode_findfirst(n, NODE_ROW)) != NULL) {
-		macro_line(p, "It Table Row");
-		pnode_printrow(p, nc);
+		macro_line(f, "It Table Row");
+		pnode_printrow(f, nc);
 	}
-	macro_line(p, "El");
+	macro_line(f, "El");
 	pnode_unlinksub(n);
 }
 
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2019-04-03 12:30 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=e3fd3196a3b1acdb@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).