Extra spaces between imported Zotero annotations

What I’m trying to do

After a great deal of trial and error, I final got the Zotero annotations to import the way I wanted. The one problem is for some reason, it skips like 3 lines in between each imported annotation.

Here is the code of my template.

Title: {{title}}
Author(s): {{authors}}
Year: {{date | format(“YYYY”)}}
Link: {{pdfZoteroLink}}
Tags:

Notes

{% persist “Notes” %}

{%- endpersist %}

Annotations

{% persist “annotations” %}
{% set annots = annotations | filterby(“date”, “dateafter”, lastImportDate) -%}
{% if annots.length > 0 %}
{% for annot in annots -%}
{%- if annot.imageRelativePath %}

[!Image | {{annot.color}}]
![[{{annot.imageRelativePath}}]]
{%- endif %}

{%- if annot.comment %}

[!comment | {{annot.color}}]
{{annot.comment | nl2br}}
{%- endif %}

{% if annot.annotatedText %}{% if ‘Blue’ in annot.colorCategory%}

  • {{annot.annotatedText}} ({{annot.page}}){% else %}
    {% if ‘Orange’ in annot.colorCategory %}

{{annot.annotatedText}}{% else %}

  • {{annot.annotatedText}} ({{annot.page}}){% endif -%}
    {%- endif %}{%- endif %}{%- endfor %}{%- endif %}{%- endpersist %}

Things I have tried

I’ve tried getting rid of all of the skipped line after the callouts, but that seems to confuse it.
I’ve also tried compressing the coding stuff but that does nothing (like putting all the ‘end’ things on a single line)

I am not a tech person, so please let me know if there is anything else you need. Also please be very explicit with instructions.

Thanks!

I had a similar problem. Because I was too lazy to read which loop does what to point out the exact problem (to do with empty lines), I just fed your question to a bot and got back this:

I did not try it, mind you.