【发布时间】:2014-09-26 13:39:46
【问题描述】:
module MyFilter
def all_caps(input)
input.upcase
end
end
Liquid::Template.register_filter(MyFilter)
template = Liquid::Template.parse(" {{ 'hi john' | all_caps }} ")
template.render
# => " HI JOHN "
template = Liquid::Template.parse(" {{ 'hi {{name}}' | all_caps }} ")
template.render('name' => 'john')
# => " ' | all_caps }} "
我该如何解决这个问题?官方文档中没有提及。
注意:为了简单起见,我使用了 all_caps 示例。我想完成一些复杂的事情。
【问题讨论】: