logseq-citation-manager icon indicating copy to clipboard operation
logseq-citation-manager copied to clipboard

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

Open rsomani95 opened this issue 2 years ago • 13 comments

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}
}

rsomani95 avatar Jul 10 '22 01:07 rsomani95

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{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} } — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

sawhney17 avatar Jul 10 '22 08:07 sawhney17

@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?

rsomani95 avatar Jul 10 '22 12:07 rsomani95

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: @.***>

sawhney17 avatar Jul 10 '22 12:07 sawhney17

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?

rsomani95 avatar Jul 10 '22 16:07 rsomani95

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

sawhney17 avatar Jul 11 '22 14:07 sawhney17

@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

rsomani95 avatar Jul 12 '22 03:07 rsomani95

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.

zerone01y avatar Jul 19 '22 08:07 zerone01y

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: @.***>

sawhney17 avatar Jul 19 '22 08:07 sawhney17

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.

zerone01y avatar Jul 19 '22 08:07 zerone01y

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?

rsomani95 avatar Nov 02 '22 02:11 rsomani95

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

flashlight123 avatar Feb 12 '23 07:02 flashlight123

is {file++}implemented for now?

Ravenclawer avatar Jun 16 '23 07:06 Ravenclawer

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.

mcopik avatar Oct 22 '23 21:10 mcopik