Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support printing inline handlebars in html (through embed function) (#…
…7306) * Move old handlebars to html file This kind of handlebars code is supposed to be in html files. * Remove useless file * Uglify our old handlebars file * Move venerable hbs tests to their folder Because of their config * html: Use glimmer for script tags of type handlebars * Record snapshots * Add CHANGELOG entry * Add the CHANGELOG test * Make the PR changes more obvious
- Loading branch information
Showing
7 changed files
with
121 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#### Support printing inline handlebars in html (through embed function) ([#7306](https://github.com/prettier/prettier/pull/7306) by [@dcyriller](https://github.com/dcyriller)) | ||
|
||
<!-- prettier-ignore --> | ||
``` | ||
<!-- Input --> | ||
<script type="text/x-handlebars-template"> | ||
{{component arg1='hey' arg2=(helper this.arg7 this.arg4) arg3=anotherone arg6=this.arg8}} | ||
</script> | ||
<!-- Output (Prettier stable) --> | ||
<script type="text/x-handlebars-template"> | ||
{{component arg1='hey' arg2=(helper this.arg7 this.arg4) arg3=anotherone arg6=this.arg8}} | ||
</script> | ||
<!-- Output (Prettier master) --> | ||
<script type="text/x-handlebars-template"> | ||
{{component | ||
arg1='hey' | ||
arg2=(helper this.arg7 this.arg4) | ||
arg3=anotherone | ||
arg6=this.arg8 | ||
}} | ||
</script> | ||
``` |
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
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
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
tests/handlebars-venerable/__snapshots__/jsfmt.spec.js.snap
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,82 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`template.html 1`] = ` | ||
====================================options===================================== | ||
parsers: ["html"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
<script id="entry-template" type="text/x-handlebars-template"> | ||
<div class="entry"> | ||
<h1>{{title}}</h1> | ||
<div class="body">{{body}}</div></div> | ||
</script> | ||
<script type="text/x-handlebars-template"> | ||
{{component arg1='hey' arg2=(helper this.arg7 this.arg4) arg3=anotherone arg6=this.arg8}} | ||
</script> | ||
=====================================output===================================== | ||
<script id="entry-template" type="text/x-handlebars-template"> | ||
<div class="entry"> | ||
<h1> | ||
{{title}} | ||
</h1> | ||
<div class="body"> | ||
{{body}} | ||
</div> | ||
</div> | ||
</script> | ||
<script type="text/x-handlebars-template"> | ||
{{component | ||
arg1="hey" | ||
arg2=(helper this.arg7 this.arg4) | ||
arg3=anotherone | ||
arg6=this.arg8 | ||
}} | ||
</script> | ||
================================================================================ | ||
`; | ||
|
||
exports[`template.html 2`] = ` | ||
====================================options===================================== | ||
parsers: ["html"] | ||
printWidth: 80 | ||
singleQuote: true | ||
| printWidth | ||
=====================================input====================================== | ||
<script id="entry-template" type="text/x-handlebars-template"> | ||
<div class="entry"> | ||
<h1>{{title}}</h1> | ||
<div class="body">{{body}}</div></div> | ||
</script> | ||
<script type="text/x-handlebars-template"> | ||
{{component arg1='hey' arg2=(helper this.arg7 this.arg4) arg3=anotherone arg6=this.arg8}} | ||
</script> | ||
=====================================output===================================== | ||
<script id="entry-template" type="text/x-handlebars-template"> | ||
<div class='entry'> | ||
<h1> | ||
{{title}} | ||
</h1> | ||
<div class='body'> | ||
{{body}} | ||
</div> | ||
</div> | ||
</script> | ||
<script type="text/x-handlebars-template"> | ||
{{component | ||
arg1='hey' | ||
arg2=(helper this.arg7 this.arg4) | ||
arg3=anotherone | ||
arg6=this.arg8 | ||
}} | ||
</script> | ||
================================================================================ | ||
`; |
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,2 @@ | ||
run_spec(__dirname, ["html"]); | ||
run_spec(__dirname, ["html"], { singleQuote: true }); |
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 @@ | ||
<script id="entry-template" type="text/x-handlebars-template"> | ||
<div class="entry"> | ||
<h1>{{title}}</h1> | ||
<div class="body">{{body}}</div></div> | ||
</script> | ||
|
||
<script type="text/x-handlebars-template"> | ||
{{component arg1='hey' arg2=(helper this.arg7 this.arg4) arg3=anotherone arg6=this.arg8}} | ||
</script> |