retorquere / zotero-better-bibtex

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

Import error with character '+' in BibTeX field name #2660

Closed zepinglee closed 1 year ago

zepinglee commented 1 year ago

Debug log ID

QAV4K73D-refs-euc/6.7.122-6

What happened?

An import error occurs when I import the following BibTeX entry (from plk/biblatex-apa/bibtex/bib/biblatex-apa-test-references.bib) into Zotero.

@BOOK{9.8:11,
  AUTHOR             = {U. Author},
  AUTHOR+an:username = {1="@ausername"},
  DATE               = {2014}
}

The error message says:

Import errors found:

- line 3, column 9: Expected "=", Optional Whitespace, or [_:a-zA-Z0-9\-] but "+" found.

It seems that BBT uses [_:a-zA-Z0-9\-]+ as the pattern of the field names but actually BibTeX and biber accepts more characters including +. According to https://github.com/aclements/biblib, the field pattern of the original BibTeX is [A-Za-z!$&*+\-./:;<>?@[\\\]^_`|~][0-9A-Za-z!$&*+\-./:;<>?@[\\\]^_`|~]*. This is [\x20-\x7f] excluding [ \t"#%'(),={}], initial digits, and '\x7f' which is rarely used.

Biber uses btparse as its parsing library with a different pattern for field name: [a-z0-9!$&*+\-./:;<>?[\]^_`|]+ (see its documentation). Unlike the original BibTeX, biber accepts initial digit but disallows @, \, and ~.

github-actions[bot] commented 1 year ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.122.2660.5129 ("upgrades")

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

retorquere commented 1 year ago

@njbart do you know what the nearest equivalent to @periodical @jurisdiction, @legislation, @legmaterial, @legadminmaterial, @constitution or @legal is?

github-actions[bot] commented 1 year ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.122.2660.5131 ("unknown entry types")

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

retorquere commented 1 year ago

Build 5131 will import the file you linked to, and has better item type matches for @audio, @dataset, @image and @presentation, some awkward choices for @hardware (becomes Zotero computer program) and @reference (becomes book). @periodical @jurisdiction, @legislation, @legmaterial, @legadminmaterial, @constitution or @legal still map to document until I find a better match.

zepinglee commented 1 year ago

Build 5131 will import the file you linked to, and has better item type matches for @audio, @dataset, @image and @presentation, some awkward choices for @hardware (becomes Zotero computer program) and @reference (becomes book). @periodical @jurisdiction, @legislation, @legmaterial, @legadminmaterial, @constitution or @legal still map to document until I find a better match.

retorquere commented 1 year ago

For 11.4:3, would Court be a good place for 9th Cir.. I'm currently putting it in extra as Authority.

retorquere commented 1 year ago

For the itemtypes mentioned above, this is what ends up in the extra field. Maybe there are more entries that have native Zotero fields that these should end up in.

github-actions[bot] commented 1 year ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.122.2660.5160 ("updates for #2660")

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

zepinglee commented 1 year ago

Thanks! It looks good to me.