Skip to content

fix: accept whitespace control on endraw and keep entities in escape_once - #999

Merged
harttle merged 2 commits into
harttle:masterfrom
zzoraemon043:fix/endraw-whitespace-escape-once
Nov 17, 2026
Merged

harttle merged 2 commits into
harttle:masterfrom
zzoraemon043:fix/endraw-whitespace-escape-once

Conversation

@zzoraemon043

Copy link
Copy Markdown
Contributor

Fixes items 1 and 2 of #995.

endraw whitespace control. {%- endraw %} and {% endraw-%} threw raw ... not closed: readEndrawOrRawContent read the - trim marker as part of the tag name. It now skips a leading - and ignores a trailing one, so every endraw form works like other tags. Trimming is unchanged: content inside raw is kept as is and -%} still trims what follows, same as Ruby Liquid.

escape_once. It unescaped only & < > " ' before escaping, so ",  , ©, — came out as " etc. It now uses the same rule as Shopify (&(?!([a-zA-Z]+|(#\d+));)): an & that starts a named or decimal entity is left alone, everything else is escaped as before.

Items 3 (numeric prefix in math filters) and 4 (split: "", overlaps #992) are left out.

Tests: 3 new cases, 2 fail before the change. npm run build, npm run lint pass. npm test: 1733 pass; the 16 failing date/strftime tests fail the same way on master on my machine (Windows locale month/weekday names).

{%- endraw %} and {% endraw-%} threw "raw ... not closed" because the
trim marker was read as part of the tag name.
Match Shopify Liquid, which only escapes & when it does not start an
&name; or &#digits; entity. Before, ",  , © and others
were escaped a second time.
@harttle
harttle merged commit 7058ec6 into harttle:master Nov 17, 2026
14 checks passed
@harttle

harttle commented Nov 17, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @zzoraemon043 for code

@allcontributors

Copy link
Copy Markdown
Contributor

@harttle

I've put up a pull request to add @zzoraemon043! 🎉

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.

2 participants