How to get list of all variables in jinja 2 templates

Since no one has answered the question and I found the answer from jinja2 import Environment, PackageLoader, meta env = Environment(loader=PackageLoader(‘gummi’, ‘templates’)) template_source = env.loader.get_source(env, ‘page_content.html’) parsed_content = env.parse(template_source) meta.find_undeclared_variables(parsed_content) 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 … Read more

Use placeholders in yaml

Context YAML version 1.2 user wishes to include variable placeholders in YAML have placeholders replaced with computed values, upon yaml.load be able to use placeholders for both YAML mapping keys and values Problem YAML does not natively support variable placeholders. Anchors and Aliases almost provide the desired functionality, but these do not work as variable … Read more