Closed jlegewie closed 7 years ago
Hmm, okay, I will have to experiment with the select links.
The suggestion seems reasonable. Should this be an option set in preferences -- copy as plain link, markdown link, or html link? For the other text, the function could use whatever format QuickCopy is set to.
The suggestion could either be a separate (optional) item menu "Copy formatted select item links" (with an option for html or markdown) or a preference... Both work, I think.
How are you testing the select item links? I tried with Zutilo 2.0.2 and Zotero 5.0-beta.135+12735fa. I used Zutilo to copy the link and then created a link in a note and clicked on it. I tried that a couple different items. It always selected the right item for me.
Also, I thought about the suggestion a little more. I think an export translator could be written to output a markdown or html link in the format you describe. Then you could just set that format to be the QuickCopy format (or one of the alternative QuickCopy formats in Zutilo's preferences).
Thanks for looking into it. I realized that I have the same problems with zotero links that are not coming from Zutilo. Sometimes it works, sometimes it doesn't but that is entirely unrelated to Zutilo. Sorry for the trouble.
By the way, here is Dan's info on the revised link format: https://groups.google.com/d/msg/zotero-dev/efFuMEqLarY/bZ167jIyGQAJ
But I am not sure whether anything has changed since then.
Thanks for pointing that out. So for Zotero 5.0 or greater, I can change the format to zotero://select/library/items?itemKey=4IRKVFFX
. The older format also included the libraryID
-- I guess that isn't needed? Are items selected inconsistently with this new format as well?
I would check with Dan about any changes to the format. In his post, he mentioned that the protocol handler still needs work in 5.
There is a different format for group libraries but I am not sure how it works. I thought it's this zotero://select/groups/317405/items?itemKey=VK9JBHWK
but that doesn't work.
Hmm, in very limited testing, the zotero://select/groups/317405/items?itemKey=VK9JBHWK
format worked for me for groups. I tried some other formats just to experiment and found that some unsupported formats resulted in the same item getting selected each time. Maybe that is similar to what you were seeing (maybe something was not formatted properly in your links?).
@dstillman maybe you can comment here. Zutilo has functions for copying either an item's select link or its Zotero URI (currents versions are here). I assume the URI function doesn't need to change because it just uses Zotero.URI.getItemURI
, but it seems like the select link format is old. What would be the best way to update it (least likely to break in the future)? Here is what I think would work for the newer format, but I am wondering if there is an equivalent to Zotero.URI.getItemURI
that would be more robust to future changes.
var libraryType = Zotero.Libraries.get(item.libraryID).libraryType;
switch (libraryType) {
case 'group':
var path = Zotero.URI.getLibraryPath(item.libraryID)
break;
case 'user':
var path = 'library'
break;
default:
// Feeds?
alert('Unsupported type')
}
var link = 'zotero://' + path + '/items?itemKey=' + item.key
I tried some other formats just to experiment and found that some unsupported formats resulted in the same item getting selected each time.
Old formats should still work, so if they're not, let me know what you're seeing and we can fix.
Your proposed code should work. (In theory it should also work with /items/<itemKey>
, though I'm not sure if it does currently.) There's no equivalent function, but we could have one (e.g., Zotero.URI.getClientURI(obj)
) that took an object or an array of objects and generated an appropriate URI.
(Related: We should also support users/<userID>
in order to mirror the web API more closely. /library
allows it to work even if the local user account changes, though, so if the function supported that it should probably be optional.)
I'm closing this because I think the conclusion was that the format Zutilo uses still works. Perhaps Zutilo should be updated to use the newer format but it seems like there are still some future changes planned to the protocol handler (like zotero/zotero#1176) so I'll leave it alone for now.
There was also the suggestion about adding the option to change the link format to markdown or html, but I think that can be done with an export translator and Zutilo's quickcopy shortcut, so I won't add a separate function for now.
Hey,
I am having a problem with the "Copy select item links" function. Zotero 5.0 always selects the same (and wrong) item. Might be a zotero problem and not zutilo but I also think that the link format changed in Zotero 5.
And a suggestion: formatted links in html or markdown. So Zutilo would copy something like this: