=================================================================== RCS file: /cvs/docbook2mdoc/parse.c,v retrieving revision 1.57 retrieving revision 1.60 diff -u -p -r1.57 -r1.60 --- docbook2mdoc/parse.c 2019/05/01 17:20:47 1.57 +++ docbook2mdoc/parse.c 2019/05/07 23:41:48 1.60 @@ -1,4 +1,4 @@ -/* $Id: parse.c,v 1.57 2019/05/01 17:20:47 schwarze Exp $ */ +/* $Id: parse.c,v 1.60 2019/05/07 23:41:48 schwarze Exp $ */ /* * Copyright (c) 2014 Kristaps Dzonsons * Copyright (c) 2019 Ingo Schwarze @@ -97,10 +97,12 @@ static const struct alias aliases[] = { { "imageobject", NODE_IGNORE }, { "indexterm", NODE_DELETE }, { "informaltable", NODE_TABLE }, + { "jobtitle", NODE_IGNORE }, { "keycap", NODE_KEYSYM }, { "keycode", NODE_IGNORE }, { "keycombo", NODE_IGNORE }, { "mediaobject", NODE_BLOCKQUOTE }, + { "orgdiv", NODE_IGNORE }, { "orgname", NODE_IGNORE }, { "othercredit", NODE_AUTHOR }, { "othername", NODE_PERSONNAME }, @@ -354,13 +356,13 @@ pnode_closetext(struct parse *p, int check_last_word) while (cp > n->b && !isspace((unsigned char)cp[-1])) cp--; + last_word = cp; + while (cp > n->b && isspace((unsigned char)cp[-1])) + cp--; if (cp == n->b) return; + *cp = '\0'; - last_word = cp; - while (cp > n->b && isspace((unsigned char)cp[-1])) - *--cp = '\0'; - /* Move the last word into its own node, for use with .Pf. */ n = pnode_alloc_text(p->cur, last_word); @@ -374,7 +376,7 @@ xml_entity(struct parse *p, const char *name) struct pnode *n; const char *ccp; char *cp; - unsigned int codepoint; + long codepoint; enum pstate pstate; if (p->del > 0) @@ -419,8 +421,16 @@ xml_entity(struct parse *p, const char *name) } } if (*name == '#') { - codepoint = strtonum(name + 1, 0, 0x10ffff, &ccp); - if (ccp == NULL) { + errno = 0; + if (name[1] == 'x') { + ccp = name + 2; + codepoint = strtol(ccp, &cp, 16); + } else { + ccp = name + 1; + codepoint = strtol(ccp, &cp, 10); + } + if (*ccp != '\0' && *cp == '\0' && errno != ERANGE && + codepoint >= 0 && codepoint <= 0x10ffff) { n = pnode_alloc(p->cur); xasprintf(&n->b, "\\[u%4.4X]", codepoint); goto done;