[LyX/master] Handle bibtex location field syntax file1;file2
Juergen Spitzmueller
spitz at lyx.org
Sat Sep 9 09:43:22 UTC 2023
commit ea55ca5e84f0a4b7f8143ef21336fecbabb76300
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sat Sep 9 12:57:51 2023 +0200
Handle bibtex location field syntax file1;file2
This is used, for instance, by zotero with the "betterbibtex" exporter
See #12896
---
src/BiblioInfo.cpp | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index c5094b2..63eb2f2 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -686,16 +686,22 @@ void BibTeXInfo::getLocators(docstring & doi, docstring & url, docstring & file)
// get "file" entry from citation record
file = operator[]("file");
- // Jabref case, field has a format:
+ // Jabref case, "file" field has a format (depending on exporter):
// Description:Location:Filetype;Description:Location:Filetype...
+ // or simply:
+ // Location;Location;...
// We will strip out the locations and return an \n-separated list
if (!file.empty()) {
docstring filelist;
vector<docstring> files = getVectorFromString(file, from_ascii(";"));
for (auto const & f : files) {
+ // first try if we have Description:Location:Filetype
docstring ret, filedest, tmp;
ret = split(f, tmp, ':');
tmp = split(ret, filedest, ':');
+ if (filedest.empty())
+ // we haven't, so use the whole string
+ filedest = f;
// TODO howto deal with relative directories?
FileName fn(to_utf8(filedest));
if (fn.exists()) {
@@ -708,7 +714,7 @@ void BibTeXInfo::getLocators(docstring & doi, docstring & url, docstring & file)
file = filelist;
}
- // kbibtex case, format:
+ // kbibtex case, "localfile" field with format:
// file1.pdf;file2.pdf
// We will strip out the locations and return an \n-separated list
docstring kfile;
More information about the lyx-cvs
mailing list