~homeworkprod/byceps

ref: bcef32cd2dc329bcf81057794883008f5c040ac8 byceps/byceps/blueprints/common/style_guide/templates/common/style_guide/sections/_tags.html -rw-r--r-- 924 bytes
bcef32cd — Jochen Kupperschmidt Work around Jinja 3.0.0 bug with `for` inside of `set` block 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{%- from 'macros/misc.html' import render_tag %}


  {%- set example_tags -%}
<p>Just a {{ render_tag('tag') }} to attach to things or to represent state.</p>
  {%- endset %}

  <div class="example">
    <div class="example-result">
{{ example_tags }}
    </div>
    <div class="example-code">
      {% call render_code_block() -%}
{{ example_tags }}
      {%- endcall %}
    </div>
  </div>

  <p>With pre-defined colors:</p>

  {%- set color = None -%}{# workaround for bug in Jinja 3.0.0 #}
  {%- set example_tags_colored -%}
<p>
  {%- for color in ('info', 'success', 'warning', 'danger') %}
  {{ render_tag(color, class='color-{}'.format(color)) }}
  {%- endfor %}
</p>
  {%- endset %}

  <div class="example">
    <div class="example-result">
{{ example_tags_colored }}
    </div>
    <div class="example-code">
      {% call render_code_block() -%}
{{ example_tags_colored }}
      {%- endcall %}
    </div>
  </div>