javascript - Handlebars templates using ampersand and caret - Stack Overflow

We found some old Handlebars templates which are working fine, but include some odd usage of Handlebars

We found some old Handlebars templates which are working fine, but include some odd usage of Handlebars.

The two strange ones are

{{^is_question}}{{/is_question}}

and

{{& answer}}

Neither of those are listed in the Handlerbars docs and there are no helpers defined.

Anyone know what they do?

The ^is_question appears to be used interchangeably with {{#if is_question}}. Maybe it is some deprecated shorthand notation?

The template is piled the same way we pile other templates:

template = Handlebarspile(ItemTemplate)

Our handlebars version is:

Handlebars.VERSION = "1.0.0-rc.3";

We found some old Handlebars templates which are working fine, but include some odd usage of Handlebars.

The two strange ones are

{{^is_question}}{{/is_question}}

and

{{& answer}}

Neither of those are listed in the Handlerbars docs and there are no helpers defined.

Anyone know what they do?

The ^is_question appears to be used interchangeably with {{#if is_question}}. Maybe it is some deprecated shorthand notation?

The template is piled the same way we pile other templates:

template = Handlebars.pile(ItemTemplate)

Our handlebars version is:

Handlebars.VERSION = "1.0.0-rc.3";
Share Improve this question edited Nov 19, 2014 at 21:33 BishopZ asked Nov 19, 2014 at 20:38 BishopZBishopZ 6,3888 gold badges47 silver badges60 bronze badges 2
  • I don't recognize this either. Is it possible someone had a custom task to translate this notation into true handlebars? – runspired Commented Nov 19, 2014 at 20:56
  • use of ^ seems to be taken from Mustache templating – jagershark Commented Mar 11, 2016 at 15:15
Add a ment  | 

1 Answer 1

Reset to default 10

I've used ^ relatively recently, but I had to look up &:

{{^ question}} X {{/question}} => inverse selection, i.e. if (! question ) X;
{{& answer}} => unescaped, typically: {{{answer}}}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744227478a4564081.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信