Skip to content

Latest commit

 

History

History
33 lines (29 loc) · 823 Bytes

File metadata and controls

33 lines (29 loc) · 823 Bytes

[handlebars] 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.

{{! 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}}