Skip to content
Myr

Added the `meta` module.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent d1442c8 · Browse files · 5 files+18 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+18 added−14 removed

  • other:+18 added−14 removed

5 files+18 added−14 removed

modified:docs/api.rst+14 added
663 unmodified lines
664 The low-level API is fragile. Future Jinja2 versions will try not to665 change it in a backwards incompatible way but modifications in the Jinja2666 core may shine through. For example if Jinja2 introduces a new AST node667 in later versions that may be returned by :meth:`~Environment.parse`.668669The Meta API670------------671672.. versionadded:: 2.2673674The meta API returns some information about abstract syntax trees that675could help applications to implement more advanced template concepts. All676the functions of the meta API operate on an abstract syntax tree as677returned by the :meth:`Environment.parse` method.678679.. autofunction:: jinja2.meta.find_undeclared_variables680681.. autofunction:: jinja2.meta.find_referenced_templates
modified:docs/conf.py-3 removed
93 unmodified lines
94# If true, SmartyPants will be used to convert quotes and dashes to95# typographically correct entities.96#html_use_smartypants = True9798# use jinja2 for templates99template_bridge = 'jinjaext.Jinja2Bridge'10098# no modindex99html_use_modindex = False100101# If true, the reST sources are included in the HTML build as _sources/<name>.
40 unmodified lines
modified:docs/jinjaext.py-10 removed
75 unmodified lines
76 Error: '#F00 bg:#FAA'77 }787980class Jinja2Bridge(TemplateBridge):8182 def init(self, builder):83 path = builder.config.templates_path84 self.env = Environment(loader=FileSystemLoader(path))8586 def render(self, template, context):87 return self.env.get_template(template).render(context)888980_sig_re = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*(\(.*?\))')818283def format_function(name, aliases, func):
109 unmodified lines
modified:jinja2/nodes.py+3 added-1 removed
144 unmodified lines
145 for result in self.find_all(node_type):146 return result147148 def find_all(self, node_type):149 """Find all the nodes of a given type."""149 """Find all the nodes of a given type. If the type is a tuple,150 the check is performed for any of the tuple items.151 """152 for child in self.iter_child_nodes():153 if isinstance(child, node_type):154 yield child155 for result in child.find_all(node_type):
636 unmodified lines
modified:CHANGES+1 added
18 unmodified lines
19 variable and regular variable *after* the loop if that variable was unused20 *before* the loop. (#331)21- Added support for optional `scoped` modifier to blocks.22- Added support for line-comments.23- Added the `meta` module.2425Version 2.1.126-------------27(Bugfix release)
84 unmodified lines