source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: Minimal translation of <xref> to .Sx.
Date: Mon, 15 Apr 2019 14:15:49 -0500 (EST)	[thread overview]
Message-ID: <e3fde28a567fcd09@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2019-04-15 19:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3fde28a567fcd09@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).