summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--mdoc.73
-rw-r--r--mdoc_html.c20
-rw-r--r--mdoc_term.c20
4 files changed, 42 insertions, 4 deletions
diff --git a/TODO b/TODO
index 37c2e976..ce8f6769 100644
--- a/TODO
+++ b/TODO
@@ -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).
diff --git a/mdoc.7 b/mdoc.7
index 5ae18390..9e4fe6ce 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -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);