source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Bring `sp', `Sp', and `br' behaviour for -man in line with how
Date: Thu, 22 Jul 2010 09:47:50 -0400 (EDT)	[thread overview]
Message-ID: <201007221347.o6MDlo9J017920@krisdoz.my.domain> (raw)

Log Message:
-----------
Bring `sp', `Sp', and `br' behaviour for -man in line with how -mdoc's
is handled: correctly.  This removes superfluous line breaks in many
-man manuals.

Modified Files:
--------------
    mdocml:
        man_term.c

Revision Data
-------------
Index: man_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -Lman_term.c -Lman_term.c -u -p -r1.81 -r1.82
--- man_term.c
+++ man_term.c
@@ -92,7 +92,6 @@ static	int		  pre_RS(DECL_ARGS);
 static	int		  pre_SH(DECL_ARGS);
 static	int		  pre_SS(DECL_ARGS);
 static	int		  pre_TP(DECL_ARGS);
-static	int		  pre_br(DECL_ARGS);
 static	int		  pre_fi(DECL_ARGS);
 static	int		  pre_ign(DECL_ARGS);
 static	int		  pre_nf(DECL_ARGS);
@@ -106,7 +105,7 @@ static	void		  post_SS(DECL_ARGS);
 static	void		  post_TP(DECL_ARGS);
 
 static	const struct termact termacts[MAN_MAX] = {
-	{ pre_br, NULL, MAN_NOTEXT }, /* br */
+	{ pre_sp, NULL, MAN_NOTEXT }, /* br */
 	{ NULL, NULL, 0 }, /* TH */
 	{ pre_SH, post_SH, 0 }, /* SH */
 	{ pre_SS, post_SS, 0 }, /* SS */
@@ -359,24 +358,20 @@ pre_sp(DECL_ARGS)
 {
 	size_t		 i, len;
 
-	len = n->child ? 
-		a2height(p, n->child->string) : term_len(p, 1);
+	switch (n->tok) {
+	case (MAN_br):
+		len = 0;
+		break;
+	default:
+		len = n->child ? a2height(p, n->child->string) : 1;
+		break;
+	}
 
 	if (0 == len)
 		term_newln(p);
-	for (i = 0; i <= len; i++)
+	for (i = 0; i < len; i++)
 		term_vspace(p);
 
-	return(0);
-}
-
-
-/* ARGSUSED */
-static int
-pre_br(DECL_ARGS)
-{
-
-	term_newln(p);
 	return(0);
 }
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2010-07-22 13:47 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=201007221347.o6MDlo9J017920@krisdoz.my.domain \
    --to=kristaps@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).