Skip to content

Commit

Permalink
Merge pull request #15 from elianiva/fix/whitespace
Browse files Browse the repository at this point in the history
fix: don't capture whitespace as text node
  • Loading branch information
Himujjal authored Jul 14, 2021
2 parents 10c1130 + a23065e commit d8c7ef9
Show file tree
Hide file tree
Showing 4 changed files with 1,721 additions and 1,706 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module.exports = grammar({
seq('"', optional(alias(/[^"]+/, $.attribute_value)), '"')
),

_text: ($) => choice(alias(/[^<>{}]+/, $.text), $._expression),
_text: ($) => choice(alias(/[^<>\s]([^<>]*[^<>\s])?/, $.text), $._expression),

_expression: ($) =>
choice($.expression, $.html_expr, alias("{}", $.expression)),
Expand Down
2 changes: 1 addition & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "[^<>{}]+"
"value": "[^<>\\s]([^<>]*[^<>\\s])?"
},
"named": true,
"value": "text"
Expand Down
Loading

0 comments on commit d8c7ef9

Please sign in to comment.