I am trying to get list of all variables and blocks in a template. I don't want to create my own parser to find variables. I tried using following snippet.
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader('gummi', 'templates'))
template = env.get_template('chat.html')
template.blocks
is dict where keys are blocks, how can I get all variables inside the blocks ?
Since no one has answered the question and I found the answer
This will yield list of undeclared variables since this is not executed at run time, it will yield list of all variables.
Note: This will yield html files which are included using
include
andextends
.