Zotero-ODF-Scan / zotero-odf-scan

Some tools for Zotero
32 stars 7 forks source link

Add bookmarklet for zotero.org #13

Closed aurimasv closed 10 years ago

aurimasv commented 10 years ago

I'll feel pretty dumb if this is already available (I didn't see it), but here goes. This is a bookmarklet that will generate barebone ODF/RDF marker for selected citations on zotero.org

The bookmarklet-mini.js is just bookmarklet.js passed through http://chriszarate.github.io/bookmarkleter/ but with !function(){...}() wrapper converted to (function(){...})(), which works better on Firefox.

Please double-check the item key that is created. I haven't tested it with actual ODF/RDF scan.

adam3smith commented 10 years ago

the key looks good. How hard would it be to add at least the author after the first pipe? You're already parsing the JSON, aren't you?

aurimasv commented 10 years ago

It wouldn't be terribly hard, though the JSON we're parsing above doesn't contain those details. I was just being lazy and didn't want to try accounting for cases with multiple authors, missing authors, missing dates, missing everything... Will take a look at it in a bit.

adam3smith commented 10 years ago

See if it's worth it. Two reasons I'd like to have it:

  1. Many users don't actually understand that whatever is between the 1st and 2nd pipe is ignored except for the -.
  2. You can't keep track of what you're citing in a document with only markers. Can be simpler than our algorithm in the translator, just do n.a. and n.d. for no author/no date.
aurimasv commented 10 years ago

Forgot to change the comment at the top, but give this a go. Should work pretty well I think.

aurimasv commented 10 years ago

BTW, we should probably serve the bookmarklet via something like https://github.com/matthodan/bookmarklet-loader instead of directly for easier updating.

Edit: but that loader needs some tweaking

aurimasv commented 10 years ago

OK, one last thing that I'm on the fence on is the form of the citation after the first pipe. Scannable Cites produces Smith, (2001), which doesn't make much sense, since most of the author-date styles produce (Smith, 2001), no? Furthermore, even this latter form doesn't make sense in the marker, since prefix, suffix, etc. are supposed to end up inside the parentheses. In the marker, IMO, the parentheses are supposed to be represented by the braces, so, I think, the following should be the marker format: {|Smith, 2001|||zu:123:ABCD1234}. Is there a reason for year in parentheses?

fbennett commented 10 years ago

As the time I wrote the code, I probably mimicked Bluebook cite forms, which place the year in parens at the end. In MLZ "wrapped cites" mode, the CSL-generated form of the currently selected default export style is written in there. It really doesn't matter, so long as enough information is provided for a human reader to distinguish the cited source.

The only thing I would ask is that allowance be made for items with no author (statutes, legal cases, others), but you've already done that.

aurimasv commented 10 years ago

OK. I dropped the parentheses. It's {|Smith, 2001|||zu:1234:ABCD1234} now. Have nothing more planned for this, so if you have no other concerns, feel free to merge.

fbennett commented 10 years ago

Looks great to me - a nice addition. Sebastian?