How to use Jinja - 10 common examples

To help you get started, we’ve selected a few Jinja examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pallets / jinja / jinja / nodes.py View on Github external
"""


class FloorDivExpression(BinaryExpression):
    """
    {{ foo // bar }}
    """


class AddExpression(BinaryExpression):
    """
    {{ foo + bar }}
    """


class SubExpression(BinaryExpression):
    """
    {{ foo - bar }}
    """


class ModExpression(BinaryExpression):
    """
    {{ foo % bar }}
    """


class PowExpression(BinaryExpression):
    """
    {{ foo ** bar }}
    """
github pallets / jinja / jinja / nodes.py View on Github external
return [self.expr] + list(chain(*self.ops))

    def __repr__(self):
        return 'CompareExpression(%r, %r)' % (
            self.expr,
            self.ops
        )


class MulExpression(BinaryExpression):
    """
    {{ foo * bar }}
    """


class DivExpression(BinaryExpression):
    """
    {{ foo / bar }}
    """


class FloorDivExpression(BinaryExpression):
    """
    {{ foo // bar }}
    """


class AddExpression(BinaryExpression):
    """
    {{ foo + bar }}
    """
github pallets / jinja / jinja / nodes.py View on Github external
def __init__(self, expr, ops, lineno=None, filename=None):
        Expression.__init__(self, lineno, filename)
        self.expr = expr
        self.ops = ops

    def get_items(self):
        return [self.expr] + list(chain(*self.ops))

    def __repr__(self):
        return 'CompareExpression(%r, %r)' % (
            self.expr,
            self.ops
        )


class MulExpression(BinaryExpression):
    """
    {{ foo * bar }}
    """


class DivExpression(BinaryExpression):
    """
    {{ foo / bar }}
    """


class FloorDivExpression(BinaryExpression):
    """
    {{ foo // bar }}
    """
github pallets / jinja / jinja / nodes.py View on Github external
)


class MulExpression(BinaryExpression):
    """
    {{ foo * bar }}
    """


class DivExpression(BinaryExpression):
    """
    {{ foo / bar }}
    """


class FloorDivExpression(BinaryExpression):
    """
    {{ foo // bar }}
    """


class AddExpression(BinaryExpression):
    """
    {{ foo + bar }}
    """


class SubExpression(BinaryExpression):
    """
    {{ foo - bar }}
    """
github pallets / jinja / jinja / nodes.py View on Github external
"""


class DivExpression(BinaryExpression):
    """
    {{ foo / bar }}
    """


class FloorDivExpression(BinaryExpression):
    """
    {{ foo // bar }}
    """


class AddExpression(BinaryExpression):
    """
    {{ foo + bar }}
    """


class SubExpression(BinaryExpression):
    """
    {{ foo - bar }}
    """


class ModExpression(BinaryExpression):
    """
    {{ foo % bar }}
    """
github sphinx-doc / sphinx / sphinx / _jinja.py View on Github external
def init(self, builder):
        self.templates = {}
        base_templates_path = path.join(path.dirname(__file__), 'templates')
        ext_templates_path = [path.join(builder.confdir, dir)
                              for dir in builder.config.templates_path]
        self.templates_path = [base_templates_path] + ext_templates_path
        loader = SphinxFileSystemLoader(base_templates_path, ext_templates_path)
        if builder.translator is not None:
            self.jinja_env = TranslatorEnvironment(loader=loader,
                    friendly_traceback=False, translator=builder.translator)
        else:
            self.jinja_env = Environment(loader=loader,
                    # disable traceback, more likely that something
                    # in the application is broken than in the templates
                    friendly_traceback=False)
github nipy / nibabel / doc / sphinxext / plot_directive.py View on Github external
def format_template(template, **kw):
        return jinja.from_string(template, **kw)
github rootpy / rootpy / docs / sphinxext / numpydoc / plot_directive.py View on Github external
def format_template(template, **kw):
        return jinja.from_string(template, **kw)
github bioidiap / bob / python / bob / sphinxext / plot.py View on Github external
def format_template(template, **kw):
        return jinja.from_string(template, **kw)
github nguy / artview / docs / sphinxext / numpydoc / plot_directive.py View on Github external
def format_template(template, **kw):
        return jinja.from_string(template, **kw)