sawhney17 / logseq-citation-manager

73 stars 11 forks source link

parse JabRef file entries #44

Open reox opened 2 years ago

reox commented 2 years ago

Jabref writes some meta information in the file field as

description:actual file:file format

for example a PDF file without a description:

:files/some.pdf:PDF

This however does not work well together with this plugin, as in the template expansion the full content of the file entry is used. Would it be possible to split up the string and provide separate template variables to be able to format the correct link? Note, that in the description and actual file also colons can appear, but are escaped with \, for example:

my\:description:http\://example.com:text/html

I guess one option would be here: https://github.com/sawhney17/logseq-citation-manager/blob/f5988dbfc17cac5b9e26051f3910483798879518/src/utils.ts#L77-L87 to use a regex like ((\\:)|[^:])* to check if there are multiple matches. Or is this actually something that should be directed to the bibtex parser https://github.com/retorquere/bibtex-parser ?

mcopik commented 1 year ago

This is an essential feature to integrate seamlessly JabRef database with logseq.

Siedlerchr commented 1 year ago

For reference, the code in JabRef that handles file fields is this one: https://github.com/JabRef/jabref/blob/4230b5d177c43360c4c26ce003db0a661dc71d63/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java#L15

ehehela commented 8 months ago

Besides parsing the pdf file path, I think logseq-citation-manager could append page url (created by command Create Inline Link to Lit Note) or block url (created by command Create Inline Literature Note) to the comment field of .bib file, such as [Logseq Notes](logseq://graph/Logseq?page=citekey). This markdown format can be identified and displayed in preview window by JabRef, which creates bi-directional links.