mgmeyers / obsidian-zotero-integration

Insert and import citations, bibliographies, notes, and PDF annotations from Zotero into Obsidian.
GNU General Public License v3.0
1.09k stars 55 forks source link

Unable to pull annotations #392

Closed veljanoskid closed 2 months ago

veljanoskid commented 2 months ago

Hello, the Zotero integration app was working fine until yesterday. Now, I'm no longer able to pull any annotations (or notes) from annotated PDFs in Zotero. I've tried re-starting all applications, removed and re-downloaded Better Bib-tex and tried different annotation templates to no avail. I've also updated to Zotero 7.

Do you have any ideas about what's happened to stop annotations being pulled?

Versions I'm using: Obsidian Version 1.6.7 Zotero 7.0.3

This is the template file that I'm using:

tags: title: {{title}} authors: {{authors}} year: {{date | format("YYYY")}} publisher: {{publicationTitle}} keywords: [{{allTags}}] citekey: {{citekey}}

[!meta]- Metadata abstract:: {{abstractNote}} zotero_link:: {{pdfZoteroLink}} Related:: {% for relation in relations -%} {%- if relation.citekey -%} [[{{relation.citekey}}]], {% endif -%} {%- endfor%} url:: {{url}} doi:: {{doi}} bibliography:: {{bibliography}}


Webpage


Self Notes

{% persist "notes" %}

{% endpersist %}


Reading notes

{% persist "annotations" %}

{%- set zoteroColors = { "#2ea8e5": "blue", "#5fb236": "green", "#a28ae5": "purple", "#ff6666": "red", "#ffd400": "yellow", "#f19837": "orange", "#aaaaaa": "grey", "#e56eee": "magenta" } -%}

{%- set colorHeading = { "blue": "ℹ Background information, Prerequisites", "green": "❓ Assumptions, Questions, Goals, Problems", "purple": "📊 Main findings, Results, Conclusions", "red": "🧪Experimental details or Methods", "yellow": "⭐ Interesting point, Facts, Examples", "orange": "⚠️ Disagree with author", "grey": "📅 Vocabulary, Names, Dates, Definitions", "magenta": "📄 Important references" } -%}

{%- macro calloutHeader(type) -%} {%- switch type -%} {%- case "highlight" -%} Highlight {%- case "image" -%} Image {%- default -%} Note {%- endswitch -%} {%- endmacro %}

{%- set newAnnot = [] -%} {%- set newAnnotations = [] -%} {%- set annotations = annotations | filterby("date", "dateafter", lastImportDate) %}

{% if annotations.length > 0 %} Imported: {{importDate | format("YYYY-MM-DD HH:mm")}}

{%- for annot in annotations -%}

{%- if annot.color in zoteroColors -%}
    {%- set customColor = zoteroColors[annot.color] -%}
{%- elif annot.colorCategory|lower in colorHeading -%}
    {%- set customColor = annot.colorCategory|lower -%}
{%- else -%}
    {%- set customColor = "other" -%}
{%- endif -%}

{%- set newAnnotations = (newAnnotations.push({"annotation": annot, "customColor": customColor}), newAnnotations) -%}

{%- endfor -%}

{#- INSERT ANNOTATIONS -#} {#- Loops through each of the available colors and only inserts matching annotations -#} {#- This is a workaround for inserting categories in a predefined order (instead of using groupby & the order in which they appear in the PDF) -#}

{%- for color, heading in colorHeading -%} {%- for entry in newAnnotations | filterby ("customColor", "startswith", color) -%} {%- set annot = entry.annotation -%}

{%- if entry and loop.first %}

{{colorHeading[color]}}

{%- endif %}

[!quote{{"|" + color if color != "other"}}]+ {{calloutHeader(annot.type)}} (page. {{annot.pageLabel}})

{%- if annot.annotatedText %}

{{annot.annotatedText|nl2br}} {% if annot.hashTags %}{{annot.hashTags}}{% endif -%} {%- endif %}

{%- if annot.imageRelativePath %}

![[{{annot.imageRelativePath}}]] {%- endif %}

{%- if annot.ocrText %}

{{annot.ocrText}} {%- endif %}

{%- if annot.comment %}

  • {{annot.comment|nl2br}} {%- endif -%}

{%- endfor -%} {%- endfor -%} {% endif %} {% endpersist %}