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 c8b63654 for ; Sun, 14 Apr 2019 13:08:05 -0500 (EST) Date: Sun, 14 Apr 2019 13:08:05 -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: Minor improvements to the handling of some X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- Minor improvements to the handling of some meta-information: * Translate and to .Ss or lower. * Do not uppercase high-level and similar elements. * Handle like stand-alone . * Handle <editor> by the <author> handler function. * Make <copyright> print "Copyright (C)". * Ignore some transparent nodes. Modified Files: -------------- docbook2mdoc: docbook2mdoc.c node.c node.h parse.c statistics.c Revision Data ------------- Index: node.h =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v retrieving revision 1.24 retrieving revision 1.25 diff -Lnode.h -Lnode.h -u -p -r1.24 -r1.25 --- node.h +++ node.h @@ -39,7 +39,6 @@ enum nodeclass { * More DocBook XML elements are recognized, but remapped or discarded. */ enum nodeid { - NODE_AFFILIATION, NODE_APPENDIX, NODE_ARG, NODE_AUTHOR, @@ -75,7 +74,6 @@ enum nodeid { NODE_FUNCTION, NODE_GLOSSTERM, NODE_GROUP, - NODE_HOLDER, NODE_INCLUDE, NODE_INDEX, NODE_INFO, @@ -104,7 +102,6 @@ enum nodeid { NODE_NOTE, NODE_OPTION, NODE_ORDEREDLIST, - NODE_ORGNAME, NODE_PARA, NODE_PARAMDEF, NODE_PARAMETER, @@ -126,13 +123,13 @@ enum nodeid { NODE_REFNAMEDIV, NODE_REFPURPOSE, NODE_REFSYNOPSISDIV, - NODE_RELEASEINFO, NODE_REPLACEABLE, NODE_ROW, NODE_SBR, NODE_SCREEN, NODE_SECTION, NODE_SIMPLELIST, + NODE_SIMPLESECT, NODE_SPANSPEC, NODE_SUBTITLE, NODE_SYNOPSIS, @@ -151,7 +148,6 @@ enum nodeid { NODE_VARNAME, NODE_WARNING, NODE_WORDASWORD, - NODE_YEAR, NODE_UNKNOWN, NODE_TEXT, NODE_ESCAPE, Index: docbook2mdoc.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v retrieving revision 1.120 retrieving revision 1.121 diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.120 -r1.121 --- docbook2mdoc.c +++ docbook2mdoc.c @@ -210,19 +210,22 @@ pnode_printsection(struct format *f, str level = ++f->level; flags = ARG_SPACE; - if (level == 1) - flags |= ARG_UPPER; - if (level < 3) { - switch (n->node) { - case NODE_CAUTION: - case NODE_NOTE: - case NODE_TIP: - case NODE_WARNING: + switch (n->node) { + case NODE_PREFACE: + case NODE_SECTION: + case NODE_APPENDIX: + if (level == 1) + flags |= ARG_UPPER; + break; + case NODE_SIMPLESECT: + case NODE_LEGALNOTICE: + if (level < 2) + level = 2; + break; + default: + if (level < 3) level = 3; - break; - default: - break; - } + break; } TAILQ_FOREACH(nc, &n->childq, child) @@ -1061,9 +1064,13 @@ pnode_print(struct format *f, struct pno case NODE_CONSTANT: macro_open(f, "Dv"); break; + case NODE_COPYRIGHT: + print_text(f, "Copyright", ARG_SPACE); + fputs(" \\(co", stdout); + break; case NODE_EDITOR: print_text(f, "editor:", ARG_SPACE); - macro_open(f, "An"); + pnode_printauthor(f, n); break; case NODE_EMAIL: if (was_impl) @@ -1196,6 +1203,7 @@ pnode_print(struct format *f, struct pno break; case NODE_PREFACE: case NODE_SECTION: + case NODE_SIMPLESECT: case NODE_APPENDIX: case NODE_LEGALNOTICE: case NODE_NOTE: @@ -1218,6 +1226,7 @@ pnode_print(struct format *f, struct pno pnode_printtgroup(f, n); break; case NODE_TITLE: + case NODE_SUBTITLE: pnode_printpara(f, n); macro_nodeline(f, "Sy", n, 0); pnode_unlinksub(n); Index: node.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/node.c,v retrieving revision 1.14 retrieving revision 1.15 diff -Lnode.c -Lnode.c -u -p -r1.14 -r1.15 --- node.c +++ node.c @@ -31,7 +31,6 @@ struct nodeprop { }; static const struct nodeprop properties[] = { - { "affiliation", CLASS_TRANS }, { "appendix", CLASS_BLOCK }, { "arg", CLASS_ENCL }, { "author", CLASS_LINE }, @@ -46,7 +45,7 @@ static const struct nodeprop properties[ { "command", CLASS_LINE }, { "constant", CLASS_LINE }, { "contrib", CLASS_TRANS }, - { "copyright", CLASS_TRANS }, + { "copyright", CLASS_LINE }, { "date", CLASS_TRANS }, { "!DOCTYPE", CLASS_VOID }, { "editor", CLASS_LINE }, @@ -67,7 +66,6 @@ static const struct nodeprop properties[ { "function", CLASS_LINE }, { "glossterm", CLASS_LINE }, { "group", CLASS_ENCL }, - { "holder", CLASS_TRANS }, { "xi:include", CLASS_VOID }, { "index", CLASS_TRANS }, { "info", CLASS_TRANS }, @@ -96,7 +94,6 @@ static const struct nodeprop properties[ { "note", CLASS_BLOCK }, { "option", CLASS_LINE }, { "orderedlist", CLASS_BLOCK }, - { "orgname", CLASS_TRANS }, { "para", CLASS_BLOCK }, { "paramdef", CLASS_LINE }, { "parameter", CLASS_LINE }, @@ -118,15 +115,15 @@ static const struct nodeprop properties[ { "refnamediv", CLASS_BLOCK }, { "refpurpose", CLASS_LINE }, { "refsynopsisdiv", CLASS_BLOCK }, - { "releaseinfo", CLASS_TRANS }, { "replaceable", CLASS_LINE }, { "row", CLASS_BLOCK }, { "sbr", CLASS_BLOCK }, { "screen", CLASS_BLOCK }, { "section", CLASS_BLOCK }, { "simplelist", CLASS_TRANS }, + { "simplesect", CLASS_BLOCK }, { "spanspec", CLASS_TRANS }, - { "subtitle", CLASS_TRANS }, + { "subtitle", CLASS_BLOCK }, { "synopsis", CLASS_BLOCK }, { "systemitem", CLASS_LINE }, { "table", CLASS_TRANS }, @@ -143,7 +140,6 @@ static const struct nodeprop properties[ { "varname", CLASS_LINE }, { "warning", CLASS_BLOCK }, { "wordasword", CLASS_TRANS }, - { "year", CLASS_TRANS }, { "[UNKNOWN]", CLASS_VOID }, { "(t)", CLASS_TEXT }, { "(e)", CLASS_TEXT } Index: parse.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v retrieving revision 1.42 retrieving revision 1.43 diff -Lparse.c -Lparse.c -u -p -r1.42 -r1.43 --- parse.c +++ parse.c @@ -70,6 +70,7 @@ struct alias { static const struct alias aliases[] = { { "acronym", NODE_IGNORE }, + { "affiliation", NODE_IGNORE }, { "anchor", NODE_DELETE }, { "application", NODE_COMMAND }, { "article", NODE_SECTION }, @@ -85,10 +86,12 @@ static const struct alias aliases[] = { { "glossdiv", NODE_IGNORE }, { "glossentry", NODE_VARLISTENTRY }, { "glosslist", NODE_VARIABLELIST }, + { "holder", NODE_IGNORE }, { "indexterm", NODE_DELETE }, { "informaltable", NODE_TABLE }, { "keycap", NODE_KEYSYM }, { "keycode", NODE_IGNORE }, + { "orgname", NODE_IGNORE }, { "othercredit", NODE_AUTHOR }, { "othername", NODE_PERSONNAME }, { "part", NODE_SECTION }, @@ -99,6 +102,7 @@ static const struct alias aliases[] = { { "refsect2", NODE_SECTION }, { "refsect3", NODE_SECTION }, { "refsection", NODE_SECTION }, + { "releaseinfo", NODE_IGNORE }, { "returnvalue", NODE_IGNORE }, { "secondary", NODE_DELETE }, { "sect1", NODE_SECTION }, @@ -112,6 +116,7 @@ static const struct alias aliases[] = { { "trademark", NODE_IGNORE }, { "ulink", NODE_LINK }, { "userinput", NODE_LITERAL }, + { "year", NODE_IGNORE }, { NULL, NODE_IGNORE } }; Index: statistics.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v retrieving revision 1.26 retrieving revision 1.27 diff -Lstatistics.c -Lstatistics.c -u -p -r1.26 -r1.27 --- statistics.c +++ statistics.c @@ -360,27 +360,44 @@ main(int argc, char *argv[]) /* Exclude relations that are already fully implemented. */ if (show_all == 0) { + table_add("ROOT", "article"); + table_add("ROOT", "book"); + table_add("ROOT", "chapter"); table_add("ROOT", "refentry"); table_add("acronym", "TEXT"); + table_add("affiliation", "orgdiv"); + table_add("affiliation", "orgname"); table_add("appendix", NULL); table_add("application", "TEXT"); table_add("arg", "option"); table_add("article", NULL); + table_add("articleinfo", "author"); + table_add("articleinfo", "authorgroup"); + table_add("articleinfo", "copyright"); table_add("articleinfo", "date"); + table_add("articleinfo", "legalnotice"); table_add("articleinfo", "pubdate"); + table_add("articleinfo", "releaseinfo"); + table_add("articleinfo", "subtitle"); table_add("articleinfo", "title"); + table_add("author", "affiliation"); table_add("author", "contrib"); table_add("author", "email"); table_add("author", "firstname"); table_add("author", "othername"); table_add("author", "surname"); + table_add("author", "TEXT"); table_add("authorgroup", "author"); + table_add("authorgroup", "editor"); table_add("authorgroup", "othercredit"); table_add("blockquote", NULL); table_add("book", NULL); table_add("bookinfo", "authorgroup"); + table_add("bookinfo", "copyright"); table_add("bookinfo", "legalnotice"); table_add("bookinfo", "pubdate"); + table_add("bookinfo", "releaseinfo"); + table_add("bookinfo", "subtitle"); table_add("bookinfo", "title"); table_add("chapter", NULL); table_add("citerefentry", "manvolnum"); @@ -393,7 +410,13 @@ main(int argc, char *argv[]) table_add("command", "TEXT"); table_add("computeroutput", "TEXT"); table_add("constant", "TEXT"); + table_add("contrib", "TEXT"); + table_add("copyright", "holder"); + table_add("copyright", "year"); table_add("date", "TEXT"); + table_add("editor", "affiliation"); + table_add("editor", "firstname"); + table_add("editor", "surname"); table_add("email", "TEXT"); table_add("emphasis", "TEXT"); table_add("entry", NULL); @@ -419,6 +442,7 @@ main(int argc, char *argv[]) table_add("glosslist", "glossentry"); table_add("glossterm", "TEXT"); table_add("group", "arg"); + table_add("holder", "TEXT"); table_add("indexterm", "primary"); table_add("indexterm", "secondary"); table_add("informaltable", "tgroup"); @@ -437,6 +461,9 @@ main(int argc, char *argv[]) table_add("note", NULL); table_add("option", "TEXT"); table_add("orderedlist", "listitem"); + table_add("orgdiv", "TEXT"); + table_add("orgname", "TEXT"); + table_add("othercredit", "affiliation"); table_add("othercredit", "contrib"); table_add("othercredit", "email"); table_add("othercredit", "firstname"); @@ -447,8 +474,11 @@ main(int argc, char *argv[]) table_add("paramdef", "parameter"); table_add("paramdef", "TEXT"); table_add("parameter", "TEXT"); + table_add("part", NULL); table_add("personname", "firstname"); table_add("personname", "surname"); + table_add("phrase", "TEXT"); + table_add("preface", NULL); table_add("primary", NULL); table_add("programlisting", NULL); table_add("property", "TEXT"); @@ -459,6 +489,8 @@ main(int argc, char *argv[]) table_add("refentry", "refnamediv"); table_add("refentry", "refsect1"); table_add("refentry", "refsynopsisdiv"); + table_add("refentryinfo", "author"); + table_add("refentryinfo", "copyright"); table_add("refentryinfo", "date"); table_add("refentrytitle", "TEXT"); table_add("refmeta", "manvolnum"); @@ -473,6 +505,7 @@ main(int argc, char *argv[]) table_add("refsect2", NULL); table_add("refsynopsisdiv", "cmdsynopsis"); table_add("refsynopsisdiv", "funcsynopsis"); + table_add("releaseinfo", "TEXT"); table_add("replaceable", "TEXT"); table_add("returnvalue", "TEXT"); table_add("row", "entry"); @@ -486,8 +519,10 @@ main(int argc, char *argv[]) table_add("sgmltag", "TEXT"); table_add("simpara", NULL); table_add("simplelist", "member"); + table_add("simplesect", NULL); table_add("structfield", "TEXT"); table_add("structname", "TEXT"); + table_add("subtitle", "TEXT"); table_add("surname", "TEXT"); table_add("symbol", "TEXT"); table_add("synopsis", "TEXT"); @@ -501,6 +536,7 @@ main(int argc, char *argv[]) table_add("tgroup", "thead"); table_add("thead", "row"); table_add("title", "TEXT"); + table_add("trademark", "TEXT"); table_add("type", "TEXT"); table_add("ulink", NULL); table_add("userinput", "TEXT"); @@ -508,6 +544,8 @@ main(int argc, char *argv[]) table_add("varlistentry", "listitem"); table_add("varlistentry", "term"); table_add("varname", "TEXT"); + table_add("warning", NULL); + table_add("year", "TEXT"); } table_add(NULL, NULL); -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv