source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Trailing \c suppresses the output line break even if  the next
@ 2017-05-09 14:10 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-05-09 14:10 UTC (permalink / raw)
  To: source

Log Message:
-----------
Trailing \c suppresses the output line break even if 
the next line is a text line starting with whitespace.
Quirk found in the sysutils/rancid port.

Modified Files:
--------------
    mdocml:
        man_html.c
        man_term.c
        mdoc_html.c
        mdoc_term.c

Revision Data
-------------
Index: man_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_term.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -Lman_term.c -Lman_term.c -u -p -r1.199 -r1.200
--- man_term.c
+++ man_term.c
@@ -873,10 +873,11 @@ print_man_node(DECL_ARGS)
 		 * If we have a space as the first character, break
 		 * before printing the line's data.
 		 */
-		if ('\0' == *n->string) {
+		if (*n->string == '\0') {
 			term_vspace(p);
 			return;
-		} else if (' ' == *n->string && NODE_LINE & n->flags)
+		} else if (*n->string == ' ' && n->flags & NODE_LINE &&
+		    (p->flags & TERMP_NONEWLINE) == 0)
 			term_newln(p);
 
 		term_word(p, n->string);
Index: man_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_html.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -Lman_html.c -Lman_html.c -u -p -r1.141 -r1.142
--- man_html.c
+++ man_html.c
@@ -251,7 +251,8 @@ print_man_node(MAN_ARGS)
 	case ROFFT_TEXT:
 		if (fillmode(h, want_fillmode) == MAN_fi &&
 		    want_fillmode == MAN_fi &&
-		    n->flags & NODE_LINE && *n->string == ' ')
+		    n->flags & NODE_LINE && *n->string == ' ' &&
+		    (h->flags & HTML_NONEWLINE) == 0)
 			print_otag(h, TAG_BR, "");
 		if (*n->string != '\0')
 			break;
Index: mdoc_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v
retrieving revision 1.356
retrieving revision 1.357
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.356 -r1.357
--- mdoc_term.c
+++ mdoc_term.c
@@ -342,7 +342,8 @@ print_mdoc_node(DECL_ARGS)
 
 	switch (n->type) {
 	case ROFFT_TEXT:
-		if (' ' == *n->string && NODE_LINE & n->flags)
+		if (*n->string == ' ' && n->flags & NODE_LINE &&
+		    (p->flags & TERMP_NONEWLINE) == 0)
 			term_newln(p);
 		if (NODE_DELIMC & n->flags)
 			p->flags |= TERMP_NOSPACE;
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.285
retrieving revision 1.286
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.285 -r1.286
--- mdoc_html.c
+++ mdoc_html.c
@@ -359,9 +359,9 @@ print_mdoc_node(MDOC_ARGS)
 		 * Make sure that if we're in a literal mode already
 		 * (i.e., within a <PRE>) don't print the newline.
 		 */
-		if (' ' == *n->string && NODE_LINE & n->flags)
-			if ( ! (HTML_LITERAL & h->flags))
-				print_otag(h, TAG_BR, "");
+		if (*n->string == ' ' && n->flags & NODE_LINE &&
+		    (h->flags & (HTML_LITERAL | HTML_NONEWLINE)) == 0)
+			print_otag(h, TAG_BR, "");
 		if (NODE_DELIMC & n->flags)
 			h->flags |= HTML_NOSPACE;
 		print_text(h, n->string);
--
 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:[~2017-05-09 14:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 14:10 mdocml: Trailing \c suppresses the output line break even if the next schwarze

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).