=================================================================== RCS file: /cvs/docbook2mdoc/docbook2mdoc.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -p -r1.59 -r1.60 --- docbook2mdoc/docbook2mdoc.c 2019/03/22 16:55:44 1.59 +++ docbook2mdoc/docbook2mdoc.c 2019/03/22 17:01:10 1.60 @@ -1,4 +1,4 @@ -/* $Id: docbook2mdoc.c,v 1.59 2019/03/22 16:55:44 schwarze Exp $ */ +/* $Id: docbook2mdoc.c,v 1.60 2019/03/22 17:01:10 schwarze Exp $ */ /* * Copyright (c) 2014 Kristaps Dzonsons * Copyright (c) 2019 Ingo Schwarze @@ -77,6 +77,7 @@ struct pnode { static const char *attrkeys[ATTRKEY__MAX] = { "choice", + "class", "close", "id", "linkend", @@ -85,6 +86,7 @@ static const char *attrkeys[ATTRKEY__MAX] = { }; static const char *attrvals[ATTRVAL__MAX] = { + "monospaced", "norepeat", "opt", "plain", @@ -491,6 +493,21 @@ pnode_unlinksub(struct pnode *pn) } /* + * Retrieve an enumeration attribute from a node. + * Return ATTRVAL__MAX if the node has no such attribute. + */ +enum attrval +pnode_getattr(struct pnode *pn, enum attrkey key) +{ + struct pattr *ap; + + TAILQ_FOREACH(ap, &pn->attrq, child) + if (ap->key == key) + return ap->val; + return(ATTRVAL__MAX); +} + +/* * Retrieve an attribute string from a node. * Return defval if the node has no such attribute. */ @@ -1369,6 +1386,10 @@ pnode_print(struct parse *p, struct pnode *pn) pnode_printmopen(p); fputs("Li", stdout); break; + case (NODE_LITERALLAYOUT): + assert(p->newln); + puts(".Bd -literal"); + break; case (NODE_MML_MFENCED): pnode_printmathfenced(p, pn); pnode_unlinksub(pn); @@ -1411,13 +1432,12 @@ pnode_print(struct parse *p, struct pnode *pn) pnode_printmopen(p); fputs("Qo", stdout); break; - case (NODE_LITERALLAYOUT): - /* FALLTHROUGH */ case (NODE_PROGRAMLISTING): - /* FALLTHROUGH */ case (NODE_SCREEN): assert(p->newln); - puts(".Bd -literal"); + printf(".Bd %s\n", ATTRVAL_MONOSPACED == + pnode_getattr(pn, ATTRKEY_CLASS) ? + "-literal" : "-unfilled"); break; case (NODE_REFENTRYINFO): /* Suppress. */