// Jabref case, field has a format:
// Description:Location:Filetype;Description:Location:Filetype...
- // We will grab only first pdf
+ // We will strip out the locations and return an \n-separated list
if (!file.empty()) {
- docstring ret, filedest, tmp;
- ret = split(file, tmp, ':');
- tmp = split(ret, filedest, ':');
- //TODO howto deal with relative directories?
- FileName f(to_utf8(filedest));
- if (f.exists())
- file = "file:///" + filedest;
+ docstring filelist;
+ vector<docstring> files = getVectorFromString(file, from_ascii(";"));
+ for (auto const & f : files) {
+ docstring ret, filedest, tmp;
+ ret = split(f, tmp, ':');
+ tmp = split(ret, filedest, ':');
+ // TODO howto deal with relative directories?
+ FileName fn(to_utf8(filedest));
+ if (fn.exists()) {
+ if (!filelist.empty())
+ filelist += '\n';
+ filelist += "file:///" + filedest;
+ }
+ }
+ if (!filelist.empty())
+ file = filelist;
}
// kbibtex case, format:
// file1.pdf;file2.pdf
- // We will grab only first pdf
+ // We will strip out the locations and return an \n-separated list
docstring kfile;
if (file.empty())
kfile = operator[]("localfile");
if (!kfile.empty()) {
- docstring filedest, tmp;
- tmp = split(kfile, filedest, ';');
- //TODO howto deal with relative directories?
- FileName f(to_utf8(filedest));
- if (f.exists())
- file = "file:///" + filedest;
+ docstring filelist;
+ vector<docstring> files = getVectorFromString(kfile, from_ascii(";"));
+ for (auto const & f : files) {
+ // TODO howto deal with relative directories?
+ FileName fn(to_utf8(f));
+ if (fn.exists()) {
+ if (!filelist.empty())
+ filelist += '\n';
+ filelist = "file:///" + f;
+ }
+ }
+ if (!filelist.empty())
+ file = filelist;
}
if (!url.empty())
void showTarget(string const & target_in, Buffer const & buf)
{
- LYXERR(Debug::INSETS, "Showtarget:" << target_in << "\n");
+ LYXERR(Debug::INSETS, "Showtarget: " << target_in << "\n");
string target = target_in;
string const & docpath = buf.absFileName();
+ vector<string> targets;
bool const is_external = prefixIs(target, "EXTERNAL ");
if (is_external) {
return;
}
// lyxpaperview returns a \n-separated list of paths
- vector<string> targets = getVectorFromString(rtrim(ret.result, "\n"), "\n");
+ targets = getVectorFromString(rtrim(ret.result, "\n"), "\n");
if (targets.empty()) {
frontend::Alert::error(_("Could not open file"),
bformat(_("No file was found using the pattern `%1$s'."),
from_utf8(tar)));
return;
}
+ }
+ if (prefixIs(target, "file://")) {
+ // file might have a \n-separated list of paths
+ targets = getVectorFromString(target, "\n");
+ }
+ if (!targets.empty()) {
if (targets.size() > 1) {
QStringList files;
for (auto const & t : targets)