From a41f7f47743345ddff6aa7bc34720daca83ee006 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 28 Mar 2021 13:14:51 -0700 Subject: Preserve empty lines in preformatted blocks. When emitting a newline, if we are in no fill mode, we look ahead. If there is another newline, we emit that also. We don't preserve more than one extra newline. This "surgically" fixes the problem of missing separating lines in the code examplews in the TXR man page. --- man2html/man2html.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/man2html/man2html.c b/man2html/man2html.c index f400ed8..825680b 100644 --- a/man2html/man2html.c +++ b/man2html/man2html.c @@ -3091,8 +3091,13 @@ scan_troff(char *c, int san, char **result) { /* san : stop at newline */ contained_tab=0; curpos=0; usenbsp=0; - if ((ibp > 0 && !isspace(intbuff[ibp-1])) || escnl) + if ((ibp > 0 && !isspace(intbuff[ibp-1])) || escnl) { intbuff[ibp++]='\n'; + if (!fillout && h[1] == '\n') { + intbuff[ibp++]='\n'; + h++; + } + } break; case '\t': { -- cgit v1.2.3