source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Make SYNOPSIS sections and code having .nr nS enabled behave as
Date: Sat, 11 Dec 2010 09:40:51 -0500 (EST)	[thread overview]
Message-ID: <201012111440.oBBEepjZ021481@krisdoz.my.domain> (raw)

Log Message:
-----------
Make SYNOPSIS sections and code having .nr nS enabled
behave as if the whole code were wrapped in .Bk/.Ek,
i.e. keeping input lines together on output lines.
This is compatible with new groff behaviour and deviates
from historical groff.
Tweaked version of a patch sent by kristaps@ on July 16, 2010.
ok kristaps@ jmc@ sobrado@ millert@

Modified Files:
--------------
    mdocml:
        mdoc_term.c

Revision Data
-------------
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.196
retrieving revision 1.197
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.196 -r1.197
--- mdoc_term.c
+++ mdoc_term.c
@@ -319,9 +319,12 @@ print_mdoc_node(DECL_ARGS)
 	/*
 	 * Keeps only work until the end of a line.  If a keep was
 	 * invoked in a prior line, revert it to PREKEEP.
+	 *
+	 * Also let SYNPRETTY sections behave as if they were wrapped
+	 * in a `Bk' block.
 	 */
 
-	if (TERMP_KEEP & p->flags) {
+	if (TERMP_KEEP & p->flags || MDOC_SYNPRETTY & n->flags) {
 		if (n->prev && n->prev->line != n->line) {
 			p->flags &= ~TERMP_KEEP;
 			p->flags |= TERMP_PREKEEP;
@@ -332,6 +335,16 @@ print_mdoc_node(DECL_ARGS)
 			}
 		}
 	}
+
+	/*
+	 * Since SYNPRETTY sections aren't "turned off" with `Ek',
+	 * we have to intuit whether we should disable formatting.
+	 */
+
+	if ( ! (MDOC_SYNPRETTY & n->flags) &&
+	    ((n->prev   && MDOC_SYNPRETTY & n->prev->flags) ||
+	     (n->parent && MDOC_SYNPRETTY & n->parent->flags)))
+		p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
 
 	if (chld && n->child)
 		print_mdoc_nodelist(p, &npair, m, n->child);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2010-12-11 14:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012111440.oBBEepjZ021481@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).