-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#2172) This adds support for `:` as punctuation and removes the `.` from the list of allowed characters in the `variable` pattern as it is impossible to match because of the `punctuation` pattern.
- Loading branch information
1 parent
543f04d
commit ef4d29d
Showing
6 changed files
with
347 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
273 changes: 273 additions & 0 deletions
273
tests/languages/handlebars/handlebars_in_html_feature.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
{{aUserModel.name}} | ||
<div>{{listOfUsers.firstObject.name}}</div> | ||
{{if name "I have a name" "I have no name"}} | ||
<span data-has-name={{if name true}}></span> | ||
<div {{on "click" this.hello}} /> | ||
---------------------------------------------------- | ||
|
||
[ | ||
[ | ||
"handlebars", | ||
[ | ||
[ | ||
"delimiter", | ||
"{{" | ||
], | ||
[ | ||
"variable", | ||
"aUserModel" | ||
], | ||
[ | ||
"punctuation", | ||
"." | ||
], | ||
[ | ||
"variable", | ||
"name" | ||
], | ||
[ | ||
"delimiter", | ||
"}}" | ||
] | ||
] | ||
], | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"punctuation", | ||
"<" | ||
], | ||
"div" | ||
] | ||
], | ||
[ | ||
"punctuation", | ||
">" | ||
] | ||
] | ||
], | ||
[ | ||
"handlebars", | ||
[ | ||
[ | ||
"delimiter", | ||
"{{" | ||
], | ||
[ | ||
"variable", | ||
"listOfUsers" | ||
], | ||
[ | ||
"punctuation", | ||
"." | ||
], | ||
[ | ||
"variable", | ||
"firstObject" | ||
], | ||
[ | ||
"punctuation", | ||
"." | ||
], | ||
[ | ||
"variable", | ||
"name" | ||
], | ||
[ | ||
"delimiter", | ||
"}}" | ||
] | ||
] | ||
], | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"punctuation", | ||
"</" | ||
], | ||
"div" | ||
] | ||
], | ||
[ | ||
"punctuation", | ||
">" | ||
] | ||
] | ||
], | ||
[ | ||
"handlebars", | ||
[ | ||
[ | ||
"delimiter", | ||
"{{" | ||
], | ||
[ | ||
"variable", | ||
"if" | ||
], | ||
[ | ||
"variable", | ||
"name" | ||
], | ||
[ | ||
"string", | ||
"\"I have a name\"" | ||
], | ||
[ | ||
"string", | ||
"\"I have no name\"" | ||
], | ||
[ | ||
"delimiter", | ||
"}}" | ||
] | ||
] | ||
], | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"punctuation", | ||
"<" | ||
], | ||
"span" | ||
] | ||
], | ||
[ | ||
"attr-name", | ||
[ | ||
"data-has-name" | ||
] | ||
], | ||
[ | ||
"attr-value", | ||
[ | ||
[ | ||
"punctuation", | ||
"=" | ||
], | ||
[ | ||
"handlebars", | ||
[ | ||
[ | ||
"delimiter", | ||
"{{" | ||
], | ||
[ | ||
"variable", | ||
"if" | ||
], | ||
[ | ||
"variable", | ||
"name" | ||
], | ||
[ | ||
"boolean", | ||
"true" | ||
], | ||
[ | ||
"delimiter", | ||
"}}" | ||
] | ||
] | ||
] | ||
] | ||
], | ||
[ | ||
"punctuation", | ||
">" | ||
] | ||
] | ||
], | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"punctuation", | ||
"</" | ||
], | ||
"span" | ||
] | ||
], | ||
[ | ||
"punctuation", | ||
">" | ||
] | ||
] | ||
], | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"tag", | ||
[ | ||
[ | ||
"punctuation", | ||
"<" | ||
], | ||
"div" | ||
] | ||
], | ||
[ | ||
"attr-name", | ||
[ | ||
[ | ||
"handlebars", | ||
[ | ||
[ | ||
"delimiter", | ||
"{{" | ||
], | ||
[ | ||
"variable", | ||
"on" | ||
], | ||
[ | ||
"string", | ||
"\"click\"" | ||
], | ||
[ | ||
"variable", | ||
"this" | ||
], | ||
[ | ||
"punctuation", | ||
"." | ||
], | ||
[ | ||
"variable", | ||
"hello" | ||
], | ||
[ | ||
"delimiter", | ||
"}}" | ||
] | ||
] | ||
] | ||
] | ||
], | ||
[ | ||
"punctuation", | ||
"/>" | ||
] | ||
] | ||
] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for handlebars filter in Html. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{~#if isActive~}}{{~/if~}} | ||
{{:slot-name}} | ||
---------------------------------------------------- | ||
|
||
[ | ||
["handlebars", [ | ||
["delimiter", "{{"], | ||
["punctuation", "~"], | ||
["block", "#if"], | ||
["variable", "isActive"], | ||
["punctuation", "~"], | ||
["delimiter", "}}"] | ||
]], | ||
["handlebars", [ | ||
["delimiter", "{{"], | ||
["punctuation", "~"], | ||
["block", "/if"], | ||
["punctuation", "~"], | ||
["delimiter", "}}"] | ||
]], | ||
["handlebars", [ | ||
["delimiter", "{{"], | ||
["punctuation", ":"], | ||
["variable", "slot-name"], | ||
["delimiter", "}}"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for punctuation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{comments}} | ||
{{@comments}} | ||
{{this.comments}} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["handlebars",[ | ||
["delimiter","{{"],["variable","comments"],["delimiter","}}"]] | ||
], | ||
["handlebars",[ | ||
["delimiter","{{"],["punctuation","@"],["variable","comments"],["delimiter","}}"]] | ||
], | ||
["handlebars",[ | ||
["delimiter","{{"],["variable","this"],["punctuation","."],["variable","comments"],["delimiter","}}"]] | ||
] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for variable. |