* docbook2mdoc: implement file inclusion via <xi:include>
@ 2019-04-09 1:39 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-09 1:39 UTC (permalink / raw)
To: source
Log Message:
-----------
implement file inclusion via <xi:include>
Modified Files:
--------------
docbook2mdoc:
node.c
node.h
parse.c
Revision Data
-------------
Index: node.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lnode.h -Lnode.h -u -p -r1.13 -r1.14
--- node.h
+++ node.h
@@ -69,6 +69,7 @@ enum nodeid {
NODE_GLOSSTERM,
NODE_GROUP,
NODE_HOLDER,
+ NODE_INCLUDE,
NODE_INDEX,
NODE_INFO,
NODE_INFORMALEQUATION,
@@ -159,6 +160,7 @@ enum attrkey {
ATTRKEY_COLS,
ATTRKEY_DEFINITION,
ATTRKEY_ENDTERM,
+ ATTRKEY_HREF,
ATTRKEY_ID,
ATTRKEY_LINKEND,
ATTRKEY_NAME,
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -Lparse.c -Lparse.c -u -p -r1.25 -r1.26
--- parse.c
+++ parse.c
@@ -213,7 +213,7 @@ static const struct element elements[] =
{ "varname", NODE_VARNAME },
{ "warning", NODE_WARNING },
{ "wordasword", NODE_WORDASWORD },
- { "xi:include", NODE_DELETE_WARN },
+ { "xi:include", NODE_INCLUDE },
{ "year", NODE_YEAR },
{ NULL, NODE_IGNORE }
};
@@ -641,6 +641,8 @@ static void
xml_elem_end(struct parse *ps, const char *name)
{
const struct element *elem;
+ struct pnode *n;
+ const char *cp;
enum nodeid node;
/*
@@ -670,6 +672,18 @@ xml_elem_end(struct parse *ps, const cha
ps->del--;
break;
case NODE_IGNORE:
+ break;
+ case NODE_INCLUDE:
+ n = ps->cur;
+ ps->cur = ps->cur->parent;
+ cp = pnode_getattr_raw(n, ATTRKEY_HREF, NULL);
+ if (cp == NULL)
+ error_msg(ps, "<xi:include> element "
+ "without href attribute");
+ else
+ parse_file(ps, -1, cp);
+ pnode_unlink(n);
+ ps->flags &= ~PFLAG_SPC;
break;
case NODE_DOCTYPE:
ps->flags &= ~PFLAG_EEND;
Index: node.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lnode.c -Lnode.c -u -p -r1.5 -r1.6
--- node.c
+++ node.c
@@ -31,6 +31,7 @@ static const char *const attrkeys[ATTRKE
"cols",
"DEFINITION",
"endterm",
+ "href",
"id",
"linkend",
"NAME",
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-09 1:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 1:39 docbook2mdoc: implement file inclusion via <xi:include> schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).