summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-03-28 13:14:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-03-28 13:14:51 -0700
commita41f7f47743345ddff6aa7bc34720daca83ee006 (patch)
treea317d8899bfb1d203438960bae7e0224078a9c26
parentb71246fa13d1bf81bb7dce4dee4c6b40dcd0f120 (diff)
downloadman-a41f7f47743345ddff6aa7bc34720daca83ee006.tar.gz
man-a41f7f47743345ddff6aa7bc34720daca83ee006.tar.bz2
man-a41f7f47743345ddff6aa7bc34720daca83ee006.zip
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.
-rw-r--r--man2html/man2html.c7
1 files changed, 6 insertions, 1 deletions
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':
{