* docbook2mdoc: Add <sgmltag> and (ignore) <anchor>.
@ 2014-04-02 12:12 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2014-04-02 12:12 UTC (permalink / raw)
To: source
Log Message:
-----------
Add <sgmltag> and (ignore) <anchor>.
Also give more error-reporting for internal XML errors.
Modified Files:
--------------
docbook2mdoc:
rules.c
extern.h
docbook2mdoc.c
Revision Data
-------------
Index: extern.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/docbook2mdoc/extern.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lextern.h -Lextern.h -u -p -r1.16 -r1.17
--- extern.h
+++ extern.h
@@ -8,6 +8,7 @@ enum nodeid {
NODE_ROOT = 0, /* Must comes first. */
/* Alpha-ordered hereafter. */
NODE_ACRONYM,
+ NODE_ANCHOR,
NODE_APPLICATION,
NODE_ARG,
NODE_CAUTION,
@@ -59,6 +60,7 @@ enum nodeid {
NODE_ROW,
NODE_SBR,
NODE_SCREEN,
+ NODE_SGMLTAG,
NODE_STRUCTNAME,
NODE_SYNOPSIS,
NODE_TABLE,
@@ -76,6 +78,7 @@ enum nodeid {
NODE_VARLISTENTRY,
NODE_VARNAME,
NODE_WARNING,
+ NODE_WORDASWORD,
NODE__MAX
};
Index: docbook2mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.29 -r1.30
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -88,6 +88,7 @@ static const char *attrvals[ATTRVAL__MAX
static const struct node nodes[NODE__MAX] = {
{ NULL, 0 },
{ "acronym", 0 },
+ { "anchor", NODE_IGNTEXT },
{ "application", 0 },
{ "arg", 0 },
{ "caution", NODE_IGNTEXT },
@@ -139,6 +140,7 @@ static const struct node nodes[NODE__MAX
{ "row", NODE_IGNTEXT },
{ "sbr", NODE_IGNTEXT },
{ "screen", NODE_IGNTEXT },
+ { "sgmltag", 0 },
{ "structname", 0 },
{ "synopsis", 0 },
{ "table", NODE_IGNTEXT },
@@ -156,6 +158,7 @@ static const struct node nodes[NODE__MAX
{ "varlistentry", NODE_IGNTEXT },
{ "varname", 0 },
{ "warning", NODE_IGNTEXT },
+ { "wordasword", 0 },
};
static void
@@ -1065,6 +1068,9 @@ pnode_print(struct parse *p, struct pnod
pnode_printmopen(p);
fputs("Nm", stdout);
break;
+ case (NODE_ANCHOR):
+ /* Don't print anything! */
+ return;
case (NODE_ARG):
pnode_printarg(p, pn);
pnode_unlinksub(pn);
@@ -1209,6 +1215,10 @@ pnode_print(struct parse *p, struct pnod
assert(p->newln);
puts(".br");
break;
+ case (NODE_SGMLTAG):
+ pnode_printmopen(p);
+ fputs("Li", stdout);
+ break;
case (NODE_STRUCTNAME):
pnode_printmopen(p);
fputs("Vt", stdout);
@@ -1296,6 +1306,7 @@ pnode_print(struct parse *p, struct pnod
case (NODE_PARAMETER):
case (NODE_REPLACEABLE):
case (NODE_REFPURPOSE):
+ case (NODE_SGMLTAG):
case (NODE_STRUCTNAME):
case (NODE_TEXT):
case (NODE_USERINPUT):
@@ -1358,7 +1369,9 @@ readfile(XML_Parser xp, int fd,
while ((ssz = read(fd, b, bsz)) >= 0) {
if (0 == (rc = XML_Parse(xp, b, ssz, 0 == ssz)))
- fprintf(stderr, "%s: %s\n", fn,
+ fprintf(stderr, "%s:%zu:%zu: %s\n", fn,
+ XML_GetCurrentLineNumber(xp),
+ XML_GetCurrentColumnNumber(xp),
XML_ErrorString
(XML_GetErrorCode(xp)));
else if ( ! p.stop && ssz > 0)
Index: rules.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/docbook2mdoc/rules.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lrules.c -Lrules.c -u -p -r1.16 -r1.17
--- rules.c
+++ rules.c
@@ -87,6 +87,9 @@ isparent(enum nodeid node, enum nodeid p
break;
}
return(0);
+ case (NODE_ANCHOR):
+ /* We'll ignore this. */
+ return(1);
case (NODE_APPLICATION):
switch (parent) {
case (NODE_EMPHASIS):
@@ -454,6 +457,7 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_ULINK):
case (NODE_USERINPUT):
case (NODE_VARNAME):
+ case (NODE_WORDASWORD):
return(1);
default:
break;
@@ -689,7 +693,6 @@ isparent(enum nodeid node, enum nodeid p
break;
}
return(0);
-
case (NODE_REFCLASS):
return(parent == NODE_REFNAMEDIV);
case (NODE_REFDESCRIPTOR):
@@ -773,12 +776,14 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_REFPURPOSE):
case (NODE_REPLACEABLE):
case (NODE_SCREEN):
+ case (NODE_SGMLTAG):
case (NODE_SYNOPSIS):
case (NODE_TERM):
case (NODE_TITLE):
case (NODE_ULINK):
case (NODE_USERINPUT):
case (NODE_VARNAME):
+ case (NODE_WORDASWORD):
default:
return(1);
}
@@ -825,6 +830,37 @@ isparent(enum nodeid node, enum nodeid p
break;
}
return(0);
+ case (NODE_SGMLTAG):
+ switch (parent) {
+ case (NODE_APPLICATION):
+ case (NODE_CODE):
+ case (NODE_COMMAND):
+ case (NODE_EMPHASIS):
+ case (NODE_ENTRY):
+ case (NODE_FILENAME):
+ case (NODE_FUNCSYNOPSISINFO):
+ case (NODE_FUNCTION):
+ case (NODE_LINK):
+ case (NODE_LITERAL):
+ case (NODE_OPTION):
+ case (NODE_PARA):
+ case (NODE_PARAMETER):
+ case (NODE_PROGRAMLISTING):
+ case (NODE_QUOTE):
+ case (NODE_REFDESCRIPTOR):
+ case (NODE_REFENTRYTITLE):
+ case (NODE_REFNAME):
+ case (NODE_REFPURPOSE):
+ case (NODE_SCREEN):
+ case (NODE_SYNOPSIS):
+ case (NODE_TERM):
+ case (NODE_TITLE):
+ case (NODE_USERINPUT):
+ return(1);
+ default:
+ break;
+ }
+ return(0);
case (NODE_STRUCTNAME):
switch (parent) {
case (NODE_CODE):
@@ -1027,6 +1063,29 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_TIP):
case (NODE_VARIABLELIST):
case (NODE_WARNING):
+ return(1);
+ default:
+ break;
+ }
+ return(0);
+ case (NODE_WORDASWORD):
+ switch (parent) {
+ case (NODE_EMPHASIS):
+ case (NODE_ENTRY):
+ case (NODE_FUNCSYNOPSISINFO):
+ case (NODE_LINK):
+ case (NODE_PARA):
+ case (NODE_PROGRAMLISTING):
+ case (NODE_QUOTE):
+ case (NODE_REFDESCRIPTOR):
+ case (NODE_REFENTRYTITLE):
+ case (NODE_REFNAME):
+ case (NODE_REFPURPOSE):
+ case (NODE_SCREEN):
+ case (NODE_SYNOPSIS):
+ case (NODE_TERM):
+ case (NODE_TITLE):
+ case (NODE_ULINK):
return(1);
default:
break;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-02 12:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-02 12:12 docbook2mdoc: Add <sgmltag> and (ignore) <anchor> kristaps
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).