retorquere / zotero-better-bibtex

Make Zotero effective for us LaTeX holdouts
https://retorque.re/zotero-better-bibtex/
MIT License
5.43k stars 291 forks source link

Postscripts not working - entry is not defined #2065

Closed jonschz closed 2 years ago

jonschz commented 2 years ago

log ID: 3GR9BD8M-euc

I cannot get postscripts to work in Zotero version 5.0.96, BBT version 6.2.10 (other versions not tested). Export -> Postscript is set to the example from here:

if (Translator.BetterBibTeX && item.itemType === 'webpage') {
    if (item.accessDate) {
      entry.add({ name: 'note', value: "(accessed " + item.accessDate.replace(/\s*T?\d+:\d+:\d+.*/, '') + ")" });
    }
    if (item.url) {
      entry.add({ name: 'howpublished', bibtex: "{\\url{" + entry.enc_verbatim({value: item.url}) + "}}" });
    }
  }

I get the following error in the Zotero console:

Reference.postscript failed: <Error: ReferenceError: entry is not defined in resource://zotero-better-bibtex/Better%20BibTeX.js line 74155 > Function line undefined anonymous/result<@resource://zotero-better-bibtex/Better%20BibTeX.js line 74155 > Function:10:7 anonymous@resource://zotero-better-bibtex/Better%20BibTeX.js line 74155 > Function:7:20 complete@resource://zotero-better-bibtex/Better%20BibTeX.js:74546:17 doExport@resource://zotero-better-bibtex/Better%20BibTeX.js:75319:7 Zotero__workerContext</ctx.onmessage@resource://zotero-better-bibtex/worker/zotero.js?version=5.0.96.3&platform=win&translator=Better%20BibTeX&output=[...]bibtex.bib&localeDateOrder=dmy&debugEnabled=true&worker=15:46631:11 >

Any reference to entry causes this problem. Reading and outputting item works fine.

retorquere commented 2 years ago

I need a log generated by right-clicking an item and sending it from the popup menu; it will have -refs in the ID. If the problem happens with any item (and I expect it will), any item will do.

github-actions[bot] commented 2 years ago

:robot: this is your friendly neighborhood build bot announcing test build 6.2.11.2174 ("fixes #2065")

Install in Zotero by downloading test build 6.2.11.2174, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

jonschz commented 2 years ago

log ID: 237HUNMH-refs-euc

While trying to reproduce the issue, I was able to nail it down to a single bibliography entry causing this error. I have attached a .rdf file, just in case.

problematic entry.zip

In any case, the issue appears to be fixed with the test build you provided. Thank you very much!

retorquere commented 2 years ago

thank you, a new build is running for release