Wikisource

I am new to Zotero. I am working on a large project that will be pulling lots of information from these two sources:

Dictionary of National Biography:
https://en.wikisource.org/wiki/Dictionary_of_National_Biography,_1885-1900

Encyclopedia Britannica 1911:
https://en.wikisource.org/wiki/1911_Encyclop%C3%A6dia_Britannica

When I go to these sites there is no icon in my address bar, so I have to right-click and save. It saves it as a webpage instead of an encyclopedia article and only gives me a couple of the pieces of information I need. So I have to end up entering most of the data myself, which defeats the purpose of using Zotero.

So how do I get Zotero to add those pages as an encyclopedia article with encyclopedia title, author (and also editor in the case of the Dictionary of National Biography), article title, URL, date accessed, and date modified?

I saw somewhere that there was a translator for wikisource, is that what I need? If so, where do I get it and how do I implement it?
  • the translator for Wikisource wasn't working and I just updated it, so after clicking on "Update Now" in the General Tab of the Zotero preferences, and reloading the page in question (when using Chrome/Safari you need to restart your browser) this will work. However, the wikisource translator is quite basic and treats anything on there as a manuscript. Given the lack of structured metadata on those pages, that's the best we can reasonably do right now, sorry.

    To customize the behavior, you'd have to modify the translator, which is a fairly technical undertaking--probably undoable if you've never coded in javascript (though not very hard if you have).
    https://www.zotero.org/support/dev/translators/coding
  • Thanks, I greatly appreciate it. This helps a lot. I was a CS minor in college, so I'm comfortable with programming, but I have not programmed in Javascript, and I have not programmed in anything in about 10 years, but I can try my hand at it. If I do manipulate the translator for the particular sites I want to use them on, how do I implement them?
  • if you use Scaffold and save your changes, they will be active for you immediately. Note that you should work on a separate version of the translator, with a different ID (Scaffold can auto-generate one with a click) so that Zotero doesn't overwrite your work on updates.
  • Okay, I have been working on this for quite a while. I am trying to get it working. I gave myself a little bit of a crash course on javascript. I like it, and it seems fairly straightforward. However, I am having trouble with the Xpath function and I cannot find a place anywhere that is able to explain the remove function attributes. For instance, what is the difference between .remove(/.+?\n\n/) and .remove(/\n.+/g)? I see that changing this removes different parts of the string that is collected, but I can't figure out what does what. When I go to the Abbadie entry in the Dictionary of National Biography on wikisource and use this command
    encyclopediaTitle : FW.Xpath('//span[@id="header_title_text"]').text().trim().remove(/\n.+/g),

    it returns Dictionary of National Biography, 1885-1900

    I don't want the date, so how do I get it to return only the name of the encyclopedia?

    Also, after I get that, can I treat encyclopediaTitle as a string in, say, an if then statement?
  • edited August 7, 2015
    .remove() takes a regular expression and removes anything that matches it.

    /.+?\n\n/will match everything (excluding newlines) up to the first double newline
    /\n.+/gwill match lines following a newline (so all lines that are not first line and that are not empty)

    https://regex101.com/ may be helpful to experiment with regular expressions.

    For your example, you can try something like .remove(/,\s*\d{4}-\d{4}\s*$/)
Sign In or Register to comment.