retorquere/zotero-report-customizer

Select items links added to report are not recognizing group items again

acsr opened this issue · 1 comments

acsr commented

Select item links are still useful

Beneath zotero-report-customizer is currently not working for the main purpose (omitting field content in the output by deselection in the UI) there is(was) still the useful feature to include to include select item links in the report.

Was working after fixing #42

e2ce253 fixed the incorrect group links for some time, but the if clause seems not to be working to recognize user groups anymore.

Links for group items broken

Generated links are now again always pointing to the main library while the item ID is correct for the group item.

Other settings checked

If you activate the hidden setting for weblinks extensions.zotero.report-customizer.link.web as true in the zotero config. The whole report is broken and empty.

Setting extensions.zotero.report-customizer.bibliography to true has no effect for me

If clauses may not work anymore

the code at https://github.com/retorquere/zotero-report-customizer/blob/master/content/report.pug#L39

mixin selectLink(item)
  - var link
  if Zotero.Prefs.get('report-customizer.link.web')
    - link = item.uri.replace(/^http:/, 'https:')
  else if ! item.libraryID || item.libraryID === Zotero.Libraries.userLibraryID
    - link = `zotero://select/library/items/${item.key}`
  else
    - link = `zotero://select/groups/${item.libraryID}/items/${item.key}`
  a(href=link) #{link}
  1. first checks just if the weblink config is set to true and then defaults to a weblink without further checking of group or main library (which is wrong, and leaves out the following clauses for group vs. main library.)
  2. the check if the item belongs to a group library seems too simple and is not working anymore.

Suggestion

please check the code in the official eta-template example for BetterBibTex I use in the Export Quick-Copy settings:
(from this suggestion of the author: https://forums.zotero.org/discussion/comment/384569/#Comment_384569)

<% it.items.forEach(function(item) { 
  const [ , kind, lib, key ] = item.uri.match(/^https?:\/\/zotero\.org\/(users|groups)\/((?:local\/)?[^/]+)\/items\/(.+)/)
  const select = (kind === 'users') ? `zotero://select/library/items/${key}` : `zotero://select/groups/${lib}/items/${key}`
%>[@<%= item.citationKey %>](<%= select %>)<% }) %>

This code works for me to generate proper differentiation of the select links when using Quick-Copy with BetterBibTex.

hope this helps to fix this again.

Fixing the weblink flag to differentiate group and main library could be another ticket.

acsr commented

related ticket #78 created with linking also to former reference ticket #67