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 3bfd1e09 for ; Thu, 11 Apr 2019 23:17:42 -0500 (EST) Date: Thu, 11 Apr 2019 23:17:42 -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: Do not include literal linefeed characters in text nodes; X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- Do not include literal linefeed characters in text nodes; instead, let the parser split them into two text nodes. For now, let the formatter start text nodes preceded by whitespace on new output lines, which is a crude way of preserving input line breaks and making sure output text lines are limited to reasonable length. Modified Files: -------------- docbook2mdoc: docbook2mdoc.c parse.c Revision Data ------------- Index: parse.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v retrieving revision 1.32 retrieving revision 1.33 diff -Lparse.c -Lparse.c -u -p -r1.32 -r1.33 --- parse.c +++ parse.c @@ -972,9 +972,11 @@ parse_string(struct parse *p, char *b, s } else { advance(p, b, rlen, &pend, - p->ncur == NODE_DOCTYPE ? "<&]" : "<&", + p->ncur == NODE_DOCTYPE ? "<&]\n" : "<&\n", refill); xml_char(p, b + poff, pend - poff); + if (b[pend] == '\n') + pnode_closetext(p); } } return poff; Index: docbook2mdoc.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v retrieving revision 1.104 retrieving revision 1.105 diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.104 -r1.105 --- docbook2mdoc.c +++ docbook2mdoc.c @@ -81,8 +81,14 @@ pnode_printtext(struct format *f, struct switch (f->linestate) { case LINE_TEXT: - if (n->spc) + if (n->spc) { + if (n->node == NODE_TEXT) { + putchar('\n'); + last = '\n'; + break; + } putchar(' '); + } last = ' '; break; case LINE_MACRO: -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv