Unable to add record - translator issue?

I tried to add this article to my database but I got an error message about "translators": http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0012968
  • yep - looks like a translator issue
    [JavaScript Error: "TypeError: text.match(/UR\s+\-\s+(.*)/) is null" {file: "file:///C:/Users/Lexi/AppData/Roaming/Mozilla/Firefox/Profiles/2orbmq3e.Sebastian/zotero/translators/PLoS%20Journals.js" line: 0}]
  • It is a problem, but I'm having trouble nailing it down. There's something about the RIS output the PLoS is giving us that makes the translator choke. I've set it aside for now. Do other PLoS pages work for you?
  • edited July 1, 2011
    I haven't got Scaffold running here, but from a quick look at the RIS, could be problem be in the double space in the UR field?

    UR - http://dx.doi.org/10.1371%2Fjournal.pone.0012968

    The RegEx only expects there to be one after "UR", right? I think "/UR\s*\-\s+(.*)/" should work.
  • No, there should always be a double space. Single spaces are a violation of the RIS spec, although we allow them now, since many programs violate it in precisely this way.
  • And the regular expression is currently looking for one or more space, which is exactly what we should look for.
  • Oops, I guess I have to hand in my XKCD T-shirt now.

    http://store.xkcd.com/xkcd/#RegularExpressionsShirt
  • In an effort to redeem myself (I actually have the T-shirt, and I'd like to keep it), I found the problem. The line

    text = text.replace(text.match(/(ER[^\n]*)([^\0]*)/)[2],"");
    matches the "ER" in the paper title ("MEK/ERK Cell Signaling Pathway"), which messes things up. I'm not sure it's the best solution, but

    text = text.replace(text.match(/(\nER[^\n]*)([^\0]*)/)[2],"");
    works (the RegEx now requires a linefeed before the "ER").
  • edited July 1, 2011
    Thanks, Rintze. I've opted for:
    text = text.replace(text.match(/(^\s*ER[^\n]*)([^\0]*)/m)[2],"");
    It accomplishes the same thing, but will work on \r-delimited lines as well (note the m flag to make the match work in multiline mode).

    Please go to http://github.com/ajlyon/zotero-bits/raw/master/PLoS Journals.js and save the file to the translators directory of your Zotero data directory (http://www.zotero.org/support/zotero_data).

    It should start working again. If this works for you, please post here so that I can submit this change to be pushed to all users.
Sign In or Register to comment.