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 20c555e7 for ; Fri, 22 Mar 2019 12:01:40 -0500 (EST) Date: Fri, 22 Mar 2019 12:01:40 -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: handle class="monospaced" in NODE_LITERALLAYOUT X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- handle class="monospaced" in NODE_LITERALLAYOUT Modified Files: -------------- docbook2mdoc: docbook2mdoc.c extern.h Revision Data ------------- Index: extern.h =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/extern.h,v retrieving revision 1.30 retrieving revision 1.31 diff -Lextern.h -Lextern.h -u -p -r1.30 -r1.31 --- extern.h +++ extern.h @@ -152,6 +152,7 @@ enum nodeid { enum attrkey { /* Alpha-order... */ ATTRKEY_CHOICE = 0, + ATTRKEY_CLASS, ATTRKEY_CLOSE, ATTRKEY_ID, ATTRKEY_LINKEND, @@ -166,6 +167,7 @@ enum attrkey { */ enum attrval { /* Alpha-order... */ + ATTRVAL_MONOSPACED, ATTRVAL_NOREPEAT, ATTRVAL_OPT, ATTRVAL_PLAIN, Index: docbook2mdoc.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v retrieving revision 1.59 retrieving revision 1.60 diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.59 -r1.60 --- docbook2mdoc.c +++ docbook2mdoc.c @@ -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 pnod 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 pnod 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. */ -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv