Suppress sentence spacing after end-of-sentence characters.

This should fix the inconsistent spacing issue mentioned in [1]. I also
fixed a spacing in issue in the man page.

[1]: https://lists.sr.ht/~sircmpwn/public-inbox/%3CC4VKFSIFINOA.X6VCIU2AV88M%40szk%3E
master
kst 4 years ago committed by Drew DeVault
parent 97106f1a1a
commit 1645e3c681
  1. 2
      scdoc.5.scd
  2. 9
      src/main.c
  3. 9
      test/line-breaks

@ -120,7 +120,7 @@ To begin a table, add an empty line followed by any number of rows.
Each line of a table should start with | or : to start a new row or column
respectively (or space to continue the previous cell on multiple lines),
followed by [ or - or ] to align the contents to the left, center, or right,
followed by a space and the contents of that cell. You may use a space instead
followed by a space and the contents of that cell. You may use a space instead
of an alignment specifier to inherit the alignment of the same column in the
previous row.

@ -241,10 +241,17 @@ static void parse_text(struct parser *p) {
case '.':
if (!i) {
// Escape . if it's the first character
fprintf(p->output, "\\&.");
fprintf(p->output, "\\&.\\&");
break;
}
/* fallthrough */
case '!':
case '?':
last = ch;
utf8_fputch(p->output, ch);
// Suppress sentence spacing
fprintf(p->output, "\\&");
break;
default:
last = ch;
utf8_fputch(p->output, ch);

@ -44,3 +44,12 @@ hello++
_world_
EOF
end 0
begin "Suppresses sentence spacing"
scdoc <<EOF | grep 'hel!\\&lo.\\&' >/dev/null
test(8)
hel!lo.
world.
EOF
end 0

Loading…
Cancel
Save