Search code examples
htmljinja2jinja2-cli

Unable to make fields and values in italics in html/jinja2


Hello I have the following Html jinja2 template

<h1>Table of contents</h1>

{%- for region, d in data.items() %}
<a href="#{{ pageTag }}-{{ region }}">{{ loop.index }}. TGW VPC - {{ region }}</a>
<br/>
{% endfor %}

{%- for region, d in data.items() %}
<h1>{{ region }}</h1>
Account = {{ d["DE_Account"] }}
<br/>
TW ID = {{ d["tw id"] }}
<br/>
DX ID(s) = {{ d["dx connection id(s)"] }}
<br/>
DX LID(s) = {{ d["dx lag id(s)"] }}

{% endfor %}

I want following fields to be in italics as well as their values

Account = {{ d["DE_Account"] }}
TW ID = {{ d["tw id"] }}
DX ID(s) = {{ d["dx connection id(s)"] }}
DX LID(s) = {{ d["dx lag id(s)"] }}

is this possible I tried a couple of things but it doesn't seem to work


Solution

  • <h1>Table of contents</h1>
    
    {%- for region, d in data.items() %}
    <a href="#{{ pageTag }}-{{ region }}">{{ loop.index }}. TGW VPC - {{ region }}</a>
    <br/>
    {% endfor %}
    
    {%- for region, d in data.items() %}
    <h1>{{ region }}</h1>
    <em>Account = {{ d["DE_Account"] }}</em>
    <br/>
    <em>TW ID = {{ d["tw id"] }}</em>
    <br/>
    <em>DX ID(s) = {{ d["dx connection id(s)"] }}</em>
    <br/>
    <em>DX LID(s) = {{ d["dx lag id(s)"] }}</em>
    
    {% endfor %}