help / color / mirror / Atom feed
* Option to disable sentence spacing in tty output?
@ 2020-08-13 22:12 k.st
  2020-08-13 23:22 ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: k.st @ 2020-08-13 22:12 UTC (permalink / raw)
  To: discuss

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-14  3:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 22:12 Option to disable sentence spacing in tty output? k.st
2020-08-13 23:22 ` Ingo Schwarze
2020-08-14  3:50   ` k.st

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