1
考虑以下解析的模板和循环其root.nodelist:列出液体模板中的所有节点?
text = '{% if true %}{{ "poland" | capitalize }}{% else %}{{ "portugal" | capitalize}}{% endif %}'
template = Liquid::Template.parse(text)
template.root.nodelist.each { |node| p node }
只打印:
Portugal
(而不是波兰)
怎么会一个列表中的所有节点(包括液体变量,标签等)从模板?特别是那些内部的if/else逻辑?