sawhney17 / logseq-citation-manager

73 stars 12 forks source link

[Bug, Feature Request] How to create multiple file links? #17

Open rsomani95 opened 1 year ago

rsomani95 commented 1 year ago

If a .bib entry has multiple files, only the first one is shown in the page (perhaps for the same reason as #14).

I'm curious what you think the best way to create links to multiple files would be? If I have a single file, I set up my template like so:

[attachment](file://{file})

which renders as a clickable link in the LogSeq page.

However, I'm not sure how to create these links if there are multiple attachments? I wouldn't be opposed to not having control over the name of the link - it could just be the name of the file itself (which can be done automatically). But, it must be a clickable link for it to be seamless.

The official LogSeq Zotero integration does quite nicely: CleanShot 2022-07-10 at 06 43 35


For reference, here's the .bib entry I was having trouble with

@misc{YOLOXExceedingYOLO__Ge.etal__2021,
  title = {{{YOLOX}}: {{Exceeding YOLO Series}} in 2021},
  shorttitle = {{{YOLOX}}},
  author = {Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian},
  date = {2021-08-05},
  url = {http://arxiv.org/abs/2107.08430},
  archiveprefix = {arXiv},
  file = {/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.pdf;/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.html}
}
sawhney17 commented 1 year ago

How about maybe using {file++} to insert every attachment in the form of

AttachmentName  AttachmentName AttachmentName

On 10 Jul 2022 at 5:14 AM +0400, Rahul Somani @.***>, wrote:

If a .bib entry has multiple files, only the first one is shown in the page (perhaps for the same reason as #14). I'm curious what you think the best way to create links to multiple files would be? If I have a single file, I set up my template like so: attachment which renders as a clickable link in the LogSeq page. However, I'm not sure how to create these links if there are multiple attachments? I wouldn't be opposed to not having control over the name of the link - it could just be the name of the file itself (which can be done automatically). But, it must be a clickable link for it to be seamless. The official LogSeq Zotero integration does quite nicely: For reference, here's the .bib entry I was having trouble with @misc{YOLOXExceedingYOLOGe.etal2021, title = {{{YOLOX}}: {{Exceeding YOLO Series}} in 2021}, shorttitle = {{{YOLOX}}}, author = {Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian}, date = {2021-08-05}, url = {http://arxiv.org/abs/2107.08430}, archiveprefix = {arXiv}, file = {/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.pdf;/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.html} } — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

rsomani95 commented 1 year ago

@sawhney17 Not sure I follow. I changed the template to be just {file++} but that doesn't work. I'm guessing that's not the full syntax?

sawhney17 commented 1 year ago

Oh no, I haven’t actually implemented this. I was just wondering if an approach like this would be suitable? On 10 Jul 2022 at 4:32 PM +0400, Rahul Somani @.***>, wrote:

@sawhney17 Not sure I follow. I changed the template to be just {file++} but that doesn't work. I'm guessing that's not the full syntax? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rsomani95 commented 1 year ago

Ah! I see. Yeah, I think that'd definitely work! Might be worth thinking about the command for bringing in all the keywords (tags) too (#14) as something similar's happening but wiki instead of file links need to be created. Perhaps {keyword+} would work?

sawhney17 commented 1 year ago

For the tags, you can now use keyword++ to make it all into tags. Working on the same with attachments now.

rsomani95 commented 1 year ago

@sawhney17 Great. I noticed the new field and tried out the WIP attachments also. The link works correctly when there's only one attachment (great!), but fails when there are multiple.

Take the following bib entry for example:

@misc{YOLOXExceedingYOLO__Ge.etal__2021,
  title = {{{YOLOX}}: {{Exceeding YOLO Series}} in 2021},
  ...
  file = {/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.pdf;/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.html}
}

Currently, in the plugin setting, I set fileTemplate -> Template for File URLS to be:

[{fileLink}](file://{fileLink})

With multiple attachments, this is what it pastes in the Note:

[/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.pdf;/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.html](file:///Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.pdf;/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.html)

Both links are concatenated, so it doesn't work.


Another suggestion I have is the ability to have only the file-name and not the entire fileLink from as the template. Currently with the above settings we get something like [full/path/to/filename.ext](full/path/to/filename.ext). Would be awesome if one could also get [filename.ext](full/path/to/filename.ext)

Maybe you've already implemented this and I just don't know the right template to use? Thought I'd bring it up anyways

zerone01y commented 1 year ago

Same here.

Can we possibly support zotero-imported-file of logseq? Current {file++} only works on one device, as the exported bib file uses absolute filepaths. But zotero-imported-file works cross-platform, as long as it is configured in the settings. It would require one additional variable, the zotero-id in the filepath.

sawhney17 commented 1 year ago

Quick question. Is the zotero id stored as part of the bib file?

I remember someone using the following expression in the template [{citekey}](zotero://select/items/@{citekey}) On 19 Jul 2022 at 12:19 PM +0400, lingyiy @.***>, wrote:

Same here. Can we possibly support zotero-imported-file of logseq? Current {file++} only works on one device, as the exported bib file uses absolute filepaths. But zotero-imported-file works cross-platform, as long as it is configured in the settings. It would require one additional variable, the zotero-id in the filepath. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zerone01y commented 1 year ago

No. It's contained in file entry though, like ..\\Zotero\\storage\\{zotero id}\\{filename}.

The expression you mentioned will open zotero directly. But if we have

[{filename}](zotero://select/library/items/{zotero id) {{zotero-imported-file {zotero id}, "{filename}"}}

then we can open the pdf directly in logseq.

rsomani95 commented 1 year ago

Currently, in the plugin setting, I set fileTemplate -> Template for File URLS to be:

[{fileLink}](file://{fileLink})

With multiple attachments, this is what it pastes in the Note:

[/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.pdf;/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.html](file:///Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.pdf;/Users/rahulsomani/ZotFiles/ge_et_al_2021_yolox2.html)

Both links are concatenated, so it doesn't work.

@sawhney17 did you have a chance to look at this?

flashlight123 commented 1 year ago

it's really frustrating, any solutions for this issue now?

Ravenclawer commented 1 year ago

is {file++}implemented for now?

mcopik commented 8 months ago

The problem is still present and makes the Zotero import much less automatic in place. Even with {file++}, the plugin generates an incorrect path for the PDF.