Skip to content

Commit

Permalink
fix: check tag completeness
Browse files Browse the repository at this point in the history
  • Loading branch information
uiolee committed Jan 14, 2024
1 parent 6a91fb6 commit dfe0d03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/hexo/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ class PostRenderEscape {

if (state === STATE_PLAINTEXT) { // From plain text to swig
if (char === '{') {
if (next_char === '{') {
// check if it is a complete tag {{ }}
if (next_char === '{' && /\{\{.+?\}\}/.test(str)) {
state = STATE_SWIG_VAR;
idx++;
} else if (next_char === '#') {
} else if (next_char === '#' && /\{#.+?#\}/.test(str)) {
state = STATE_SWIG_COMMENT;
idx++;
} else if (next_char === '%') {
} else if (next_char === '%' && /\{%.+?%\}/.test(str)) {
state = STATE_SWIG_TAG;
idx++;
swig_tag_name = '';
Expand Down

0 comments on commit dfe0d03

Please sign in to comment.