I have found that Jinja2 templates have the .blocks
property, which provides access to named blocks. However, it doesn't provide comment data (understandably).
Is there a programmatic or reliable way to retrieve comment content from a Jinja2 template? (Ideally, I'm avoiding writing a regex, as I presume the parsing is built in... I just haven't found it).
Here is an example:
Given this Jinja2 template:
{#
Comment block content.
#}
{% block main %}
This is the main block. We don't really care about it.
{% endblock %}
... I would like to be able to retrieve the following:
Comment block content.
Is there a bulit-in, perhaps undocumented way to get at this content reliably?