Python jinja2 indentention and whitespace issue
<p>I have the following jinja2 template. When I render it, lines after the "endif" statement do not have proper indentation. I've tried passing trim_blocks=True and keep_trailing_newline=False without much success.   </p>

<pre><code>   applications:
      {{ application_name }}:
        version: {{ version }}
        {% if dependencies is not none: -%}
        dependencies:
          {% for key, value in dependencies.items() -%}
            - {{ key }}: {{ value }}
          {% endfor -%}
        {% endif -%}
        {% if departments is not none: -%}
        departments:
          {% for key, value in departments.items() -%}
            - {{ key }}: {{ value }}
          {% endfor -%}
        {% endif -%}
        paid: "yes"
        obsolete: "no"
</code></pre>

<p>Actual results. <strong>departments</strong> and <strong>paid</strong> blocks do not follow the data structure hierarchy</p>

<pre><code>applications:
  appication1:
    version: "1.0"
    dependencies:
      - database: mysql
      - storage: nfs
      departments: &lt;- Indent is not correct
      - accounting: payroll
      paid: "yes" &lt;- Indent is not correct
    obsolete: "no"
</code></pre>

<p>Expected results. <strong>departments</strong> and <strong>paid</strong> align with <strong>paid</strong>, <strong>version</strong> and etc. </p>

<pre><code>applications:
  appication1:
    version: "1.0"
    dependencies:
      - database: mysql
      - storage: nfs
    departments:
      - accounting: payroll
    paid: "yes"
    obsolete: "no"
</code></pre>

<p>I am wondering what else I could be missing.</p>

<p>Thanks,</p>