Javascript handlebar.js原始辅助程序

Javascript handlebar.js原始辅助程序,javascript,handlebars.js,Javascript,Handlebars.js,我有一个车把模板,工程伟大。我希望能够在其中添加以下内容: <script id="someTemplate" type="text/x-handlebars-template"> <div class="editStuff"> <span {{#if aThing}} data-someKey="{{anotherThing}}" {{/if}}> {{aThirdThing}} </sp

我有一个车把模板,工程伟大。我希望能够在其中添加以下内容:

<script id="someTemplate" type="text/x-handlebars-template">
    <div class="editStuff">
        <span {{#if aThing}} data-someKey="{{anotherThing}}" {{/if}}>
            {{aThirdThing}}
        </span>
    </div>
</script>
block helper,并按如下方式进行了尝试:

{{{{raw-helper}}}}
<script id="someTemplate" type="text/x-handlebars-template">
    <div class="editStuff">
        <span {{#if aThing}} data-addresskey="{{anotherThing}}" {{/if}}>
            {{aThirdThing}}
        </span>
    </div>
</script>
{{{{/raw-helper}}}}
{{{{{raw helper}}}
{{aThirdThing}}
{{{{/raw helper}}}}
但这最终会从HTML中删除整个脚本块

根据规则,原始块中的任何内容都应保持不变


我确实尝试过注册文档中提到的助手,以防万一它实际上没有包括在内,但这也没有帮助。

你可以不留胡子:

<script id="someTemplate" type="text/x-handlebars-template">
    <div class="editStuff">
        <span \{{#if aThing}} data-someKey="\{{anotherThing}}" \{{/if}}>
            \{{aThirdThing}}
        </span>
    </div>
</script>

\{{aThirdThing}}

当然不是最漂亮的解决方案,但效果很好。

我不确定原始助手是否能帮助您,您能将发送的数据添加到模板中吗?有什么问题吗?我发送给它的数据是不相关的-在模板文件最初被预编译之后,没有{{places}来放置它。原始帮助程序没有阻止预编译器处理其块的内容。上面块的输出应该正好是原始helper块的当前内容,{{{}完好无损,可以在我的代码中编译和使用。。。在他们的沙箱里也是这样,对我不起作用。
<script id="someTemplate" type="text/x-handlebars-template">
    <div class="editStuff">
        <span \{{#if aThing}} data-someKey="\{{anotherThing}}" \{{/if}}>
            \{{aThirdThing}}
        </span>
    </div>
</script>