From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: Improve <link linkend="..."> formatting.
Date: Fri, 12 Apr 2019 05:35:18 -0500 (EST) [thread overview]
Message-ID: <e3fdb4d0edd29564@fantadrom.bsd.lv> (raw)
Log Message:
-----------
Improve <link linkend="..."> formatting.
Take markup of the content into account.
Do not break a partial implicit macro line, if one is open.
Do not let the parentheses extend too far.
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
Revision Data
-------------
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.108 -r1.109
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -573,24 +573,34 @@ pnode_printauthor(struct format *f, stru
static void
pnode_printlink(struct format *f, struct pnode *n)
{
+ struct pnode *nc;
const char *uri, *text;
uri = pnode_getattr_raw(n, ATTRKEY_LINKEND, NULL);
if (uri != NULL) {
if (TAILQ_FIRST(&n->childq) != NULL) {
- print_textnode(f, n);
+ TAILQ_FOREACH(nc, &n->childq, child)
+ pnode_print(f, nc);
text = "";
- } else {
- text = pnode_getattr_raw(n, ATTRKEY_ENDTERM, NULL);
- if (text != NULL)
+ } else if ((text = pnode_getattr_raw(n,
+ ATTRKEY_ENDTERM, NULL)) != NULL) {
+ if (f->linestate == LINE_MACRO && f->flags & FMT_ARG)
+ macro_addarg(f, text, ARG_SPACE);
+ else
print_text(f, text, ARG_SPACE);
}
if (text != NULL) {
- macro_open(f, "Pq");
- f->flags |= FMT_CHILD;
+ if (f->flags & FMT_IMPL)
+ macro_open(f, "Po");
+ else {
+ macro_open(f, "Pq");
+ f->flags |= FMT_CHILD;
+ }
}
macro_open(f, "Sx");
macro_addarg(f, uri, ARG_SPACE);
+ if (text != NULL && f->flags & FMT_IMPL)
+ macro_open(f, "Pc");
pnode_unlinksub(n);
return;
}
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
reply other threads:[~2019-04-12 10:35 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=e3fdb4d0edd29564@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).