无法解释的“<”和双重输出在玉器包括
我正在重构我的页面,使其具有dynamic包含,将其预渲染到服务器上,并将它们传递给res.render()
但是现在,在页面上出现<
和>
,包含被渲染了两次,这是我无法理解的。
routes/tips.js
// ... router.get('/addition/:number', function(req, res) { console.dir(renderTemplate(makePath('add/add' + req.params.number))); // shows just what i want, without extra characters res.render('tips/tipsLayout', {content: renderTemplate(makePath('add/add' + req.params.number))}); // at this point, 'content' is definitely correct. }); // ...
tipsLayout.jade
extends ../layout block content .wrapper.col-xs-12.col-md-12.col-lg-10.col-lg-offset-1 h1= title a(href='/tips/', data-i18n="buttons.back") p(data-i18n="markup.tipsHeading") block extraJS script(src='/javascripts/tips.js', type='text/javascript') include tipsMenu.jade .tipContent #{content} // here i want to insert pre-rendered 'content'
tips/add/add0.jade
(这是什么得到预渲染)
- var path = "[html]hints.+.0." h1(data-i18n=path + "0") .tipsFrame .tipsText p(data-i18n=path + "1") p(data-i18n=path + "2") p(data-i18n=path + "3") .tipsExample p(data-i18n=path + "4") p(data-i18n=path + "5") p(data-i18n=path + "6")
html输出:
// ... <div class="tipContent"> // so it looks like it is something inside 'content' after all..? "<" <h1 data-18n="[html]hints.+.0.0">Addition from left to right (1)</h1> <div class="tipsFrame">...</div> ">" <!--<h1 data-i18n="[html]hints.+.0.0"--> // note the comment here...(where does that come from?) <div class="tipsFrame">...</div> ">" </div> // ...
一切工作之前,提示作为正常extend
/ block
s包括在内
更新
我想也许它与block content
和#{content}
具有相同的名称,但我改变了后者,仍然是相同的输出。
更新2&解决scheme
好吧,它看起来像#{content}
必须!{content}
….
来源..
#{content}
=> !{content}
…
突然之间,所有的错误消失了