tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv
Subject: Re: Bk -words badness
Date: Mon, 05 Jul 2010 12:35:10 +0200	[thread overview]
Message-ID: <4C31B55E.3030202@bsd.lv> (raw)
In-Reply-To: <4C31A369.6010005@bsd.lv>

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

> Ingo, how goes the `Bk' work?  Scanning through mandoc's rendering of
> current manuals, I see a lot of the following sort of breakage:
> 
> .Bk -words
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> .Op Fl a Ar b
> ...

The enclosed patch is a first stab at this.  It only works for explicit
`Bk -words' for now; it's trivial to extend this to SYNPRETTY.  As you
can see, it simply checks whether it's in a KEEP mode and resets to
PREKEEP if it's a line subsequent the prior node.

This fixes the badness mentioned above.

Thoughts?

Kristaps


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1106 bytes --]

? .foo.1.swp
? config.h
? config.log
? foo.1
? foo.1.html
? foo.3
? foo.7
? foo.html
? mandoc
? patch.txt
? relayd.8
? relayd.8.html
? spamd.8
? ssh.1
? ssh.1.html
? regress/output
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.171
diff -u -r1.171 mdoc_term.c
--- mdoc_term.c	4 Jul 2010 22:04:04 -0000	1.171
+++ mdoc_term.c	5 Jul 2010 10:36:57 -0000
@@ -330,6 +330,23 @@
 	else if (termacts[n->tok].pre && ENDBODY_NOT == n->end)
 		chld = (*termacts[n->tok].pre)(p, &npair, m, n);
 
+	/*
+	 * Keeps only work until the end of a line.  If a keep was
+	 * invoked in a prior line, revert it to PREKEEP.
+	 */
+
+	if (TERMP_KEEP & p->flags) {
+		if (n->prev && n->prev->line != n->line) {
+			p->flags &= ~TERMP_KEEP;
+			p->flags |= TERMP_PREKEEP;
+		} else if (NULL == n->prev) {
+			if (n->parent && n->parent->line != n->line) {
+				p->flags &= ~TERMP_KEEP;
+				p->flags |= TERMP_PREKEEP;
+			}
+		}
+	}
+
 	if (chld && n->child)
 		print_mdoc_nodelist(p, &npair, m, n->child);
 

  reply	other threads:[~2010-07-05 10:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-05  9:18 Kristaps Dzonsons
2010-07-05 10:35 ` Kristaps Dzonsons [this message]
2010-07-05 11:03   ` Kristaps Dzonsons
2010-07-05 22:09   ` Ingo Schwarze
2010-07-06  9:40     ` Kristaps Dzonsons
2010-07-06 22:30       ` Ingo Schwarze
2010-07-05 22:27 ` Ingo Schwarze

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=4C31B55E.3030202@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=tech@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).