~sircmpwn/scdoc

1645e3c681d11d813a20294918af026b8810f023 — kst 3 months ago 97106f1
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
3 files changed, 18 insertions(+), 2 deletions(-)

M scdoc.5.scd
M src/main.c
M test/line-breaks
M scdoc.5.scd => scdoc.5.scd +1 -1
@@ 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.


M src/main.c => src/main.c +8 -1
@@ 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);

M test/line-breaks => test/line-breaks +9 -0
@@ 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