本文介绍了Handlers使用&符和脱字符号的模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这两个很奇怪的是
{{^ is_question}} {{/ is_question}}
和
{{&答案}}
这些都不在Handlerbars文档中列出,也没有定义帮助器。 p>
任何人都知道他们在做什么?
<^> ^ is_question似乎与{{#if is_question}}交替使用。也许这是一些不赞同的速记符号?
模板的编译方式与我们编译其他模板的方式相同:
template = Handlebars.compile(ItemTemplate)
我们的车把版本是:
Handlebars.VERSION =1.0.0-rc.3;
解决方案
我用,但我必须查找:
{{^ question}} X {{/ question}} =>逆选择,即如果(!question)X;
{{& answer}} =>未转义,通常为:{{{answer}}}
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 compiled the same way we compile other templates:
template = Handlebars.compile(ItemTemplate)
Our handlebars version is:
Handlebars.VERSION = "1.0.0-rc.3";
解决方案
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}}}
这篇关于Handlers使用&符和脱字符号的模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!