=================================================================== RCS file: /cvs/docbook2mdoc/node.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -r1.11 -r1.12 --- docbook2mdoc/node.c 2019/04/12 19:14:50 1.11 +++ docbook2mdoc/node.c 2019/04/13 13:06:35 1.12 @@ -1,4 +1,4 @@ -/* $Id: node.c,v 1.11 2019/04/12 19:14:50 schwarze Exp $ */ +/* $Id: node.c,v 1.12 2019/04/13 13:06:35 schwarze Exp $ */ /* * Copyright (c) 2014 Kristaps Dzonsons * Copyright (c) 2019 Ingo Schwarze @@ -105,6 +105,7 @@ static const struct nodeprop properties[] = { { "preface", CLASS_BLOCK }, { "programlisting", CLASS_BLOCK }, { "prompt", CLASS_TRANS }, + { "pubdate", CLASS_TRANS }, { "quote", CLASS_ENCL }, { "refclass", CLASS_TRANS }, { "refdescriptor", CLASS_TRANS }, @@ -340,10 +341,25 @@ pnode_findfirst(struct pnode *n, enum nodeid node) { struct pnode *nc, *res; + if (n == NULL) + return NULL; if (n->node == node) return n; TAILQ_FOREACH(nc, &n->childq, child) if ((res = pnode_findfirst(nc, node)) != NULL) return res; return NULL; +} + +/* + * Like pnode_findfirst(), but also take the node out of the tree. + */ +struct pnode * +pnode_takefirst(struct pnode *n, enum nodeid node) +{ + struct pnode *nc; + + if ((nc = pnode_findfirst(n, node)) != NULL && nc->parent != NULL) + TAILQ_REMOVE(&nc->parent->childq, nc, child); + return nc; }