* docbook2mdoc: Author node polishing: * In the AUTHORS section, set
@ 2019-04-12 21:37 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-12 21:37 UTC (permalink / raw)
To: source
Log Message:
-----------
Author node polishing:
* In the AUTHORS section, set -nosplit mode.
* In <author>, do not recurse for <email>: it is pointless because it
cannot reasonably contain child elements, but it can trigger assertions.
* For standalone <email>, do the standard was_impl dance.
* Treat <othercredit> just like <author>.
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
parse.c
statistics.c
Revision Data
-------------
Index: statistics.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lstatistics.c -Lstatistics.c -u -p -r1.19 -r1.20
--- statistics.c
+++ statistics.c
@@ -352,6 +352,11 @@ main(int argc, char *argv[])
table_add("acronym", "TEXT");
table_add("appendix", NULL);
table_add("article", NULL);
+ table_add("author", "contrib");
+ table_add("author", "email");
+ table_add("author", "firstname");
+ table_add("author", "othername");
+ table_add("author", "surname");
table_add("blockquote", NULL);
table_add("book", NULL);
table_add("chapter", NULL);
@@ -392,6 +397,11 @@ main(int argc, char *argv[])
table_add("member", "TEXT");
table_add("note", NULL);
table_add("orderedlist", "listitem");
+ table_add("othercredit", "contrib");
+ table_add("othercredit", "email");
+ table_add("othercredit", "firstname");
+ table_add("othercredit", "othername");
+ table_add("othercredit", "surname");
table_add("para", NULL);
table_add("paramdef", "parameter");
table_add("paramdef", "TEXT");
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.114 -r1.115
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -198,7 +198,7 @@ pnode_printrefsynopsisdiv(struct format
static void
pnode_printrefsect(struct format *f, struct pnode *n)
{
- struct pnode *nc;
+ struct pnode *nc, *ncc;
const char *title;
int flags, level;
@@ -270,12 +270,24 @@ pnode_printrefsect(struct format *f, str
break;
}
- if (nc != NULL) {
+ if (nc != NULL)
macro_addnode(f, nc, flags);
- pnode_unlink(nc);
- } else
+ else
macro_addarg(f, title, flags | ARG_QUOTED);
macro_close(f);
+
+ /*
+ * DocBook has no equivalent for -split mode,
+ * so just switch the default in the AUTHORS section.
+ */
+
+ if (nc != NULL) {
+ ncc = TAILQ_FIRST(&nc->childq);
+ if (ncc != NULL && ncc->node == NODE_TEXT &&
+ strcasecmp(ncc->b, "AUTHORS") == 0)
+ macro_line(f, "An -nosplit");
+ pnode_unlink(nc);
+ }
}
/*
@@ -581,7 +593,8 @@ pnode_printauthor(struct format *f, stru
if ((nc = pnode_findfirst(n, NODE_EMAIL)) != NULL) {
f->flags |= FMT_CHILD;
- pnode_print(f, nc);
+ macro_open(f, "Aq Mt");
+ macro_addnode(f, nc, ARG_SPACE);
pnode_unlink(nc);
}
@@ -883,7 +896,12 @@ pnode_print(struct format *f, struct pno
macro_open(f, "An");
break;
case NODE_EMAIL:
- macro_open(f, "Aq Mt");
+ if (was_impl)
+ macro_open(f, "Ao Mt");
+ else {
+ macro_open(f, "Aq Mt");
+ f->flags |= FMT_IMPL;
+ }
break;
case NODE_EMPHASIS:
case NODE_FIRSTTERM:
@@ -1054,6 +1072,13 @@ pnode_print(struct format *f, struct pno
pnode_print(f, nc);
switch (n->node) {
+ case NODE_EMAIL:
+ if (was_impl) {
+ f->flags &= ~FMT_NOSPC;
+ macro_open(f, "Ac");
+ } else
+ f->flags &= ~FMT_IMPL;
+ break;
case NODE_ESCAPE:
case NODE_TERM:
case NODE_TEXT:
@@ -1067,9 +1092,10 @@ pnode_print(struct format *f, struct pno
macro_line(f, "EN");
break;
case NODE_LITERAL:
- if (was_impl)
+ if (was_impl) {
+ f->flags &= ~FMT_NOSPC;
macro_open(f, "Sc");
- else
+ } else
f->flags &= ~FMT_IMPL;
break;
case NODE_MEMBER:
@@ -1099,9 +1125,10 @@ pnode_print(struct format *f, struct pno
fputs(" } ", stdout);
break;
case NODE_QUOTE:
- if (was_impl)
+ if (was_impl) {
+ f->flags &= ~FMT_NOSPC;
macro_open(f, "Dc");
- else
+ } else
f->flags &= ~FMT_IMPL;
break;
case NODE_PREFACE:
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -Lparse.c -Lparse.c -u -p -r1.39 -r1.40
--- parse.c
+++ parse.c
@@ -85,6 +85,7 @@ static const struct alias aliases[] = {
{ "glosslist", NODE_VARIABLELIST },
{ "indexterm", NODE_DELETE },
{ "informaltable", NODE_TABLE },
+ { "othercredit", NODE_AUTHOR },
{ "othername", NODE_PERSONNAME },
{ "part", NODE_SECTION },
{ "phrase", NODE_IGNORE },
--
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-12 21:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 21:37 docbook2mdoc: Author node polishing: * In the AUTHORS section, set 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).