UCL-ARC / python-tooling

Python package template for new research software projects
http://github-pages.arc.ucl.ac.uk/python-tooling/
MIT License
43 stars 2 forks source link

Make funder optional #406

Closed dstansby closed 5 months ago

dstansby commented 5 months ago

Fixes https://github.com/UCL-ARC/python-tooling/issues/290; depends on https://github.com/UCL-ARC/python-tooling/pull/405.

samcunliffe commented 5 months ago

Is prettier complaining about the {% if cookiecutter.funder != '' %} clause? Because we're using {% if... elsewhere in template README.

dstansby commented 5 months ago

Might be because without a funder the README was getting two newlines at the end? Lets see if my fix works...

paddyroddy commented 5 months ago

So I've had a look and prettier currently fails if there's a funder or not.

Without funder - removes trailing line image

With funder - two different lines removed image

Let me have a play

paddyroddy commented 5 months ago

I've fixed the no funder case

paddyroddy commented 5 months ago

This is fixed now @dstansby. Basically, it was just some jinja2 syntax missing. In general, I've found it best to have things in the following format (note the -):

{%- if something %}
some code
{%- endif %}
dstansby commented 5 months ago

What does the - do?

paddyroddy commented 5 months ago

What does the - do?

Just whitespace control https://www.redpill-linpro.com/techblog/2023/07/19/jinja_whitespaces.html