fix(escapeAllSwigTags): check tag completeness#5395
fix(escapeAllSwigTags): check tag completeness#5395uiolee merged 3 commits intohexojs:masterfrom uiolee:escape
Conversation
How to testgit clone -b escape https://github.com/uiolee/hexo.git
cd hexo
npm install
npm test |
Pull Request Test Coverage Report for Build 7554903652
💛 - Coveralls |
lib/hexo/post.ts
Outdated
| state = STATE_SWIG_VAR; | ||
| idx++; | ||
| } else if (next_char === '#') { | ||
| } else if (next_char === '#' && /\{#.+?#\}/.test(str)) { |
There was a problem hiding this comment.
With the change, we will run regexp.test again and again for every character inside str.
The .test should be hoist to the top of the function.
There was a problem hiding this comment.
thanks, I have updated it
|
7.1 没有完全修复,解析下面代码会报错。7.0 反而解析正常。 Version 7.1 is not fully fixed; parsing the following code will result in an error. Surprisingly, parsing is normal in version 7.0 err log |
|
7.1版本不止上面这一个tag 报错,7.0反而正常 |
见 #5401,和换行有关 |
那个issue看过,找到这里来的 文章太多,不可能一个个tag修改过去, 只能先降级到7.0版本使用了。等待后面修复 |
What does it do?
Before escape tags, check if it contains a complete tag.
In others words, just escape complete tags.
Screenshots
Pull request tasks