help / color / mirror / Atom feed
From: "k.st" <o@krj.st>
To: <discuss@mandoc.bsd.lv>
Subject: Option to disable sentence spacing in tty output?
Date: Thu, 13 Aug 2020 22:12:44 +0000	[thread overview]
Message-ID: <C4W7PRAXX6VJ.2ONUP0D5K7A4K@szk> (raw)

Hi Ingo,

Is there currently an option in mandoc to disable sentence spacing, i.e.
2 spaces after end-of-sentence character, in tty outputs?

I noticed that many man page authors either do not follow semantic
line-breaking or convert man pages from other formats such as asciidoc,
pandoc, and scdoc. All of them has some problems handling sentence
spaces and lead to inconsistent spacing in man pages.

For example, in git-push(1),

     Remove remote branches that don’t have a local counterpart. For
     example a remote branch tmp will be removed if a local branch with
     the same name doesn’t exist any more. This also respects refspecs,
     e.g.  git push --prune remote refs/heads/*:refs/tmp/* would make
     sure that remote refs/tmp/foo will be removed if refs/heads/foo
     doesn’t exist.

it uses 1 space after period, but 2 spaces after 'e.g.'. Git uses
asciidoc to convert man pages, which does not handle sentence spacing
very well.

Since sentence spacing can lead to inconsistent spacings, I think it is
reasonable to have an option to disable sentence spacing entirely and
let user choose which convention to use.

groff uses `.ss` request to control it, but in mandoc this seems to be
hardcoded in `term.c`:

    if ((p->flags & TERMP_NOSPACE) == 0) {
      if ((p->flags & TERMP_KEEP) == 0) {
        bufferc(p, ' ');
        if (p->flags & TERMP_SENTENCE)
          bufferc(p, ' ');
      } else
        bufferc(p, ASCII_NBRSP);

We essentially only need to add a check before printing the second
space. Since mandoc deals with man pages only, maybe it would make sense
to implement this as a command-line argument, similar to --nj and --nh
flags from man-db's man(1)?

 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

             reply	other threads:[~2020-08-13 22:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13 22:12 k.st [this message]
2020-08-13 23:22 ` Ingo Schwarze
2020-08-14  3:50   ` k.st

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:

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

  git send-email \
    --in-reply-to=C4W7PRAXX6VJ.2ONUP0D5K7A4K@szk \
    --to=o@krj.st \
    --cc=discuss@mandoc.bsd.lv \


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