Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[handlebars] correctly format custom "else if" blocks (#13507)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
- Loading branch information
1 parent
2bc7575
commit 38611cb
Showing
4 changed files
with
377 additions
and
9 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,33 @@ | ||
#### Correctly format custom "else if" blocks (#13507 by @jamescdavis) | ||
|
||
A template transform can be used to create custom block keywords that behave similar to `if`. This updates printer-glimmer to correctly recognize and format the "else if" case when "if" is a custom keyword. | ||
|
||
<!-- prettier-ignore --> | ||
```hbs | ||
{{! Input }} | ||
{{#when isAtWork}} | ||
Ship that code! | ||
{{else when isReading}} | ||
You can finish War and Peace eventually... | ||
{{else}} | ||
Go to bed! | ||
{{/when}} | ||
{{! Prettier stable }} | ||
{{#when isAtWork}} | ||
Ship that code! | ||
{{else}}{{#when isReading}} | ||
You can finish War and Peace eventually... | ||
{{else}} | ||
Go to bed! | ||
{{/when}}{{/when}} | ||
{{! Prettier main }} | ||
{{#when isAtWork}} | ||
Ship that code! | ||
{{else when isReading}} | ||
You can finish War and Peace eventually... | ||
{{else}} | ||
Go to bed! | ||
{{/when}} | ||
``` |
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
Oops, something went wrong.