source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Suppress whitespace following Pp, Lp, sp, and the other
@ 2010-09-27 11:21 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-09-27 11:21 UTC (permalink / raw)
  To: source

Log Message:
-----------
Suppress whitespace following Pp, Lp, sp, and the other newline-emitting
macros within an unfilled or literal `Bd'.

Modified Files:
--------------
    mdocml:
        TODO
        mdoc.7
        mdoc_html.c
        mdoc_term.c

Revision Data
-------------
Index: TODO
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/TODO,v
retrieving revision 1.54
retrieving revision 1.55
diff -LTODO -LTODO -u -p -r1.54 -r1.55
--- TODO
+++ 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).
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.107 -r1.108
--- mdoc_html.c
+++ 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");
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.189 -r1.190
--- mdoc_term.c
+++ 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);
Index: mdoc.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.7,v
retrieving revision 1.160
retrieving revision 1.161
diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.160 -r1.161
--- mdoc.7
+++ 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
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-27 11:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-27 11:21 mdocml: Suppress whitespace following Pp, Lp, sp, and the other kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).