diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-09-27 11:21:39 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-09-27 11:21:39 +0000 |
commit | 3c5734925c52ae38922a5f660600de0e47c5d4c2 (patch) | |
tree | dcbc18d3456f94b3f6b0277be23116b7a8351fbb | |
parent | 8dd3b9f7294348a23cb6fb0fbc2bd134814f554f (diff) | |
download | mandoc-3c5734925c52ae38922a5f660600de0e47c5d4c2.tar.gz |
Suppress whitespace following Pp, Lp, sp, and the other newline-emitting
macros within an unfilled or literal `Bd'.
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | mdoc.7 | 3 | ||||
-rw-r--r-- | mdoc_html.c | 20 | ||||
-rw-r--r-- | mdoc_term.c | 20 |
4 files changed, 42 insertions, 4 deletions
@@ -134,9 +134,6 @@ In -unfilled, tabs are 5 spaces, just like in -filled and -ragged. See the CCDF_* display in OpenBSD ccdconfig(8). -- In .Bd -unfilled, .Pp should produce one blank line, not two; - see the ccd.conf display in OpenBSD ccdconfig(8). - - .Nx 1.0a should be "NetBSD 1.0A", not "NetBSD 1.0a", see OpenBSD ccdconfig(8). @@ -1076,7 +1076,8 @@ implementations render it poorly. Left- and right-justify the block. .It Fl literal Do not justify the block at all. -Preserve white space as it appears in the input. +Preserve white space and newlines as they appear in the input, including +if it follows a macro. .It Fl ragged Only left-justify the block. .It Fl unfilled diff --git a/mdoc_html.c b/mdoc_html.c index dc5ced4b..d9e84547 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1316,6 +1316,26 @@ mdoc_bd_pre(MDOC_ARGS) for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(m, nn, h); + /* + * If the printed node flushes its own line, then we + * needn't do it here as well. This is hacky, but the + * notion of selective eoln whitespace is pretty dumb + * anyway, so don't sweat it. + */ + switch (nn->tok) { + case (MDOC_br): + /* FALLTHROUGH */ + case (MDOC_sp): + /* FALLTHROUGH */ + case (MDOC_Bl): + /* FALLTHROUGH */ + case (MDOC_Lp): + /* FALLTHROUGH */ + case (MDOC_Pp): + continue; + default: + break; + } if (nn->next && nn->next->line == nn->line) continue; print_text(h, "\n"); diff --git a/mdoc_term.c b/mdoc_term.c index c04587eb..9acd6f06 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1578,6 +1578,26 @@ termp_bd_pre(DECL_ARGS) for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(p, pair, m, nn); + /* + * If the printed node flushes its own line, then we + * needn't do it here as well. This is hacky, but the + * notion of selective eoln whitespace is pretty dumb + * anyway, so don't sweat it. + */ + switch (nn->tok) { + case (MDOC_br): + /* FALLTHROUGH */ + case (MDOC_sp): + /* FALLTHROUGH */ + case (MDOC_Bl): + /* FALLTHROUGH */ + case (MDOC_Lp): + /* FALLTHROUGH */ + case (MDOC_Pp): + continue; + default: + break; + } if (nn->next && nn->next->line == nn->line) continue; term_flushln(p); |