icsv2ledger icon indicating copy to clipboard operation
icsv2ledger copied to clipboard

Enable rendering of templates using Jinja2

Open tinloaf opened this issue 7 years ago • 1 comments

… and I have another one. As for the first:

  • I didn't write documentation for the readme yet. If you like the patch, I'll add it.
  • I noticed too late that I didn't turn off autopep8 in my editor. This PR as it is now includes PEP8-ing your existing code, which isn't a huge change, but mainly some line breaking and whitespace stuff. If you don't like that, I'll remove it again - but I thought maybe you don't have a problem with it, so I don't have to manually change it back. ;-)

Also, this PR has (on its own) merge conflicts with #121 - I have a merged version in case you like both.

This PR adds the possibility to render templates using Jinja2 instead of simple python text formatting, if Jinja2 is installed. Jinja2 gives you way more possibilities than python text formatting… I for example want a comment line above each entry, but only if a "comment" addon is defined (i.e., only if my regexps from #121 found one…). I don't think you can coax python string formatting into printing a ; {something} only if something is defined.

tinloaf avatar Nov 23 '18 23:11 tinloaf

Thanks both look good to me.

If you want to submit a merged pull request. I will merge it in.

petdr avatar Nov 24 '18 00:11 petdr