From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id b9899b18 for ; Tue, 23 Apr 2019 10:47:53 -0500 (EST) Date: Tue, 23 Apr 2019 10:47:53 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: docbook2mdoc: handle file inclusion via " Log Message: ----------- handle file inclusion via " Internal subset declaration to define an XML entity using an external .Ar file . +.It Eo +.Pf % Ar name No \& +.Bc +.Ec > +Internal subset declaration to include an external +.Ar file +that is supposed to contain entity declarations. .It Eo < Ic mml : Ns ... Ec > Elements from the MathML namespace. These are translated to Index: parse.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v retrieving revision 1.49 retrieving revision 1.50 diff -Lparse.c -Lparse.c -u -p -r1.49 -r1.50 --- parse.c +++ parse.c @@ -638,6 +638,7 @@ xml_elem_end(struct parse *p, const char if (p->del == 0) pnode_closetext(p, 0); + n = p->cur; node = name == NULL ? p->ncur : xml_name2node(p, name); switch (node) { @@ -650,8 +651,7 @@ xml_elem_end(struct parse *p, const char case NODE_UNKNOWN: break; case NODE_INCLUDE: - n = p->cur; - p->cur = p->cur->parent; + p->cur = n->parent; cp = pnode_getattr_raw(n, ATTRKEY_HREF, NULL); if (cp == NULL) error_msg(p, " element " @@ -667,7 +667,7 @@ xml_elem_end(struct parse *p, const char p->flags &= ~PFLAG_EEND; /* FALLTHROUGH */ default: - if (p->cur == NULL || node != p->cur->node) { + if (n == NULL || node != n->node) { warn_msg(p, "element not open: ", name); break; } @@ -681,13 +681,21 @@ xml_elem_end(struct parse *p, const char * obviously better than discarding it or crashing. */ - if (p->cur->parent != NULL || node == NODE_DOCTYPE) { - p->cur = p->cur->parent; + if (n->parent != NULL || node == NODE_DOCTYPE) { + p->cur = n->parent; if (p->cur != NULL) p->ncur = p->cur->node; } else p->tree->flags |= TREE_CLOSED; p->flags &= ~PFLAG_SPC; + + /* Include a file containing entity declarations. */ + + if (node == NODE_ENTITY && strcmp("%", + pnode_getattr_raw(n, ATTRKEY_NAME, "")) == 0 && + (cp = pnode_getattr_raw(n, ATTRKEY_SYSTEM, NULL)) != NULL) + parse_file(p, -1, cp); + break; } assert(p->del == 0); -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv