* docbook2mdoc: Improve <link linkend="..."> formatting.
@ 2019-04-12 10:35 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-12 10:35 UTC (permalink / raw)
To: source
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-12 10:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 10:35 docbook2mdoc: Improve <link linkend="..."> formatting 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).