Skip to content

Make measurement and length parser more strict#2260

Merged
alerque merged 1 commit into
sile-typesetter:masterfrom
alerque:lengthification
Apr 8, 2025
Merged

Make measurement and length parser more strict#2260
alerque merged 1 commit into
sile-typesetter:masterfrom
alerque:lengthification

Conversation

@alerque

@alerque alerque commented Apr 8, 2025

Copy link
Copy Markdown
Member

Closes #2258

Accepting random amounts of garbage input after a successful match and calling it good might not have created any problems in most cases, but it does hoist the burden of validation on the end user when we could just as easily be verifying them.

This might cause errors in existing documents, but the input would also be legitimately bogus and should be expected to fail since the input may actually be incorrectly parsed. Just because we accepted 1ez minus 4pt plus 1gem before and silently made it into a length doesn't mean we did it right. The user should be expected to fix the units and order until it parses successfully, e.g. perhaps they meant 1em plus 4pt minus 1em (or maybe they meant en?).

@alerque alerque enabled auto-merge (squash) April 8, 2025 10:07
@alerque alerque disabled auto-merge April 8, 2025 10:07
@alerque alerque merged commit 4d33389 into sile-typesetter:master Apr 8, 2025
@alerque alerque deleted the lengthification branch April 8, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Length parser from string does not error on unknown units

1 participant