* docbook2mdoc: Infrastructure to access node properties that can be used
@ 2019-04-12 16:41 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-12 16:41 UTC (permalink / raw)
To: source
Log Message:
-----------
Infrastructure to access node properties
that can be used by both the parser and the formatter.
Use it to decide whether a text node needs .Pf before a macro,
whether the first word of a text node needs to be split off after
a macro, and whether a macro node can suppress the SPACE flag.
Modified Files:
--------------
docbook2mdoc:
README
docbook2mdoc.c
node.c
node.h
parse.c
Revision Data
-------------
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.112 -r1.113
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -70,12 +70,18 @@ pnode_printtext(struct format *f, struct
*/
if (f->linestate != LINE_MACRO &&
- (nn = TAILQ_NEXT(n, child)) != NULL && nn->spc == 0 &&
- (nn->node != NODE_TEXT && nn->node != NODE_ESCAPE)) {
- macro_open(f, "Pf");
- accept_arg = 1;
- f->flags |= FMT_CHILD;
- nn->spc = 1;
+ (nn = TAILQ_NEXT(n, child)) != NULL && nn->spc == 0) {
+ switch (pnode_class(nn->node)) {
+ case CLASS_LINE:
+ case CLASS_ENCL:
+ macro_open(f, "Pf");
+ accept_arg = 1;
+ f->flags |= FMT_CHILD;
+ nn->spc = 1;
+ break;
+ default:
+ break;
+ }
}
switch (f->linestate) {
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lparse.c -Lparse.c -u -p -r1.38 -r1.39
--- parse.c
+++ parse.c
@@ -63,160 +63,48 @@ struct parse {
#define PFLAG_EEND (1 << 3) /* This element is self-closing. */
};
-struct element {
+struct alias {
const char *name; /* DocBook element name. */
enum nodeid node; /* Node type to generate. */
};
-static const struct element elements[] = {
+static const struct alias aliases[] = {
{ "acronym", NODE_IGNORE },
- { "affiliation", NODE_AFFILIATION },
{ "anchor", NODE_DELETE },
- { "appendix", NODE_APPENDIX },
- { "application", NODE_APPLICATION },
- { "arg", NODE_ARG },
{ "article", NODE_SECTION },
- { "author", NODE_AUTHOR },
- { "authorgroup", NODE_AUTHORGROUP },
- { "blockquote", NODE_BLOCKQUOTE },
{ "book", NODE_SECTION },
- { "bookinfo", NODE_BOOKINFO },
- { "caution", NODE_CAUTION },
{ "chapter", NODE_SECTION },
- { "citerefentry", NODE_CITEREFENTRY },
- { "citetitle", NODE_CITETITLE },
- { "cmdsynopsis", NODE_CMDSYNOPSIS },
{ "code", NODE_LITERAL },
- { "colspec", NODE_COLSPEC },
- { "command", NODE_COMMAND },
{ "computeroutput", NODE_LITERAL },
- { "constant", NODE_CONSTANT },
- { "contrib", NODE_CONTRIB },
- { "copyright", NODE_COPYRIGHT },
- { "date", NODE_DATE },
{ "!doctype", NODE_DOCTYPE },
- { "!DOCTYPE", NODE_DOCTYPE },
- { "editor", NODE_EDITOR },
- { "email", NODE_EMAIL },
- { "emphasis", NODE_EMPHASIS },
- { "!ENTITY", NODE_ENTITY },
- { "entry", NODE_ENTRY },
- { "envar", NODE_ENVAR },
- { "errorname", NODE_ERRORNAME },
- { "fieldsynopsis", NODE_FIELDSYNOPSIS },
- { "filename", NODE_FILENAME },
{ "firstname", NODE_PERSONNAME },
- { "firstterm", NODE_FIRSTTERM },
- { "footnote", NODE_FOOTNOTE },
- { "funcdef", NODE_FUNCDEF },
- { "funcprototype", NODE_FUNCPROTOTYPE },
- { "funcsynopsis", NODE_FUNCSYNOPSIS },
- { "funcsynopsisinfo", NODE_FUNCSYNOPSISINFO },
- { "function", NODE_FUNCTION },
{ "glossary", NODE_VARIABLELIST },
{ "glossdef", NODE_IGNORE },
{ "glossdiv", NODE_IGNORE },
{ "glossentry", NODE_VARLISTENTRY },
{ "glosslist", NODE_VARIABLELIST },
- { "glossterm", NODE_GLOSSTERM },
- { "group", NODE_GROUP },
- { "holder", NODE_HOLDER },
- { "index", NODE_INDEX },
{ "indexterm", NODE_DELETE },
- { "info", NODE_INFO },
- { "informalequation", NODE_INFORMALEQUATION },
{ "informaltable", NODE_TABLE },
- { "inlineequation", NODE_INLINEEQUATION },
- { "itemizedlist", NODE_ITEMIZEDLIST },
- { "keysym", NODE_KEYSYM },
- { "legalnotice", NODE_LEGALNOTICE },
- { "link", NODE_LINK },
- { "listitem", NODE_LISTITEM },
- { "literal", NODE_LITERAL },
- { "literallayout", NODE_LITERALLAYOUT },
- { "manvolnum", NODE_MANVOLNUM },
- { "markup", NODE_MARKUP },
- { "member", NODE_MEMBER },
- { "mml:math", NODE_MML_MATH },
- { "mml:mfenced", NODE_MML_MFENCED },
- { "mml:mfrac", NODE_MML_MFRAC },
- { "mml:mi", NODE_MML_MI },
- { "mml:mn", NODE_MML_MN },
- { "mml:mo", NODE_MML_MO },
- { "mml:mrow", NODE_MML_MROW },
- { "mml:msub", NODE_MML_MSUB },
- { "mml:msup", NODE_MML_MSUP },
- { "modifier", NODE_MODIFIER },
- { "note", NODE_NOTE },
- { "option", NODE_OPTION },
- { "orderedlist", NODE_ORDEREDLIST },
- { "orgname", NODE_ORGNAME },
{ "othername", NODE_PERSONNAME },
- { "para", NODE_PARA },
- { "paramdef", NODE_PARAMDEF },
- { "parameter", NODE_PARAMETER },
{ "part", NODE_SECTION },
- { "personname", NODE_PERSONNAME },
{ "phrase", NODE_IGNORE },
- { "preface", NODE_PREFACE },
{ "primary", NODE_DELETE },
- { "programlisting", NODE_PROGRAMLISTING },
- { "prompt", NODE_PROMPT },
- { "quote", NODE_QUOTE },
- { "refclass", NODE_REFCLASS },
- { "refdescriptor", NODE_REFDESCRIPTOR },
- { "refentry", NODE_REFENTRY },
- { "refentryinfo", NODE_REFENTRYINFO },
- { "refentrytitle", NODE_REFENTRYTITLE },
- { "refmeta", NODE_REFMETA },
- { "refmetainfo", NODE_REFMETAINFO },
- { "refmiscinfo", NODE_REFMISCINFO },
- { "refname", NODE_REFNAME },
- { "refnamediv", NODE_REFNAMEDIV },
- { "refpurpose", NODE_REFPURPOSE },
{ "refsect1", NODE_SECTION },
{ "refsect2", NODE_SECTION },
{ "refsect3", NODE_SECTION },
{ "refsection", NODE_SECTION },
- { "refsynopsisdiv", NODE_REFSYNOPSISDIV },
- { "releaseinfo", NODE_RELEASEINFO },
- { "replaceable", NODE_REPLACEABLE },
- { "row", NODE_ROW },
- { "sbr", NODE_SBR },
- { "screen", NODE_SCREEN },
{ "secondary", NODE_DELETE },
{ "sect1", NODE_SECTION },
{ "sect2", NODE_SECTION },
- { "section", NODE_SECTION },
{ "sgmltag", NODE_MARKUP },
{ "simpara", NODE_PARA },
- { "simplelist", NODE_SIMPLELIST },
- { "spanspec", NODE_SPANSPEC },
{ "structfield", NODE_PARAMETER },
{ "structname", NODE_TYPE },
- { "subtitle", NODE_SUBTITLE },
{ "surname", NODE_PERSONNAME },
{ "symbol", NODE_CONSTANT },
- { "synopsis", NODE_SYNOPSIS },
- { "table", NODE_TABLE },
- { "tbody", NODE_TBODY },
- { "term", NODE_TERM },
- { "tfoot", NODE_TFOOT },
- { "tgroup", NODE_TGROUP },
- { "thead", NODE_THEAD },
- { "tip", NODE_TIP },
- { "title", NODE_TITLE },
{ "trademark", NODE_IGNORE },
- { "type", NODE_TYPE },
{ "ulink", NODE_LINK },
{ "userinput", NODE_LITERAL },
- { "variablelist", NODE_VARIABLELIST },
- { "varlistentry", NODE_VARLISTENTRY },
- { "varname", NODE_VARNAME },
- { "warning", NODE_WARNING },
- { "wordasword", NODE_WORDASWORD },
- { "xi:include", NODE_INCLUDE },
- { "year", NODE_YEAR },
{ NULL, NODE_IGNORE }
};
@@ -369,14 +257,29 @@ xml_text(struct parse *p, const char *wo
p->flags &= ~PFLAG_SPC;
/*
- * If this node follows a non-text node without intervening
+ * If this node follows an in-line macro without intervening
* whitespace, keep the text in it as short as possible,
* and do not keep it open.
*/
- if (n->spc == 0 &&
- (np = TAILQ_PREV(n, pnodeq, child)) != NULL &&
- np->node != NODE_TEXT && np->node != NODE_ESCAPE) {
+ np = n->spc ? NULL : TAILQ_PREV(n, pnodeq, child);
+ while (np != NULL) {
+ switch (pnode_class(np->node)) {
+ case CLASS_VOID:
+ case CLASS_TEXT:
+ case CLASS_BLOCK:
+ np = NULL;
+ break;
+ case CLASS_TRANS:
+ np = TAILQ_LAST(&np->childq, pnodeq);
+ continue;
+ case CLASS_LINE:
+ case CLASS_ENCL:
+ break;
+ }
+ break;
+ }
+ if (np != NULL) {
i = 0;
while (i < sz && !isspace((unsigned char)word[i]))
i++;
@@ -517,12 +420,30 @@ xml_entity(struct parse *p, const char *
}
/*
+ * Parse an element name.
+ */
+static enum nodeid
+xml_name2node(struct parse *p, const char *name)
+{
+ const struct alias *alias;
+ enum nodeid node;
+
+ if ((node = pnode_parse(name)) < NODE_UNKNOWN)
+ return node;
+
+ for (alias = aliases; alias->name != NULL; alias++)
+ if (strcmp(alias->name, name) == 0)
+ return alias->node;
+
+ return NODE_UNKNOWN;
+}
+
+/*
* Begin an element.
*/
static void
xml_elem_start(struct parse *p, const char *name)
{
- const struct element *elem;
struct pnode *n;
/*
@@ -535,21 +456,7 @@ xml_elem_start(struct parse *p, const ch
return;
}
- pnode_closetext(p, 1);
-
- for (elem = elements; elem->name != NULL; elem++)
- if (strcmp(elem->name, name) == 0)
- break;
-
- if (elem->name == NULL) {
- if (*name == '!' || *name == '?')
- return;
- error_msg(p, "unknown element <%s>", name);
- }
-
- p->ncur = elem->node;
-
- switch (p->ncur) {
+ switch (p->ncur = xml_name2node(p, name)) {
case NODE_DELETE_WARN:
warn_msg(p, "skipping element <%s>", name);
/* FALLTHROUGH */
@@ -558,6 +465,10 @@ xml_elem_start(struct parse *p, const ch
/* FALLTHROUGH */
case NODE_IGNORE:
return;
+ case NODE_UNKNOWN:
+ if (*name != '!' && *name != '?')
+ error_msg(p, "unknown element <%s>", name);
+ return;
default:
break;
}
@@ -565,57 +476,42 @@ xml_elem_start(struct parse *p, const ch
if (p->tree->flags & TREE_CLOSED && p->cur->parent == NULL)
warn_msg(p, "element after end of document: <%s>", name);
+ switch (pnode_class(p->ncur)) {
+ case CLASS_LINE:
+ case CLASS_ENCL:
+ pnode_closetext(p, 1);
+ break;
+ default:
+ pnode_closetext(p, 0);
+ break;
+ }
+
if ((n = pnode_alloc(p->cur)) == NULL)
fatal(p);
/*
+ * Some elements are self-closing.
* Nodes that begin a new macro or request line or start by
* printing text always want whitespace before themselves.
*/
- switch (n->node = elem->node) {
+ switch (n->node = p->ncur) {
case NODE_DOCTYPE:
case NODE_ENTITY:
case NODE_SBR:
p->flags |= PFLAG_EEND;
- /* FALLTHROUGH */
- case NODE_APPENDIX:
- case NODE_AUTHORGROUP:
- case NODE_BLOCKQUOTE:
- case NODE_BOOKINFO:
- case NODE_CAUTION:
- case NODE_EDITOR:
- case NODE_ENTRY:
- case NODE_FUNCDEF:
- case NODE_FUNCPROTOTYPE:
- case NODE_INFORMALEQUATION:
- case NODE_INLINEEQUATION:
- case NODE_ITEMIZEDLIST:
- case NODE_LEGALNOTICE:
- case NODE_LITERALLAYOUT:
- case NODE_NOTE:
- case NODE_ORDEREDLIST:
- case NODE_PARA:
- case NODE_PREFACE:
- case NODE_PROGRAMLISTING:
- case NODE_REFMETA:
- case NODE_REFNAMEDIV:
- case NODE_REFSYNOPSISDIV:
- case NODE_ROW:
- case NODE_SCREEN:
- case NODE_SECTION:
- case NODE_SYNOPSIS:
- case NODE_TGROUP:
- case NODE_TIP:
- case NODE_TITLE:
- case NODE_VARIABLELIST:
- case NODE_VARLISTENTRY:
- case NODE_WARNING:
- n->spc = 1;
break;
default:
+ break;
+ }
+ switch (pnode_class(p->ncur)) {
+ case CLASS_LINE:
+ case CLASS_ENCL:
n->spc = (p->flags & PFLAG_SPC) != 0;
break;
+ default:
+ n->spc = 1;
+ break;
}
p->cur = n;
if (n->node == NODE_DOCTYPE) {
@@ -689,7 +585,6 @@ xml_attrval(struct parse *p, const char
static void
xml_elem_end(struct parse *p, const char *name)
{
- const struct element *elem;
struct pnode *n;
const char *cp;
enum nodeid node;
@@ -706,13 +601,7 @@ xml_elem_end(struct parse *p, const char
if (p->del == 0)
pnode_closetext(p, 0);
- if (name != NULL) {
- for (elem = elements; elem->name != NULL; elem++)
- if (strcmp(elem->name, name) == 0)
- break;
- node = elem->node;
- } else
- node = p->ncur;
+ node = name == NULL ? p->ncur : xml_name2node(p, name);
switch (node) {
case NODE_DELETE_WARN:
@@ -721,6 +610,7 @@ xml_elem_end(struct parse *p, const char
p->del--;
break;
case NODE_IGNORE:
+ case NODE_UNKNOWN:
break;
case NODE_INCLUDE:
n = p->cur;
Index: node.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lnode.c -Lnode.c -u -p -r1.9 -r1.10
--- node.c
+++ node.c
@@ -15,6 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -24,6 +25,129 @@
* The implementation of the DocBook syntax tree.
*/
+struct nodeprop {
+ const char *name;
+ enum nodeclass class;
+};
+
+static const struct nodeprop properties[] = {
+ { "affiliation", CLASS_TRANS },
+ { "appendix", CLASS_BLOCK },
+ { "application", CLASS_LINE },
+ { "arg", CLASS_ENCL },
+ { "author", CLASS_LINE },
+ { "authorgroup", CLASS_BLOCK },
+ { "blockquote", CLASS_BLOCK },
+ { "bookinfo", CLASS_BLOCK },
+ { "caution", CLASS_BLOCK },
+ { "citerefentry", CLASS_LINE },
+ { "citetitle", CLASS_LINE },
+ { "cmdsynopsis", CLASS_TRANS },
+ { "colspec", CLASS_VOID },
+ { "command", CLASS_LINE },
+ { "constant", CLASS_LINE },
+ { "contrib", CLASS_TRANS },
+ { "copyright", CLASS_TRANS },
+ { "date", CLASS_TRANS },
+ { "!DOCTYPE", CLASS_VOID },
+ { "editor", CLASS_LINE },
+ { "email", CLASS_ENCL },
+ { "emphasis", CLASS_LINE },
+ { "!ENTITY", CLASS_VOID },
+ { "entry", CLASS_ENCL },
+ { "envar", CLASS_LINE },
+ { "errorname", CLASS_LINE },
+ { "fieldsynopsis", CLASS_TRANS },
+ { "filename", CLASS_LINE },
+ { "firstterm", CLASS_LINE },
+ { "footnote", CLASS_TRANS },
+ { "funcdef", CLASS_BLOCK },
+ { "funcprototype", CLASS_BLOCK },
+ { "funcsynopsis", CLASS_TRANS },
+ { "funcsynopsisinfo", CLASS_LINE },
+ { "function", CLASS_LINE },
+ { "glossterm", CLASS_LINE },
+ { "group", CLASS_ENCL },
+ { "holder", CLASS_TRANS },
+ { "xi:include", CLASS_VOID },
+ { "index", CLASS_TRANS },
+ { "info", CLASS_TRANS },
+ { "informalequation", CLASS_BLOCK },
+ { "inlineequation", CLASS_BLOCK },
+ { "itemizedlist", CLASS_BLOCK },
+ { "keysym", CLASS_LINE },
+ { "legalnotice", CLASS_BLOCK },
+ { "link", CLASS_ENCL },
+ { "listitem", CLASS_TRANS },
+ { "literal", CLASS_ENCL },
+ { "literallayout", CLASS_BLOCK },
+ { "manvolnum", CLASS_TRANS },
+ { "markup", CLASS_LINE },
+ { "member", CLASS_LINE },
+ { "mml:math", CLASS_LINE },
+ { "mml:mfenced", CLASS_LINE },
+ { "mml:mfrac", CLASS_LINE },
+ { "mml:mi", CLASS_LINE },
+ { "mml:mn", CLASS_LINE },
+ { "mml:mo", CLASS_LINE },
+ { "mml:mrow", CLASS_LINE },
+ { "mml:msub", CLASS_LINE },
+ { "mml:msup", CLASS_LINE },
+ { "modifier", CLASS_LINE },
+ { "note", CLASS_BLOCK },
+ { "option", CLASS_LINE },
+ { "orderedlist", CLASS_BLOCK },
+ { "orgname", CLASS_TRANS },
+ { "para", CLASS_BLOCK },
+ { "paramdef", CLASS_LINE },
+ { "parameter", CLASS_LINE },
+ { "personname", CLASS_TRANS },
+ { "preface", CLASS_BLOCK },
+ { "programlisting", CLASS_BLOCK },
+ { "prompt", CLASS_TRANS },
+ { "quote", CLASS_ENCL },
+ { "refclass", CLASS_TRANS },
+ { "refdescriptor", CLASS_TRANS },
+ { "refentry", CLASS_TRANS },
+ { "refentryinfo", CLASS_VOID },
+ { "refentrytitle", CLASS_TRANS },
+ { "refmeta", CLASS_TRANS },
+ { "refmetainfo", CLASS_TRANS },
+ { "refmiscinfo", CLASS_TRANS },
+ { "refname", CLASS_LINE },
+ { "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 },
+ { "spanspec", CLASS_TRANS },
+ { "subtitle", CLASS_TRANS },
+ { "synopsis", CLASS_BLOCK },
+ { "table", CLASS_TRANS },
+ { "tbody", CLASS_TRANS },
+ { "term", CLASS_LINE },
+ { "tfoot", CLASS_TRANS },
+ { "tgroup", CLASS_BLOCK },
+ { "thead", CLASS_TRANS },
+ { "tip", CLASS_BLOCK },
+ { "title", CLASS_BLOCK },
+ { "type", CLASS_LINE },
+ { "variablelist", CLASS_BLOCK },
+ { "varlistentry", CLASS_BLOCK },
+ { "varname", CLASS_LINE },
+ { "warning", CLASS_BLOCK },
+ { "wordasword", CLASS_TRANS },
+ { "year", CLASS_TRANS },
+ { "[UNKNOWN]", CLASS_VOID },
+ { "[TEXT]", CLASS_TEXT },
+ { "[ESCAPE]", CLASS_TEXT }
+};
+
static const char *const attrkeys[ATTRKEY__MAX] = {
"choice",
"class",
@@ -72,6 +196,31 @@ attrval_parse(const char *name)
if (strcmp(name, attrvals[val]) == 0)
break;
return val;
+}
+
+enum nodeid
+pnode_parse(const char *name)
+{
+ enum nodeid node;
+
+ for (node = 0; node < NODE_UNKNOWN; node++)
+ if (strcmp(name, properties[node].name) == 0)
+ break;
+ return node;
+}
+
+const char *
+pnode_name(enum nodeid node)
+{
+ assert(node < NODE_IGNORE);
+ return properties[node].name;
+}
+
+enum nodeclass
+pnode_class(enum nodeid node)
+{
+ assert(node < NODE_IGNORE);
+ return properties[node].class;
}
struct pnode *
Index: README
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/README,v
retrieving revision 1.5
retrieving revision 1.6
diff -LREADME -LREADME -u -p -r1.5 -r1.6
--- README
+++ README
@@ -13,9 +13,10 @@ For these, you will have to look at 4.5
https://tdg.docbook.org/tdg/4.5/foo.html
-Add one "struct element" initializer to the elements[] array in the
-file parse.c, containing the name of element as it appears in DocBook
-documents and the "enum nodeid" constant of the node to be generated.
+Add one "struct alias" initializer to the aliases[] array in the
+file parse.c *or* one "struct nodeprop" initializer to the properties[]
+array in the file node.c, but not both. The first struct member is
+the name of the element as it appears in DocBook documents.
There are several special cases:
* If docbook2mdoc(1) never needs to produce any output for the
@@ -47,9 +48,9 @@ There are several special cases:
one explicit formatting decision based on the presence, absence,
or content of the element - add an enum constant for the new
node to the declaration of "enum nodeid" in the file node.h.
- Preserve the alphabetic ordering.
+ Use properties[] in node.c and preserve the alphabetic ordering.
Add such a constant if only if the code will use it at least at
- one place in addition to the definition of the elements[] array.
+ one place.
In the latter case, implement formatting in the file docbook2mdoc.c.
Index: node.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lnode.h -Lnode.h -u -p -r1.19 -r1.20
--- node.h
+++ node.h
@@ -22,14 +22,23 @@
*/
/*
+ * How the output from each node behaves
+ * with respect to mdoc(7) structure.
+ */
+enum nodeclass {
+ CLASS_VOID = 0, /* No output at all, children are skipped. */
+ CLASS_TEXT, /* Node prints only text, no macros. */
+ CLASS_TRANS, /* Transparent: only the children are shown. */
+ CLASS_LINE, /* Generates only simple in-line macros. */
+ CLASS_ENCL, /* Explicit or implicit partial blocks. */
+ CLASS_BLOCK /* Output linebreak before and after. */
+};
+
+/*
* All node types used for formatting purposes.
* More DocBook XML elements are recognized, but remapped or discarded.
*/
enum nodeid {
- NODE_DELETE_WARN,
- NODE_DELETE,
- NODE_IGNORE,
- /* Alpha-ordered hereafter. */
NODE_AFFILIATION,
NODE_APPENDIX,
NODE_APPLICATION,
@@ -56,7 +65,6 @@ enum nodeid {
NODE_ENTRY,
NODE_ENVAR,
NODE_ERRORNAME,
- NODE_ESCAPE,
NODE_FIELDSYNOPSIS,
NODE_FILENAME,
NODE_FIRSTTERM,
@@ -131,21 +139,24 @@ enum nodeid {
NODE_TABLE,
NODE_TBODY,
NODE_TERM,
- NODE_TEXT,
NODE_TFOOT,
NODE_TGROUP,
NODE_THEAD,
NODE_TIP,
NODE_TITLE,
NODE_TYPE,
- NODE_ULINK,
NODE_VARIABLELIST,
NODE_VARLISTENTRY,
NODE_VARNAME,
NODE_WARNING,
NODE_WORDASWORD,
NODE_YEAR,
- NODE__MAX
+ NODE_UNKNOWN,
+ NODE_TEXT,
+ NODE_ESCAPE,
+ NODE_IGNORE,
+ NODE_DELETE,
+ NODE_DELETE_WARN
};
/*
@@ -228,6 +239,10 @@ struct ptree {
enum attrkey attrkey_parse(const char *);
enum attrval attrval_parse(const char *);
+enum nodeid pnode_parse(const char *name);
+const char *pnode_name(enum nodeid);
+enum nodeclass pnode_class(enum nodeid);
+
struct pnode *pnode_alloc(struct pnode *);
void pnode_unlink(struct pnode *);
void pnode_unlinksub(struct pnode *);
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-12 16:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 16:41 docbook2mdoc: Infrastructure to access node properties that can be used schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).