API to create parse tree of the template

46 views
Skip to first unread message

Nikhil Sabharwal

unread,
May 24, 2017, 7:35:29 PM5/24/17
to mustache.java
Hi , I have requirement where I need to parse the template and store it fir further processing before compiling the template.

For ex-
Hello {{firstName}} {{lastName}}
Your Education Qualification is

{{#qualication}}
     - {{ college}}
     - {{ years }}
{{/qualification }}


I need to create a parse tree like-
 -template 
      -firstName
      -lastName
      -qualication
            -college
            -years

Is there any API which I can use to create a pparse tree, before compiling the template ?
  

Sam

unread,
Jun 5, 2017, 11:24:57 AM6/5/17
to mustache.java
Mustache generates a parse tree when you compile. You could look at the tree by getting the mustache object and then walking the tree. 

https://gist.github.com/spullara/72ebb61fd07b9bcda7e522a3a9dcd9c5

Sam
Reply all
Reply to author
Forward
0 new messages