From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 0469ac00 for ; Tue, 23 Apr 2019 16:10:13 -0500 (EST) Date: Tue, 23 Apr 2019 16:10:13 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: docbook2mdoc: keep together consecutive text nodes inside macro X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: 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