-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(handlebars) support for segment-literals and escaped mustaches #2184
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8de9f8f
fix(Handlebars): add support for literal-segments in expressions
nknapp 0eea32e
fix(handlebars): remove intro
nknapp dc288bd
fix(handlebars): change EXPRESSION to be a variable
nknapp 5acf050
fix(handlebars): add some missing semicolons
nknapp a2c5585
fixup: make IDENTIFIER_PLAIN_OR_QUOTED pattern more readable
nknapp 2eb615e
fix(handlebars): support for escaped mustaches
nknapp e50a4ca
fix(handlebars): support for escaped backslashes in front of a mustache
nknapp c477523
fix(handlebars): add test for escaping comments
nknapp 264e0cd
fix(handlebars): extract variables for more understandability
nknapp 23dcb37
fix(handlebars): escape curly braces in all regex
nknapp 671e3c9
fix(handlebars): re-inline rules
nknapp 75327a1
fix(handlebars): re-add "yield" keyword
nknapp File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
9 changes: 9 additions & 0 deletions
9
test/markup/handlebars/block-expression-variants-as-path-segment.expect.txt
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,9 @@ | ||
<span class="xml">text </span><span class="hljs-template-tag">{{#<span class="hljs-name">abc</span> abcd.[lite"'ral}}segment] }}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">abc</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">abc</span> abcd."lite]'ral}}segment" }}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">abc</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">abc</span> abcd.'lite]"ral}}segment' }}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">abc</span>}}</span><span class="xml"> | ||
|
||
text | ||
|
||
</span> |
8 changes: 8 additions & 0 deletions
8
test/markup/handlebars/block-expression-variants-as-path-segment.txt
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,8 @@ | ||
text {{#abc abcd.[lite"'ral}}segment] }}a{{/abc}} | ||
|
||
text {{#abc abcd."lite]'ral}}segment" }}a{{/abc}} | ||
|
||
text {{#abc abcd.'lite]"ral}}segment' }}a{{/abc}} | ||
|
||
text | ||
|
14 changes: 14 additions & 0 deletions
14
test/markup/handlebars/block-expression-variants-in-helper-name.expect.txt
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,14 @@ | ||
<span class="xml">text </span><span class="hljs-template-tag">{{#<span class="hljs-name">[ab}}c]</span> param }}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">[ab}}c]</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">'ab}}c'</span> param}}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">'ab}}c'</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">"ab}}c"</span> param}}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">"ab}}c"</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">""</span> param}}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">""</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">''</span> param}}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">''</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">[]</span> param}}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">[]</span>}}</span><span class="xml"> | ||
|
||
text | ||
</span> |
13 changes: 13 additions & 0 deletions
13
test/markup/handlebars/block-expression-variants-in-helper-name.txt
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,13 @@ | ||
text {{#[ab}}c] param }}a{{/[ab}}c]}} | ||
|
||
text {{#'ab}}c' param}}a{{/'ab}}c'}} | ||
|
||
text {{#"ab}}c" param}}a{{/"ab}}c"}} | ||
|
||
text {{#"" param}}a{{/""}} | ||
|
||
text {{#'' param}}a{{/''}} | ||
|
||
text {{#[] param}}a{{/[]}} | ||
|
||
text |
8 changes: 8 additions & 0 deletions
8
test/markup/handlebars/block-expression-variants-in-param.expect.txt
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,8 @@ | ||
<span class="xml">text </span><span class="hljs-template-tag">{{#<span class="hljs-name">abc</span> "lite]'ral}}segment" }}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">abc</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">abc</span> 'lite]"ral}}segment' }}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">abc</span>}}</span><span class="xml"> | ||
|
||
text </span><span class="hljs-template-tag">{{#<span class="hljs-name">abc</span> [lite"'ral}}segment] }}</span><span class="xml">a</span><span class="hljs-template-tag">{{/<span class="hljs-name">abc</span>}}</span><span class="xml"> | ||
|
||
text | ||
</span> |
7 changes: 7 additions & 0 deletions
7
test/markup/handlebars/block-expression-variants-in-param.txt
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,7 @@ | ||
text {{#abc "lite]'ral}}segment" }}a{{/abc}} | ||
|
||
text {{#abc 'lite]"ral}}segment' }}a{{/abc}} | ||
|
||
text {{#abc [lite"'ral}}segment] }}a{{/abc}} | ||
|
||
text |
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,22 @@ | ||
<span class="xml">\{{no-expression}} | ||
|
||
\{{{no-expression}}} | ||
|
||
\{{#no}} block \{{/no}} | ||
|
||
\{{\{{no}}}} block \{{\{{/no}}}} | ||
|
||
\{{!-- no comment --}} | ||
|
||
\{{! no comment }} | ||
|
||
<span class="hljs-comment"><!-- escaped escapings --></span> | ||
|
||
\\</span><span class="hljs-template-variable">{{expression}}</span><span class="xml"> | ||
|
||
\\\</span><span class="hljs-template-variable">{{expression}}</span><span class="xml"> | ||
|
||
\\\\</span><span class="hljs-template-variable">{{expression}}</span><span class="xml"> | ||
|
||
\\\</span><span class="hljs-comment">{{! comment }}</span><span class="xml"> | ||
</span> |
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 @@ | ||
\{{no-expression}} | ||
|
||
\{{{no-expression}}} | ||
|
||
\{{#no}} block \{{/no}} | ||
|
||
\{{\{{no}}}} block \{{\{{/no}}}} | ||
|
||
\{{!-- no comment --}} | ||
|
||
\{{! no comment }} | ||
|
||
<!-- escaped escapings --> | ||
|
||
\\{{expression}} | ||
|
||
\\\{{expression}} | ||
|
||
\\\\{{expression}} | ||
|
||
\\\{{! comment }} |
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,27 @@ | ||
<span class="xml">text | ||
|
||
</span><span class="hljs-template-variable">{{ "lite]'ral}}segment" }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ 'lite]"ral}}segment' }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ [lite"'ral}}segment] }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abc "lite]'ral}}segment" }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abc 'lite]"ral}}segment' }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abc [lite"'ral}}segment] }}</span><span class="xml"> text | ||
|
||
|
||
</span><span class="hljs-template-variable">{{ abcd.[lite"'ral}}segment] }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abcd."lite]'ral}}segment" }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abcd.'lite]"ral}}segment' }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abcd.''}}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abcd."" }}</span><span class="xml"> text | ||
|
||
</span><span class="hljs-template-variable">{{ abcd.[] }}</span><span class="xml"> text | ||
</span> |
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,26 @@ | ||
text | ||
|
||
{{ "lite]'ral}}segment" }} text | ||
|
||
{{ 'lite]"ral}}segment' }} text | ||
|
||
{{ [lite"'ral}}segment] }} text | ||
|
||
{{ abc "lite]'ral}}segment" }} text | ||
|
||
{{ abc 'lite]"ral}}segment' }} text | ||
|
||
{{ abc [lite"'ral}}segment] }} text | ||
|
||
|
||
{{ abcd.[lite"'ral}}segment] }} text | ||
|
||
{{ abcd."lite]'ral}}segment" }} text | ||
|
||
{{ abcd.'lite]"ral}}segment' }} text | ||
|
||
{{ abcd.''}} text | ||
|
||
{{ abcd."" }} text | ||
|
||
{{ abcd.[] }} text |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of change just bit me today. :) Although a few of the other languages are also so different.