Open Elaws opened 2 years ago
Hi @Elaws,
idk why but the plugin converts the custom variables to lower case. So, in your case, fileRelative
would be filerelative
.
I hope it helps.
Hi @Elaws @epelaez1 , I want to ask some questions. How to export the fileRelative
field? I only get the file
field.
And I tried {{entry.data.fields.file.[0]}}
, it gives the whole list, instead of the first element. What is the right syntax? How can I fix it?
BTW, I tried {{entry.data.fields.file[0]}}
and it didn't work.
And there might be another question. How can I export only the file name, not the file path?
Thanks a lot @epelaez1, now I have something ! However, the formatting is completely wrong :
Zotero storage DWDDHZU3 Adler - 2002 - The study of orchestration.pdf;Zotero storage EB6ADAID OrchestrationAdler.pdf;Zotero storage J6FYUPXG instrumentranges.pdf;Zotero storage KVJWM5SY instrumentₙames.pdf
instead of :
Zotero\storage\DWDDHZU3\Adler - 2002 - The study of orchestration.pdf Zotero\storage\EB6ADAID\Orchestration_Adler.pdf
There seems to be a problem with some escape characters, when using {{entry.data.fields.filerelative.[0]}}
.
@Seraphli :
How to export the fileRelative field? I only get the file field.
It is something I added manually in my BetterBibLaTeX export, with a postscript. I think this comment should help you. But as mentioned above, I have a formatting issue for now.
And I tried {{entry.data.fields.file.[0]}}, it gives the whole list, instead of the first element. What is the right syntax? How can I fix it?
The proper syntax is {{entry.files.[0]}}
.
How can I export only the file name, not the file path?
I don't understand, could you please elaborate ? The filename can be retrieved with {{title}}
.
But honestly, I feel that all of this is very convoluted, it should be much more streamlined. I'm looking at Zotero v6 and Zotero iOS app, maybe it brings more elegant solutions for that. I also just discovered another Zotero plugin for Obsidian, maybe easier to use.
@Elaws I have created an issue about the escape behavior before. If you want to temporarily fix this issue, you can check out my comments. https://github.com/hans/obsidian-citation-plugin/issues/202
@Seraphli : Thanks for your reply.
Because when I change the postscript to replace the eprint key instead of creating a new key, the template works fine.
Could you please add details to what you modified in the postscript to make it work ?
@Elaws Check out this post. https://github.com/retorquere/zotero-better-bibtex/discussions/2311
I simply find out if you replace the key with eprint
and that will work. I think it is because the key eprint
is defined in the abstract data class.
if (Translator.BetterTeX && item.attachments) {
var filename = item.attachments
.filter(att => att.localPath && att.localPath.match(/\.pdf$/i))
.map(att => att.localPath.replace(/.*[\\/]/, ''))
.find(att => att)
tex.add({ name: 'eprint', value: filename, enc: 'raw' })
}
Hello,
When defining a custom variable with multiple values (e.g. see
fileRelative
below), it seems they can't be accessed usingdata.entry.fields
:When using
{{entry.data.fields.fileRelative.[0]}}
or{{entry.data.fields.fileRelative.[1]}}
in Citations' template, nothing appears in the note created (no error log in Obsidian console either).I would appreciate any help you can provide, thanks !