Skip to content

Preview different from final output #105

@fschulze

Description

@fschulze

As mentioned in #97 I get different output from preview to final. Now I was able to reproduce it.

The template:

{% for section in sections %}
{% set underline = "-" %}
{% if section %}
{{section}}
{{ underline * section|length }}{% set underline = "~" %}

{% endif %}
{% if sections[section] %}
{% for category, val in definitions.items() if category in sections[section] %}
{% if definitions[category]['name'] %}

{{ definitions[category]['name'] }}
{{ underline * definitions[category]['name']|length }}
{% endif %}

{% if definitions[category]['showcontent'] %}
{% for text, values in sections[section][category]|dictsort(by='value') %}
- {{ text }}

{% endfor %}
{% else %}
- {{ sections[section][category]['']|sort|join(', ') }}


{% endif %}
{% if sections[section][category]|length == 0 %}

No significant changes.


{% else %}
{% endif %}
{% endfor %}
{% else %}

No significant changes.


{% endif %}
{% endfor %}

The pyproject.toml:

[tool.towncrier]
package = "project"
filename = "src/project/docs/changes.rst"
directory = "changes/"
title_format = "{version} - {project_date}"
template = "changes/_template.rst"

  [[tool.towncrier.type]]
  directory = "change"
  name = ""
  showcontent = true

  [[tool.towncrier.type]]
  directory = "migration"
  name = "Contains migration"
  showcontent = true

  [[tool.towncrier.type]]
  directory = "solr"
  name = "Requires Solr update"
  showcontent = true

The draft looks like this:

% towncrier --draft
Loading template...
Finding news fragments...
Rendering news fragments...
Draft only -- nothing has been written.
What is seen below is what would be written.

10.0 - 2018-01-01
=============


- bla

%

The changes file afterwards looks like this:

10.0 - 2018-01-01
=============

- bla


9.0 - ...
=====

Notice the difference in newlines below the equal signs and after the changelog entry. The goal is to have one after the equal signs and two after the changes before the previous version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions