在Slim模板中进行了一些YAML解析,一直在苦苦挣扎。
我的YAML文件包含
shortdesc: >
markdown:
if you want to up the feelgood factor Cuban style, then this Monday night at The Buffalo Bar is for you...
但是当我在模板中输出shortdesc节点时,它显示为字符串而不是解释。 (“降价:如果你......”)
有没有办法解析YAML输出字符串来解释降价代码? 如果我试试
p
markdown:
= shortdesc
模板无法理解对包含YAML节点的变量的调用。
这甚至可能吗?
答案 0 :(得分:2)
这取决于您正在使用的Markdown库。
在BlueCloth中,它会是这样的:
= BlueCloth.new(shortdesc).to_html
答案 1 :(得分:1)
是的,这是可能的。只需要使用插值:
p
markdown:
#{shortdesc}