How to list all node of a template

79 views
Skip to first unread message

Tiago Matos

unread,
Aug 13, 2012, 4:23:53 PM8/13/12
to liquid-t...@googlegroups.com
Hello all!

I have posted a question, which is bothering us for a long time. I am cross-posting it from stackoverflow:

Considering the following parsed template and a loop to its root.nodelist:


text = '{% if true %}{{ "poland" | capitalize }}{% else %}{{ "portugal" | capitalize}}{% endif %}'
template
= Liquid::Template.parse(text)
template
.root.nodelist.each { |node| p node }

will print only:


Portugal 

(and not Poland)

How could one list all nodes (including Liquid variables, tags, etc) from a template? Especially those inside if/else logic?

http://stackoverflow.com/questions/11928921/list-all-nodes-in-a-liquid-template
Reply all
Reply to author
Forward
0 new messages