tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [PATCH docbook2mdoc] Add void, tag
@ 2019-04-20 15:48 Stephen Gregoratto
  2019-04-21 14:55 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Gregoratto @ 2019-04-20 15:48 UTC (permalink / raw)
  To: tech

This patch adds the <void> and <tag> nodes.

First off, <void>. From the docs:
> The void element produces generated text that indicates the function 
> has no arguments (or returns nothing). The exact generated text may 
> vary. One common result is void.
Found this in the xenocara tree. Output as .Ft void in an .Fo block

<sgmltag> morphed into <tag> in DocBook 5.*, and so it should be 
formatted the same. Found this when using the official db4-upgrade 
stylesheet on some files.

Index: docbook2mdoc.c
===================================================================
RCS file: /cvs/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.131
diff -u -p -r1.131 docbook2mdoc.c
--- docbook2mdoc.c	16 Apr 2019 21:21:27 -0000	1.131
+++ docbook2mdoc.c	20 Apr 2019 15:40:43 -0000
@@ -321,8 +321,11 @@ pnode_printfuncdef(struct format *f, str
 	struct pnode	*nc;
 
 	nc = TAILQ_FIRST(&n->childq);
-	if (nc != NULL && nc->node == NODE_TEXT) {
-		macro_argline(f, "Ft", nc->b);
+	if (nc != NULL) {
+		if (nc->node == NODE_VOID)
+			macro_argline(f, "Ft", "void");
+		else if (nc->node == NODE_TEXT)
+			macro_argline(f, "Ft", nc->b);
 		pnode_unlink(nc);
 	}
 	macro_nodeline(f, "Fo", n, ARG_SINGLE);
Index: node.c
===================================================================
RCS file: /cvs/docbook2mdoc/node.c,v
retrieving revision 1.22
diff -u -p -r1.22 node.c
--- node.c	16 Apr 2019 21:21:27 -0000	1.22
+++ node.c	20 Apr 2019 15:40:43 -0000
@@ -143,6 +143,7 @@ static	const struct nodeprop properties[
 	{ "variablelist",	CLASS_BLOCK },
 	{ "varlistentry",	CLASS_BLOCK },
 	{ "varname",		CLASS_LINE },
+	{ "void",		CLASS_LINE },
 	{ "warning",		CLASS_BLOCK },
 	{ "wordasword",		CLASS_TRANS },
 	{ "xref",		CLASS_LINE },
Index: node.h
===================================================================
RCS file: /cvs/docbook2mdoc/node.h,v
retrieving revision 1.31
diff -u -p -r1.31 node.h
--- node.h	16 Apr 2019 21:21:27 -0000	1.31
+++ node.h	20 Apr 2019 15:40:43 -0000
@@ -152,6 +152,7 @@ enum	nodeid {
 	NODE_VARIABLELIST,
 	NODE_VARLISTENTRY,
 	NODE_VARNAME,
+	NODE_VOID,
 	NODE_WARNING,
 	NODE_WORDASWORD,
 	NODE_XREF,
Index: parse.c
===================================================================
RCS file: /cvs/docbook2mdoc/parse.c,v
retrieving revision 1.47
diff -u -p -r1.47 parse.c
--- parse.c	20 Apr 2019 04:15:06 -0000	1.47
+++ parse.c	20 Apr 2019 15:40:43 -0000
@@ -120,6 +121,7 @@ static	const struct alias aliases[] = {
 	{ "structname",		NODE_TYPE },
 	{ "surname",		NODE_PERSONNAME },
 	{ "symbol",		NODE_CONSTANT },
+	{ "tag",		NODE_MARKUP },
 	{ "trademark",		NODE_IGNORE },
 	{ "ulink",		NODE_LINK },
        { "userinput",		NODE_LITERAL },
-- 
Stephen Gregoratto
PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-21 14:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-20 15:48 [PATCH docbook2mdoc] Add void, tag Stephen Gregoratto
2019-04-21 14:55 ` Ingo 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).