Jade 模板 - 升级到 pug 后不处理大括号中的 json?
Jade template - does not process json in curly bracket after upgrading to pug?
为什么升级到 pug 后 jade 不再正确处理 json?
例如:
a.btn.btn-link(href="/datasets/#{dataset.index}") Show
结果:
<a class="btn btn-link" href="/datasets/#{dataset.index}">Show</a>
应该是:
<a class="btn btn-link" href="/datasets/ISIUSXSXX">Show</a>
知道为什么吗?
编辑:
我想就是这样了:
a(href=`before${link}after`)
我真的不明白为什么开发人员会选择 pug/jade - 'code' 看起来非常丑陋且不可读!语法令人困惑。规则不一致!吐槽一下!
语法已更改为使用 ES6 模板字符串:
a.btn.btn-link(href="/datasets/#{dataset.index}")
变成:
a.btn.btn-link(href=`/datasets/${dataset.index}`)
We removed support for interpolation in attributes since it was unnecessarily complex in implementation and tended to delay users learning that they can just use any JavaScript value in place of attributes
为什么升级到 pug 后 jade 不再正确处理 json?
例如:
a.btn.btn-link(href="/datasets/#{dataset.index}") Show
结果:
<a class="btn btn-link" href="/datasets/#{dataset.index}">Show</a>
应该是:
<a class="btn btn-link" href="/datasets/ISIUSXSXX">Show</a>
知道为什么吗?
编辑:
我想就是这样了:
a(href=`before${link}after`)
我真的不明白为什么开发人员会选择 pug/jade - 'code' 看起来非常丑陋且不可读!语法令人困惑。规则不一致!吐槽一下!
语法已更改为使用 ES6 模板字符串:
a.btn.btn-link(href="/datasets/#{dataset.index}")
变成:
a.btn.btn-link(href=`/datasets/${dataset.index}`)
We removed support for interpolation in attributes since it was unnecessarily complex in implementation and tended to delay users learning that they can just use any JavaScript value in place of attributes