Some framework translators do not import keywords to tags

Keywords are not imported as tags with some framework translators. The issue came up on the RePEc translator thread.
The problem is that the split() function in e.g. FW.Xpath('//meta[@name="citation_keywords"]/@content').text().split(/;/), adds a second pair of squared brackets around the tags array, i.e. "tags": [["keyword 1","keyword 2"]].
The solution is to append the trim() function, i.e.
FW.Xpath('//meta[@name="citation_keywords"]/@content').text().split(/;/).trim(),
so that it becomes "tags": ["keyword 1","keyword 2"]

ASCE, Emerald Publishing, The New Yorker, The Daily Beast, and both RePEc translators are affected at least.
  • Added as a ticket, see https://bitbucket.org/egh/zotero-transfw/issue/2/nested-arrays
  • Resolved in latest version, I believe. There should be no need to use a trim() at the end.

    I don't usually read the zotero forums, but I do read zotero-dev and I will get email if you add tickets to the bitbucket tracker. Thanks for the bug report!
  • sorry, this was my bad - I meant to let you know and then forgot about it.
  • Is this safe to roll into a new Scaffold build now?
  • No trouble! I should spend more time on the forums in any case.
  • Its a pretty small fix: just one line. Now applyFilters flattens lists, (e.g. [[1,2],3,4] -> [1,2,3,4]) before it returns them. Previously this only happened before the next filter was applied, which is why using split() as the end returned [[tag1, tag2]] but adding trim() afterwards flattened it to [tag1, tag2].
  • Scaffold updated to include the latest framework code. Thanks, Erik. I've opened a pull request for updating the translators to the latest code (https://github.com/zotero/translators/pull/199).
Sign In or Register to comment.