fsfe / reuse-tool

reuse is a tool for compliance with the REUSE recommendations.
https://reuse.software
382 stars 146 forks source link

Expose more variables to Jinja templates #922

Open BigBlueHat opened 6 months ago

BigBlueHat commented 6 months ago

This would solve a host of issues around text formatting and whitespace and be useful next to #581.

davidlehn commented 6 months ago

An issue this might address is the copyright date range issue from https://github.com/fsfe/reuse-tool/issues/915. merge_copyright_lines in _util.py uses spaces in the date range formatting:

                year = f"{min(years)} - {max(years)}"

When used in a template, there is no flexibility if one wanted to use what seems to be the far more common spaceless "YYYY-YYYY" range form:

{% for copyright_line in copyright_lines %}
{{ copyright_line }}
{% endfor %}

I'm not sure if more vars is the right approach for this particular issue. It might make the templates too complex? May need something to control the logic in the function that does the formatting.