@reteps/tree-sitter-htmlmustache 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reteps/tree-sitter-htmlmustache",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "HTML with Mustache/Handlebars template syntax grammar for tree-sitter",
5
5
  "repository": {
6
6
  "type": "git",
package/src/parser.c CHANGED
@@ -10874,8 +10874,8 @@ TS_PUBLIC const TSLanguage *tree_sitter_htmlmustache(void) {
10874
10874
  .max_reserved_word_set_size = 0,
10875
10875
  .metadata = {
10876
10876
  .major_version = 0,
10877
- .minor_version = 0,
10878
- .patch_version = 2,
10877
+ .minor_version = 4,
10878
+ .patch_version = 1,
10879
10879
  },
10880
10880
  };
10881
10881
  return &language;
package/src/scanner.c CHANGED
@@ -386,6 +386,17 @@ static bool scan_end_tag_name(Scanner *scanner, TSLexer *lexer) {
386
386
 
387
387
  Tag tag = tag_for_name(tag_name);
388
388
  if (scanner->tags.size > 0 && tag_eq(array_back(&scanner->tags), &tag)) {
389
+ // Don't close HTML tags that were opened before the current mustache section.
390
+ // This prevents e.g. </div> inside {{#section}}...{{/section}} from closing
391
+ // an outer <div> that was opened before the section started.
392
+ if (scanner->mustache_tags.size > 0) {
393
+ MustacheTag *current_mustache_tag = array_back(&scanner->mustache_tags);
394
+ if (scanner->tags.size <= current_mustache_tag->html_tag_stack_size) {
395
+ lexer->result_symbol = HTML_ERRONEOUS_END_TAG_NAME;
396
+ tag_free(&tag);
397
+ return true;
398
+ }
399
+ }
389
400
  pop_html_tag(scanner);
390
401
  lexer->result_symbol = HTML_END_TAG_NAME;
391
402
  } else {
Binary file