=================================================================== RCS file: /cvs/docbook2mdoc/node.c,v retrieving revision 1.18 retrieving revision 1.25 diff -u -p -r1.18 -r1.25 --- docbook2mdoc/node.c 2019/04/14 22:37:56 1.18 +++ docbook2mdoc/node.c 2019/04/28 15:32:05 1.25 @@ -1,4 +1,4 @@ -/* $Id: node.c,v 1.18 2019/04/14 22:37:56 schwarze Exp $ */ +/* $Id: node.c,v 1.25 2019/04/28 15:32: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" /* @@ -78,7 +79,7 @@ static const struct nodeprop properties[] = { { "link", CLASS_ENCL }, { "listitem", CLASS_TRANS }, { "literal", CLASS_ENCL }, - { "literallayout", CLASS_BLOCK }, + { "literallayout", CLASS_NOFILL }, { "manvolnum", CLASS_TRANS }, { "markup", CLASS_LINE }, { "member", CLASS_LINE }, @@ -93,6 +94,7 @@ static const struct nodeprop properties[] = { { "mml:msup", CLASS_LINE }, { "modifier", CLASS_LINE }, { "note", CLASS_BLOCK }, + { "olink", CLASS_ENCL }, { "option", CLASS_LINE }, { "orderedlist", CLASS_BLOCK }, { "para", CLASS_BLOCK }, @@ -100,7 +102,8 @@ static const struct nodeprop properties[] = { { "parameter", CLASS_LINE }, { "personname", CLASS_TRANS }, { "preface", CLASS_BLOCK }, - { "programlisting", CLASS_BLOCK }, + { "productname", CLASS_LINE }, + { "programlisting", CLASS_NOFILL }, { "prompt", CLASS_TRANS }, { "pubdate", CLASS_TRANS }, { "quote", CLASS_ENCL }, @@ -119,7 +122,7 @@ static const struct nodeprop properties[] = { { "replaceable", CLASS_LINE }, { "row", CLASS_BLOCK }, { "sbr", CLASS_BLOCK }, - { "screen", CLASS_BLOCK }, + { "screen", CLASS_NOFILL }, { "section", CLASS_BLOCK }, { "simplelist", CLASS_TRANS }, { "simplesect", CLASS_BLOCK }, @@ -127,7 +130,7 @@ static const struct nodeprop properties[] = { { "subscript", CLASS_TEXT }, { "subtitle", CLASS_BLOCK }, { "superscript", CLASS_TEXT }, - { "synopsis", CLASS_BLOCK }, + { "synopsis", CLASS_NOFILL }, { "systemitem", CLASS_LINE }, { "table", CLASS_TRANS }, { "tbody", CLASS_TRANS }, @@ -141,8 +144,10 @@ static const struct nodeprop properties[] = { { "variablelist", CLASS_BLOCK }, { "varlistentry", CLASS_BLOCK }, { "varname", CLASS_LINE }, + { "void", CLASS_TEXT }, { "warning", CLASS_BLOCK }, { "wordasword", CLASS_TRANS }, + { "xref", CLASS_LINE }, { "[UNKNOWN]", CLASS_VOID }, { "(t)", CLASS_TEXT }, { "(e)", CLASS_TEXT } @@ -160,11 +165,14 @@ static const char *const attrkeys[ATTRKEY__MAX] = { "href", "id", "linkend", + "localinfo", "NAME", "open", "PUBLIC", "rep", "SYSTEM", + "targetdoc", + "targetptr", "url", "xlink:href" }; @@ -245,12 +253,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; }