{"componentChunkName":"component---smooth-doc-smooth-doc-src-templates-doc-js","path":"/docs/report-templates/jinja2-quick-reference/","result":{"data":{"mdx":{"fields":{"pageType":"doc","title":"Jinja2 Quick Reference","editLink":""},"body":"var _excluded = [\"components\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"title\": \"Jinja2 Quick Reference\",\n  \"description\": \"jinja2 quick reference\",\n  \"section\": \"Report Templates\",\n  \"order\": 34\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h1\", {\n    \"id\": \"jinja2-quick-reference\"\n  }, mdx(\"a\", {\n    parentName: \"h1\",\n    \"href\": \"#jinja2-quick-reference\",\n    \"aria-label\": \"jinja2 quick reference permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Jinja2 Quick Reference\"), mdx(\"br\", null), mdx(\"p\", null, \"This section provides an overview of the syntax and some of the commonly used features of the Jinja2 templating language. For more detailed information, refer to the official \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://jinja.palletsprojects.com/en/3.0.x/templates/\"\n  }, \"Jinja2 documentation\"), \".\"), mdx(\"div\", {\n    className: \"info\"\n  }, \"As the template engine is very flexible, the configuration from the PathcoreFlow application can be slightly different from the code presented here in terms of delimiters and behavior of undefined values. If you encounter any anomalies, contact our support team.\"), mdx(\"h2\", {\n    \"id\": \"basic-syntax\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#basic-syntax\",\n    \"aria-label\": \"basic syntax permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Basic Syntax\"), mdx(\"p\", null, \"A template contains variables and/or expressions, which get replaced with values when a template is rendered; and tags, which control the logic of the template.\"), mdx(\"p\", null, \"There are a few kinds of delimiters configured as follows:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"{% ... %} for Statements\\n{{ ... }} for Expressions to print to the template output\\n{# ... #} for Comments not included in the template output\\n\")), mdx(\"h2\", {\n    \"id\": \"variables\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#variables\",\n    \"aria-label\": \"variables permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Variables\"), mdx(\"p\", null, \"Variables may have attributes or elements on them you can access. See the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/flow/manual/latest/docs/report-templates/placeholder-reference/\"\n  }, \"Placeholder Reference\"), \" for details.\"), mdx(\"p\", null, \"You can use a dot (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \".\"), \") to access attributes of a variable in addition to the standard subscript (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"[]\"), \") syntax.\"), mdx(\"p\", null, \"The following lines do the same thing:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"{{ folder.image }}\\n{{ folder['image'] }}\\n\")), mdx(\"p\", null, \"It\\u2019s important to know that the outer two curly braces are not part of the variable, but the print statement. If you access variables inside tags, don't put the braces around them. If a variable or attribute does not exist, you will get back an undefined value.\"), mdx(\"h2\", {\n    \"id\": \"filters\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#filters\",\n    \"aria-label\": \"filters permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Filters\"), mdx(\"p\", null, \"Variables can be modified by filters. Filters are separated from the variable by a pipe symbol (\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"|\"), \") and may have optional arguments in parentheses. Multiple filters can be chained. The output of one filter is applied to the next.\"), mdx(\"p\", null, \"For example, \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{{ name|striptags|title }}\"), \" will remove all \", mdx(\"abbr\", {\n    parentName: \"p\",\n    \"title\": \"HyperText Markup Language\"\n  }, \"HTML\"), \" Tags from variable \\\"name\\\" and title-case the output (i.e., \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"title(striptags(name))\"), \").\"), mdx(\"p\", null, \"Filters that accept arguments have parentheses around the arguments, just like a function call. For example: \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{{ listx|join(', ') }}\"), \" will join a list with commas (i.e., \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"str.join(', ', listx)\"), \").\"), mdx(\"p\", null, \"The \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://jinja.palletsprojects.com/en/3.0.x/templates/#list-of-builtin-filters\"\n  }, \"List of Builtin Filters\"), \" in the official Jinja2 documentation describes all the builtin filters.\"), mdx(\"h2\", {\n    \"id\": \"tests\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#tests\",\n    \"aria-label\": \"tests permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Tests\"), mdx(\"p\", null, \"Beside filters, there are also so-called \\\"tests\\\" available. Tests can be used to test a variable against a common expression. To test a variable or expression, you add \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"is\"), \" plus the name of the test after the variable. For example, to find out if a variable is defined, you can do \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"name is defined\"), \", which will then return true or false depending on whether name is defined in the current template context.\"), mdx(\"p\", null, \"Tests can accept arguments, too. If the test only takes one argument, you can leave out the parentheses. For example, the following two expressions do the same thing:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"{% if  loop.index is divisibleby 3 %}\\n{% if  loop.index is divisibleby(3) %}\\n\")), mdx(\"p\", null, \"The \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://jinja.palletsprojects.com/en/3.0.x/templates/#builtin-tests\"\n  }, \"List of Builtin Tests\"), \" in the official Jinja2 documentation describes all the builtin tests.\"), mdx(\"h2\", {\n    \"id\": \"comments\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#comments\",\n    \"aria-label\": \"comments permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Comments\"), mdx(\"p\", null, \"To comment out part of a line in a template, use the comment syntax which is \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{# ... #}\"), \". This is useful to comment out parts of the template for debugging or to add information for other template designers or yourself:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"{# note: commented-out template because we no longer use this\\n    {% for user in users %}\\n        ...\\n    {% endfor %}\\n#}\\n\")), mdx(\"h2\", {\n    \"id\": \"control-structures\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#control-structures\",\n    \"aria-label\": \"control structures permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Control Structures\"), mdx(\"p\", null, \"A control structure refers to all those things that control the flow of a program - conditionals (i.e., if/elif/else), for-loops, as well as things like macros and blocks. Control structures appear inside \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{% ... %}\"), \" blocks.\"), mdx(\"h3\", {\n    \"id\": \"for\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#for\",\n    \"aria-label\": \"for permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"For\"), mdx(\"p\", null, \"Loop over each item in a sequence. For example, to display a list of image names provided in the selected folder:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"<h2>Images</h2>\\n<ul>\\n{% for im in folder.images %}\\n    <li>{{ im.name|e }}</li>\\n{% endfor %}\\n</ul>\\n\")), mdx(\"p\", null, \"As variables in templates retain their object properties, it is possible to iterate over containers like dict:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"<dl>\\n{% for key, value in folder.fields.items() %}\\n    <dt>{{ key|e }}</dt>\\n    <dd>{{ value|e }}</dd>\\n{% endfor %}\\n</dl>\\n\")), mdx(\"div\", {\n    className: \"info\"\n  }, \"The \\\"e\\\" in the above examples is an alias for the builtin escape filter. The escape filter converts the characters &, <, >, ', and \\\" in a string to HTML-safe sequences. Use this if you need to display text that might contain such characters.\"), mdx(\"p\", null, \"Note, however, that dicts are not ordered; so you might want to use the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"dictsort\"), \" filter.\"), mdx(\"p\", null, \"Inside of a for-loop block, you can access some special variables:\"), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Variable\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Description\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.index\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The current iteration of the loop. (1 indexed).\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.index0\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The current iteration of the loop. (0 indexed).\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.revindex\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The number of iterations from the end of the loop (1 indexed).\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.revindex0\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The number of iterations from the end of the loop (0 indexed).\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.first\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"True if first iteration.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.last\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"True if last iteration.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.length\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"The number of items in the sequence.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.cycle\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"A helper function to cycle between a list of sequences. See the explanation below.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.depth\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Indicates how deep in a recursive loop the rendering currently is. Starts at level 1.\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"inlineCode\", {\n    parentName: \"td\"\n  }, \"loop.depth0\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Indicates how deep in a recursive loop the rendering currently is. Starts at level 0.\")))), mdx(\"p\", null, \"Unlike in Python, it\\u2019s not possible to break or continue in a loop. You can, however, filter the sequence during iteration, which allows you to skip items. The following example skips images with the name \\\"test\\\":\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"{% for im in folder.images if not im.name == 'test' %}\\n    <li>{{ im.name|e }}</li>\\n{% endfor %}\\n\")), mdx(\"p\", null, \"If no iteration took place because the sequence was empty or the filtering removed all the items from the sequence, you can render a default block by using else:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"<ul>\\n{% for im in folder.images %}\\n    <li>{{ im.name }}</li>\\n{% else %}\\n    <li><em>No image found</em></li>\\n{% endfor %}\\n</ul>\\n\")), mdx(\"h3\", {\n    \"id\": \"if\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#if\",\n    \"aria-label\": \"if permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"If\"), mdx(\"p\", null, \"In the simplest form, you can use the If statement to test if a variable is defined, not empty and not false:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"{% if report_signed_by %}\\n\\n<div class=\\\"signature\\\">\\n    <img src=\\\"{{ report_signed_by.signature }}\\\" />\\n    <p>Signed by {{ report_signed_by.name }} at {{ report_signed_at }}</p>\\n</div>\\n\\n{% endif %}\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#jinja2-quick-reference","title":"Jinja2 Quick Reference","items":[{"url":"#basic-syntax","title":"Basic Syntax"},{"url":"#variables","title":"Variables"},{"url":"#filters","title":"Filters"},{"url":"#tests","title":"Tests"},{"url":"#comments","title":"Comments"},{"url":"#control-structures","title":"Control Structures","items":[{"url":"#for","title":"For"},{"url":"#if","title":"If"}]}]}]}}},"pageContext":{"id":"79aa9185-9dcc-560a-8157-7d7281c4b451"}},"staticQueryHashes":["1086510573","1106176283","1122327541","2140385554","2719290676","3597609067","4027383558"]}