version 1.10, 2019/04/12 16:40:53 |
version 1.12, 2019/04/13 13:06:35 |
Line 105 static const struct nodeprop properties[] = { |
|
Line 105 static const struct nodeprop properties[] = { |
|
{ "preface", CLASS_BLOCK }, |
{ "preface", CLASS_BLOCK }, |
{ "programlisting", CLASS_BLOCK }, |
{ "programlisting", CLASS_BLOCK }, |
{ "prompt", CLASS_TRANS }, |
{ "prompt", CLASS_TRANS }, |
|
{ "pubdate", CLASS_TRANS }, |
{ "quote", CLASS_ENCL }, |
{ "quote", CLASS_ENCL }, |
{ "refclass", CLASS_TRANS }, |
{ "refclass", CLASS_TRANS }, |
{ "refdescriptor", CLASS_TRANS }, |
{ "refdescriptor", CLASS_TRANS }, |
Line 144 static const struct nodeprop properties[] = { |
|
Line 145 static const struct nodeprop properties[] = { |
|
{ "wordasword", CLASS_TRANS }, |
{ "wordasword", CLASS_TRANS }, |
{ "year", CLASS_TRANS }, |
{ "year", CLASS_TRANS }, |
{ "[UNKNOWN]", CLASS_VOID }, |
{ "[UNKNOWN]", CLASS_VOID }, |
{ "[TEXT]", CLASS_TEXT }, |
{ "(t)", CLASS_TEXT }, |
{ "[ESCAPE]", CLASS_TEXT } |
{ "(e)", CLASS_TEXT } |
}; |
}; |
|
|
static const char *const attrkeys[ATTRKEY__MAX] = { |
static const char *const attrkeys[ATTRKEY__MAX] = { |
Line 187 attrkey_parse(const char *name) |
|
Line 188 attrkey_parse(const char *name) |
|
return key; |
return key; |
} |
} |
|
|
|
const char * |
|
attrkey_name(enum attrkey key) |
|
{ |
|
return attrkeys[key]; |
|
} |
|
|
enum attrval |
enum attrval |
attrval_parse(const char *name) |
attrval_parse(const char *name) |
{ |
{ |
Line 198 attrval_parse(const char *name) |
|
Line 205 attrval_parse(const char *name) |
|
return val; |
return val; |
} |
} |
|
|
|
const char * |
|
attr_getval(const struct pattr *a) |
|
{ |
|
return a->val == ATTRVAL__MAX ? a->rawval : attrvals[a->val]; |
|
} |
|
|
enum nodeid |
enum nodeid |
pnode_parse(const char *name) |
pnode_parse(const char *name) |
{ |
{ |
Line 328 pnode_findfirst(struct pnode *n, enum nodeid node) |
|
Line 341 pnode_findfirst(struct pnode *n, enum nodeid node) |
|
{ |
{ |
struct pnode *nc, *res; |
struct pnode *nc, *res; |
|
|
|
if (n == NULL) |
|
return NULL; |
if (n->node == node) |
if (n->node == node) |
return n; |
return n; |
TAILQ_FOREACH(nc, &n->childq, child) |
TAILQ_FOREACH(nc, &n->childq, child) |
if ((res = pnode_findfirst(nc, node)) != NULL) |
if ((res = pnode_findfirst(nc, node)) != NULL) |
return res; |
return res; |
return NULL; |
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; |
} |
} |