Debian Codegraph @

etc/syntax/reference-files/flow_jinja2.cylc

raw
1 #!Jinja2
2 # ^ SYNTAX:3.1
3
4 # SYNTAX numbering matches the table in https://github.com/cylc/cylc/issues/2752
5
6 # SYNTAX: 3.2
7 # templating code should be displayed differently to cylc code
8 {# no comment #} # should display as a comment
9 {% set foo = "bar" %}
10 {% set foo = '%s' % 'bar' %}
11 {% set foo = {"1": 2, "3", []} %}
12 {% set foo = foo.bar(1, 2, 3) %}
13 {{ foo_bar }}
14 {{ foo.bar(1, 2, 3) }}
15 {{ foo | bar(1, 2, 3) }}
16 {% include 'foo' %}
17 {% include ['foo', 'bar'] %}
18 {% import 'foo' as foo %}
19 {% from 'foo' import foo as a, b %}
20
21 # SYNTAX 3.3
22 # multi-line template code should appear the same as single-line template code
23 # if it were distributed over multiple lines
24 {#
25 no comment
26 #} # all three lines should display as a single comment with no gaps
27 {# a
28 b
29 c #} # all three lines should display as a single comment with no gaps
30 {%
31 set foo = {"1": 2, "3", []}
32 %}
33 {% set foo = {
34 "1": 2,
35 "3", []} %}
36
37
38
39 # SYNTAX 3./1.1
40 # keys, values and sections outside of the templating code should display
41 # as normal
42 a = {{ b }}
43 {{ a }} = b
44 a = {{ b + 1 }}
45 a = {{ b_b | c.d('1', "2", 3) }}
46 [[{{ a }}]]
47 d = e # check highlighting of this line un-affected by section
48 [[{{ a_a | c.d('1', "2", 3) }}]]
49 d = e # check highlighting of this line un-affected by section
50 [[a{{ b }}c]]
51 d = e # check highlighting of this line un-affected by section
52 [[{{ "%(foo)s" % {"foo": "abc"}}}]]
53 d = e # check highlighting of this line un-affected by section
54
55 # SYNTAX 3./1.2
56 # comments outside of the templating code should display as normal
57 {# foo #} # foo
58 {% foo %} # foo
59 {{ foo }} # foo
60
61 # SYNTAX 3./1.3
62 # tasks and deps outside of the templating code should display as normal
63 R1 = """
64 foo => {{ bar }} => qux
65 foo => {{ b_ar | baz.pub('1', "2", 3) }} => qux =>
66 {% if BAR %}
67 bar => pub
68 {% else %}
69 baz => pub
70 {% endif %}
71 """