source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: keep together consecutive text nodes inside macro
@ 2019-04-23 21:10 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-23 21:10 UTC (permalink / raw)
  To: source

Log Message:
-----------
keep together consecutive text nodes inside macro arguments

Modified Files:
--------------
    docbook2mdoc:
        macro.c

Revision Data
-------------
Index: macro.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/macro.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lmacro.c -Lmacro.c -u -p -r1.14 -r1.15
--- macro.c
+++ macro.c
@@ -164,7 +164,7 @@ void
 macro_addnode(struct format *f, struct pnode *n, int flags)
 {
 	struct pnode	*nc;
-	int		 quote_now;
+	int		 is_text, quote_now;
 
 	assert(f->linestate == LINE_MACRO);
 
@@ -209,8 +209,14 @@ macro_addnode(struct format *f, struct p
 
 	while (nc != NULL) {
 		macro_addnode(f, nc, flags);
+		is_text = pnode_class(nc->node) == CLASS_TEXT;
 		nc = TAILQ_NEXT(nc, child);
-		flags |= ARG_SPACE;
+		if (nc == NULL || pnode_class(nc->node) != CLASS_TEXT)
+			is_text = 0;
+		if (is_text && !nc->spc)
+			flags &= ~ARG_SPACE;
+		else
+			flags |= ARG_SPACE;
 	}
 	if (quote_now)
 		putchar('"');
--
 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-23 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 21:10 docbook2mdoc: keep together consecutive text nodes inside macro 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).