From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 392a7efe for ; Wed, 3 Apr 2019 07:30:18 -0500 (EST) Date: Wed, 3 Apr 2019 07:30:18 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: docbook2mdoc: print tables containing two columns as .Bl -tag X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: 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