[LyX/master] New attempt on #9906: allow following hyperlinks via context menu.
Richard Kimberly Heck
rikiheck at lyx.org
Thu Aug 20 02:13:56 UTC 2020
On 8/19/20 5:34 PM, Pavel Sanda wrote:
> On Tue, Aug 18, 2020 at 10:21:23PM -0400, Richard Kimberly Heck wrote:
>
>>> + if (is_bibtex_) {
>>> + doi = operator[]("doi");
>>> + if (!doi.empty() && !prefixIs(doi,from_ascii("http")))
>>> + doi = "https://doi.org/" + doi;
>>> + url = operator[]("url");
>> I'm confused about what this is for. Comment?
> Not sure what line you refer to. A
I meant the url variable. I guess all these things are returned to the
caller, yes? Maybe a comment somewhere to that effect.+ file =
operator[]("file");
>>> +
>>> + // Jabref case, field has a format:
>>> + // Description:Location:Filetype;Description:Location:Filetype...
>>> + // We will grab only first pdf
>> Since the second might be an absolute path, it might be worth a loop.
>> Shouldn't be too hard. Just split on ; first and loop over the results.
>> (Same with kbibtex.)
> Makes sense. Do you prefer me to commit it now and continue working on updates
> within master or wait for finished patch? (I won't have time to work on this
> in next days).
I think it's fine to commit, and we can polish it as time permits.
>>> + FileName f(to_utf8(filedest));
>>> + if (f.exists())
>>> + file = "file:///" + filedest;
>>> + }
>>> +
>>> + // kbibtex case, format:
>>> + // file1.pdf;file2.pdf
>>> + // We will grab only first pdf
>>> + 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;
>>> + }
>> It occurred to me (and maybe I'll do this) that we could possibly have a
>> configuration file for this that would look something like:
>>
>> localfile : ^([^;]+?)
>> file ^:([^:]+?)
>>
>> I.e., for each possible field, we have a regex telling how to get the
>> path we want. That could simplify the code, too.
> Please feel free to adjust the code for files any way you want once committed.
> I coded the whole biblatex + jabref/kbibtex part without testing because
> I don't use these tools. It was nice surprise that it actually worked
> for both Juergen and you ;) I suspect that there will be bunch of other
> tools and other people will fill in those gaps later.
Seems reasonable.
Nice work on this. It's been a long time we've been trying to figure
this out.
Riki
More information about the lyx-devel
mailing list