OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, environment, source, name=None, filename=None, state=None) |
def | fail (self, msg, lineno=None, exc=TemplateSyntaxError) |
def | fail_unknown_tag (self, name, lineno=None) |
def | fail_eof (self, end_tokens=None, lineno=None) |
def | is_tuple_end (self, extra_end_rules=None) |
def | free_identifier (self, lineno=None) |
def | parse_statement (self) |
def | parse_statements (self, end_tokens, drop_needle=False) |
def | parse_set (self) |
def | parse_for (self) |
def | parse_if (self) |
def | parse_with (self) |
def | parse_autoescape (self) |
def | parse_block (self) |
def | parse_extends (self) |
def | parse_import_context (self, node, default) |
def | parse_include (self) |
def | parse_import (self) |
def | parse_from (self) |
def | parse_signature (self, node) |
def | parse_call_block (self) |
def | parse_filter_block (self) |
def | parse_macro (self) |
def | parse_print (self) |
def | parse_assign_target (self, with_tuple=True, name_only=False, extra_end_rules=None, with_namespace=False) |
def | parse_expression (self, with_condexpr=True) |
def | parse_condexpr (self) |
def | parse_or (self) |
def | parse_and (self) |
def | parse_not (self) |
def | parse_compare (self) |
def | parse_math1 (self) |
def | parse_concat (self) |
def | parse_math2 (self) |
def | parse_pow (self) |
def | parse_unary (self, with_filter=True) |
def | parse_primary (self) |
def | parse_tuple (self, simplified=False, with_condexpr=True, extra_end_rules=None, explicit_parentheses=False) |
def | parse_list (self) |
def | parse_dict (self) |
def | parse_postfix (self, node) |
def | parse_filter_expr (self, node) |
def | parse_subscript (self, node) |
def | parse_subscribed (self) |
def | parse_call (self, node) |
def | parse_filter (self, node, start_inline=False) |
def | parse_test (self, node) |
def | subparse (self, end_tokens=None) |
def | parse (self) |
Data Fields | |
environment | |
stream | |
name | |
filename | |
closed | |
extensions | |
This is the central parsing class Jinja uses. It's passed to extensions and can be used to parse expressions or statements.
def __init__ | ( | self, | |
environment, | |||
source, | |||
name = None , |
|||
filename = None , |
|||
state = None |
|||
) |
def fail | ( | self, | |
msg, | |||
lineno = None , |
|||
exc = TemplateSyntaxError |
|||
) |
Convenience method that raises `exc` with the message, passed line number or last line number as well as the current name and filename.
def fail_eof | ( | self, | |
end_tokens = None , |
|||
lineno = None |
|||
) |
Like fail_unknown_tag but for end of template situations.
def fail_unknown_tag | ( | self, | |
name, | |||
lineno = None |
|||
) |
Called if the parser encounters an unknown tag. Tries to fail with a human readable error message that could help to identify the problem.
def free_identifier | ( | self, | |
lineno = None |
|||
) |
Return a new free identifier as :class:`~jinja2.nodes.InternalName`.
def is_tuple_end | ( | self, | |
extra_end_rules = None |
|||
) |
Are we at the end of a tuple?
def parse | ( | self | ) |
Parse the whole template into a `Template` node.
def parse_and | ( | self | ) |
def parse_assign_target | ( | self, | |
with_tuple = True , |
|||
name_only = False , |
|||
extra_end_rules = None , |
|||
with_namespace = False |
|||
) |
Parse an assignment target. As Jinja allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that can be disable however by setting `with_tuple` to `False`. If only assignments to names are wanted `name_only` can be set to `True`. The `extra_end_rules` parameter is forwarded to the tuple parsing function. If `with_namespace` is enabled, a namespace assignment may be parsed.
def parse_autoescape | ( | self | ) |
def parse_block | ( | self | ) |
def parse_call | ( | self, | |
node | |||
) |
def parse_call_block | ( | self | ) |
def parse_compare | ( | self | ) |
def parse_concat | ( | self | ) |
def parse_condexpr | ( | self | ) |
def parse_dict | ( | self | ) |
def parse_expression | ( | self, | |
with_condexpr = True |
|||
) |
Parse an expression. Per default all expressions are parsed, if the optional `with_condexpr` parameter is set to `False` conditional expressions are not parsed.
def parse_extends | ( | self | ) |
def parse_filter | ( | self, | |
node, | |||
start_inline = False |
|||
) |
def parse_filter_block | ( | self | ) |
def parse_filter_expr | ( | self, | |
node | |||
) |
def parse_for | ( | self | ) |
Parse a for loop.
def parse_from | ( | self | ) |
def parse_if | ( | self | ) |
Parse an if construct.
def parse_import | ( | self | ) |
def parse_import_context | ( | self, | |
node, | |||
default | |||
) |
def parse_include | ( | self | ) |
def parse_list | ( | self | ) |
def parse_macro | ( | self | ) |
def parse_math1 | ( | self | ) |
def parse_math2 | ( | self | ) |
def parse_not | ( | self | ) |
def parse_or | ( | self | ) |
def parse_postfix | ( | self, | |
node | |||
) |
def parse_pow | ( | self | ) |
def parse_primary | ( | self | ) |
def parse_print | ( | self | ) |
def parse_set | ( | self | ) |
Parse an assign statement.
def parse_signature | ( | self, | |
node | |||
) |
def parse_statement | ( | self | ) |
Parse a single statement.
def parse_statements | ( | self, | |
end_tokens, | |||
drop_needle = False |
|||
) |
Parse multiple statements into a list until one of the end tokens is reached. This is used to parse the body of statements as it also parses template data if appropriate. The parser checks first if the current token is a colon and skips it if there is one. Then it checks for the block end and parses until if one of the `end_tokens` is reached. Per default the active token in the stream at the end of the call is the matched end token. If this is not wanted `drop_needle` can be set to `True` and the end token is removed.
def parse_subscribed | ( | self | ) |
def parse_subscript | ( | self, | |
node | |||
) |
def parse_test | ( | self, | |
node | |||
) |
def parse_tuple | ( | self, | |
simplified = False , |
|||
with_condexpr = True , |
|||
extra_end_rules = None , |
|||
explicit_parentheses = False |
|||
) |
Works like `parse_expression` but if multiple expressions are delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created. This method could also return a regular expression instead of a tuple if no commas where found. The default parsing mode is a full tuple. If `simplified` is `True` only names and literals are parsed. The `no_condexpr` parameter is forwarded to :meth:`parse_expression`. Because tuples do not require delimiters and may end in a bogus comma an extra hint is needed that marks the end of a tuple. For example for loops support tuples between `for` and `in`. In that case the `extra_end_rules` is set to ``['name:in']``. `explicit_parentheses` is true if the parsing was triggered by an expression in parentheses. This is used to figure out if an empty tuple is a valid expression or not.
def parse_unary | ( | self, | |
with_filter = True |
|||
) |
def parse_with | ( | self | ) |
def subparse | ( | self, | |
end_tokens = None |
|||
) |
closed |
environment |
extensions |
filename |
name |
stream |