source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: Minimal translation of <xref> to .Sx.
@ 2019-04-15 19:15 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-15 19:15 UTC (permalink / raw)
  To: source

Log Message:
-----------
Minimal translation of <xref> to .Sx.
This might need refinement in the future, but that won't be easy because
the element is horribly underspecified and the usage is practice is very
inconsistent.

Modified Files:
--------------
    docbook2mdoc:
        docbook2mdoc.c
        node.c
        node.h

Revision Data
-------------
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.128 -r1.129
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -625,6 +625,18 @@ pnode_printauthor(struct format *f, stru
 }
 
 static void
+pnode_printxref(struct format *f, struct pnode *n)
+{
+	const char	*linkend;
+
+	linkend = pnode_getattr_raw(n, ATTRKEY_LINKEND, NULL);
+	if (linkend != NULL) {
+		macro_open(f, "Sx");
+		macro_addarg(f, linkend, ARG_SPACE);
+	}
+}
+
+static void
 pnode_printlink(struct format *f, struct pnode *n)
 {
 	struct pnode	*nc;
@@ -1320,6 +1332,9 @@ pnode_print(struct format *f, struct pno
 		break;
 	case NODE_VARNAME:
 		macro_open(f, "Va");
+		break;
+	case NODE_XREF:
+		pnode_printxref(f, n);
 		break;
 	default:
 		break;
Index: node.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lnode.c -Lnode.c -u -p -r1.19 -r1.20
--- node.c
+++ node.c
@@ -144,6 +144,7 @@ static	const struct nodeprop properties[
 	{ "varname",		CLASS_LINE },
 	{ "warning",		CLASS_BLOCK },
 	{ "wordasword",		CLASS_TRANS },
+	{ "xref",		CLASS_LINE },
 	{ "[UNKNOWN]",		CLASS_VOID },
 	{ "(t)",		CLASS_TEXT },
 	{ "(e)",		CLASS_TEXT }
Index: node.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -Lnode.h -Lnode.h -u -p -r1.28 -r1.29
--- node.h
+++ node.h
@@ -152,6 +152,7 @@ enum	nodeid {
 	NODE_VARNAME,
 	NODE_WARNING,
 	NODE_WORDASWORD,
+	NODE_XREF,
 	NODE_UNKNOWN,
 	NODE_TEXT,
 	NODE_ESCAPE,
--
 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-15 19:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15 19:15 docbook2mdoc: Minimal translation of <xref> to .Sx 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).