Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(escapeAllSwigTags): Prevent swig tag prefix collision during esca… #5636

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zombie12138
Copy link

@zombie12138 zombie12138 commented Feb 23, 2025

What does it do?

fix bug in #5635

When a non-block Swig tag (Tag A) shares a prefix for a block-level tag (Tag B), such as non-block ref tag and block-level references tag, escapeAllSwigTags will mistakenly identify tag A (ref in my case) as a block-level tag, and escape all content between {% tag %} and {% endreferences %}, leading to unrendered content.

This pull request resolves this case by implementing a block tag registry table. This methodology achieves maximum precision, but it introduces increased code coupling as an implementation trade-off.

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

Copy link

How to test

git clone -b hotfix/swig-tag-conflict https://github.com/zombie12138/hexo.git
cd hexo
npm install
npm test

@zombie12138 zombie12138 force-pushed the hotfix/swig-tag-conflict branch from 9d0b5e9 to 5483a3b Compare February 23, 2025 16:37
@D-Sketon D-Sketon linked an issue Feb 24, 2025 that may be closed by this pull request
5 tasks
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13484923714

Details

  • 17 of 17 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 99.463%

Totals Coverage Status
Change from base Build 13299585829: 0.001%
Covered Lines: 9811
Relevant Lines: 9864

💛 - Coveralls

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.

Markdown text is escaped when two tags share the same prefix.
2 participants