DEV: Upgrade our widget handlebars compiler

Now supports subexpressions such as i18n and concat, plus automatic
attaching of widgets similar to ember.
This commit is contained in:
Robin Ward
2019-05-01 18:31:01 -04:00
parent e696903c31
commit 3cb0d27d38
9 changed files with 142 additions and 110 deletions

View File

@@ -1,19 +1,9 @@
template = <<~HBS
{{attach widget="widget-name" attrs=attrs}}
{{a}}
{{{htmlValue}}}
{{#if state.category}}
{{attach widget="category-display" attrs=(hash category=state.category someNumber=123 someString="wat")}}
{{/if}}
{{#each transformed.something as |s|}}
{{s.wat}}
{{/each}}
{{attach widget=settings.widgetName}}
{{#unless settings.hello}}
XYZ
{{/unless}}
{{attach widget="wat" attrs=(hash test="abc" text=(i18n "hello" count=attrs.wat))}}
{{action-link action="undo" className="undo" text=(i18n (concat "post.actions.undo." attrs.action))}}
{{actions-summary-item attrs=as}}
{{attach widget="actions-summary-item" attrs=as}}
{{testing value="hello"}}
HBS
ctx = MiniRacer::Context.new(timeout: 15000)