=================================================================== RCS file: /cvs/docbook2mdoc/node.c,v retrieving revision 1.23 retrieving revision 1.28 diff -u -p -r1.23 -r1.28 --- docbook2mdoc/node.c 2019/04/21 14:48:11 1.23 +++ docbook2mdoc/node.c 2019/05/01 12:52:05 1.28 @@ -1,4 +1,4 @@ -/* $Id: node.c,v 1.23 2019/04/21 14:48:11 schwarze Exp $ */ +/* $Id: node.c,v 1.28 2019/05/01 12:52:05 schwarze Exp $ */ /* * Copyright (c) 2014 Kristaps Dzonsons * Copyright (c) 2019 Ingo Schwarze @@ -19,6 +19,7 @@ #include #include +#include "xmalloc.h" #include "node.h" /* @@ -31,6 +32,7 @@ struct nodeprop { }; static const struct nodeprop properties[] = { + { "abstract", CLASS_BLOCK }, { "appendix", CLASS_BLOCK }, { "arg", CLASS_ENCL }, { "author", CLASS_LINE }, @@ -60,6 +62,7 @@ static const struct nodeprop properties[] = { { "firstterm", CLASS_LINE }, { "footnote", CLASS_BLOCK }, { "funcdef", CLASS_BLOCK }, + { "funcparams", CLASS_LINE }, { "funcprototype", CLASS_BLOCK }, { "funcsynopsis", CLASS_TRANS }, { "funcsynopsisinfo", CLASS_LINE }, @@ -147,6 +150,7 @@ static const struct nodeprop properties[] = { { "warning", CLASS_BLOCK }, { "wordasword", CLASS_TRANS }, { "xref", CLASS_LINE }, + { "year", CLASS_TRANS }, { "[UNKNOWN]", CLASS_VOID }, { "(t)", CLASS_TEXT }, { "(e)", CLASS_TEXT } @@ -252,12 +256,22 @@ pnode_alloc(struct pnode *np) { struct pnode *n; - if ((n = calloc(1, sizeof(*n))) != NULL) { - TAILQ_INIT(&n->childq); - TAILQ_INIT(&n->attrq); - if ((n->parent = np) != NULL) - TAILQ_INSERT_TAIL(&np->childq, n, child); - } + n = xcalloc(1, sizeof(*n)); + TAILQ_INIT(&n->childq); + TAILQ_INIT(&n->attrq); + if ((n->parent = np) != NULL) + TAILQ_INSERT_TAIL(&np->childq, n, child); + return n; +} + +struct pnode * +pnode_alloc_text(struct pnode *np, const char *text) +{ + struct pnode *n; + + n = pnode_alloc(np); + n->node = NODE_TEXT; + n->b = xstrdup(text); return n; }