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
---
scdoc.5.scd | 2 +-
src/main.c | 9 ++++++++-
test/line-breaks | 9 +++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/scdoc.5.scd b/scdoc.5.scd
index f4d393b..b548b81 100644
--- a/scdoc.5.scd
+++ b/scdoc.5.scd
@@ -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.
diff --git a/src/main.c b/src/main.c
index 7bb6c42..8c5ffeb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);
diff --git a/test/line-breaks b/test/line-breaks
index c119bd9..83dc703 100755
--- a/test/line-breaks
+++ b/test/line-breaks
@@ -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
--
2.28.0