=================================================================== RCS file: /cvs/docbook2mdoc/docbook2mdoc.c,v retrieving revision 1.30 retrieving revision 1.33 diff -u -p -r1.30 -r1.33 --- docbook2mdoc/docbook2mdoc.c 2014/04/02 12:12:41 1.30 +++ docbook2mdoc/docbook2mdoc.c 2014/04/30 09:26:10 1.33 @@ -1,4 +1,4 @@ -/* $Id: docbook2mdoc.c,v 1.30 2014/04/02 12:12:41 kristaps Exp $ */ +/* $Id: docbook2mdoc.c,v 1.33 2014/04/30 09:26:10 kristaps Exp $ */ /* * Copyright (c) 2014 Kristaps Dzonsons * @@ -96,6 +96,8 @@ static const struct node nodes[NODE__MAX] = { { "cmdsynopsis", NODE_IGNTEXT }, { "code", 0 }, { "command", 0 }, + { "constant", 0 }, + { "copyright", NODE_IGNTEXT }, { "date", 0 }, { "emphasis", 0 }, { "entry", 0 }, @@ -106,8 +108,10 @@ static const struct node nodes[NODE__MAX] = { { "funcsynopsis", NODE_IGNTEXT }, { "funcsynopsisinfo", 0 }, { "function", 0 }, - { "itemizedlist", NODE_IGNTEXT }, { "group", NODE_IGNTEXT }, + { "holder", NODE_IGNTEXT }, + { "info", NODE_IGNTEXT }, + { "itemizedlist", NODE_IGNTEXT }, { "link", 0 }, { "listitem", NODE_IGNTEXT }, { "literal", 0 }, @@ -152,6 +156,7 @@ static const struct node nodes[NODE__MAX] = { { "thead", NODE_IGNTEXT }, { "tip", NODE_IGNTEXT }, { "title", 0 }, + { "trademark", 0 }, { "ulink", 0 }, { "userinput", 0 }, { "variablelist", NODE_IGNTEXT }, @@ -159,6 +164,7 @@ static const struct node nodes[NODE__MAX] = { { "varname", 0 }, { "warning", NODE_IGNTEXT }, { "wordasword", 0 }, + { "year", NODE_IGNTEXT }, }; static void @@ -335,15 +341,17 @@ xml_elem_start(void *arg, const XML_Char *name, const if (0 == strcmp(*att, attrkeys[key])) break; if (ATTRKEY__MAX == key) { - fprintf(stderr, "%s:%zu:%zu: unknown " - "attribute \"%s\"\n", ps->fname, + fprintf(stderr, "%s:%zu:%zu: warning: " + "unknown attribute \"%s\"\n", + ps->fname, XML_GetCurrentLineNumber(ps->xml), XML_GetCurrentColumnNumber(ps->xml), *att); continue; } else if ( ! isattrkey(node, key)) { - fprintf(stderr, "%s:%zu:%zu: bad " - "attribute \"%s\"\n", ps->fname, + fprintf(stderr, "%s:%zu:%zu: warning: " + "bad attribute \"%s\"\n", + ps->fname, XML_GetCurrentLineNumber(ps->xml), XML_GetCurrentColumnNumber(ps->xml), *att); @@ -353,8 +361,9 @@ xml_elem_start(void *arg, const XML_Char *name, const if (0 == strcmp(*(att + 1), attrvals[val])) break; if (ATTRVAL__MAX != val && ! isattrval(key, val)) { - fprintf(stderr, "%s:%zu:%zu: bad " - "value \"%s\"\n", ps->fname, + fprintf(stderr, "%s:%zu:%zu: warning: " + "bad attribute value \"%s\"\n", + ps->fname, XML_GetCurrentLineNumber(ps->xml), XML_GetCurrentColumnNumber(ps->xml), *(att + 1)); @@ -518,6 +527,7 @@ pnode_findfirst(struct pnode *pn, enum nodeid node) #define MACROLINE_NORM 0 #define MACROLINE_UPPER 1 +#define MACROLINE_NOWS 2 /* * Recursively print text presumably on a macro line. * Convert all whitespace to regular spaces. @@ -527,7 +537,7 @@ pnode_printmacrolinetext(struct parse *p, struct pnode { char *cp; - if (0 == p->newln) + if (0 == p->newln && ! (MACROLINE_NOWS & fl)) putchar(' '); bufclear(p); @@ -781,7 +791,7 @@ pnode_printparamdef(struct parse *p, struct pnode *pn) fputs(".Fa \"", stdout); p->newln = 0; if (NULL != ptype) { - pnode_printmacrolinepart(p, ptype); + pnode_printmacrolinetext(p, ptype, MACROLINE_NOWS); putchar(' '); } @@ -935,6 +945,7 @@ pnode_printvarlistentry(struct parse *p, struct pnode assert(p->newln); TAILQ_FOREACH(pp, &pn->childq, child) if (NODE_TERM == pp->node) { + assert(p->newln); fputs(".It", stdout); p->newln = 0; pnode_print(p, pp); @@ -1088,6 +1099,10 @@ pnode_print(struct parse *p, struct pnode *pn) pnode_printmopen(p); fputs("Nm", stdout); break; + case (NODE_CONSTANT): + pnode_printmopen(p); + fputs("Dv", stdout); + break; case (NODE_EMPHASIS): pnode_printmopen(p); fputs("Em", stdout); @@ -1146,8 +1161,8 @@ pnode_print(struct parse *p, struct pnode *pn) /* Suppress non-text children... */ pnode_printmopen(p); fputs("Fa \"", stdout); - pnode_printmacrolinepart(p, pn); - puts("\""); + pnode_printmacrolinetext(p, pn, MACROLINE_NOWS); + fputs("\"", stdout); pnode_unlinksub(pn); break; case (NODE_QUOTE): @@ -1296,6 +1311,7 @@ pnode_print(struct parse *p, struct pnode *pn) case (NODE_ARG): case (NODE_CODE): case (NODE_COMMAND): + case (NODE_CONSTANT): case (NODE_EMPHASIS): case (NODE_ENVAR): case (NODE_FILENAME):