source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: print tables containing two columns as .Bl -tag
@ 2019-04-03 12:30 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-03 12:30 UTC (permalink / raw)
  To: source

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

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

only message in thread, other threads:[~2019-04-03 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 12:30 docbook2mdoc: print tables containing two columns as .Bl -tag 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).