pjheslin / diogenes

Diogenes: an environment for reading Latin and Greek
https://d.iogen.es/d
Other
56 stars 10 forks source link

Adding other lexicons #105

Open levYatsishin opened 1 year ago

levYatsishin commented 1 year ago

I've recently found your magnificent application, which surely will make my life a lot easier! But there is just one issue. I usually use some lexicons besides LSJ, and it would be just perfect if I could add them to pop up alongside LSJ. Is there any way to parse additional(for example .dsl) files for the selected lemma?

jiang-qian commented 8 months ago

There is a way to add other dictionaries via a dictionary program called silverdict. Installing silverdict on windows is quite straightforward and then you can modify one line of Diogenes to at that function. https://github.com/Crissium/SilverDict I don't know how comfortable you are about installing silverdict and other dictionaries to it and then modifying Diogenes. Just want you to know that this could be done

Crissium commented 5 months ago

I am the developer of the above-mentioned program and here's how to integrate it into Diogenes before the pull request (#110) gets merged.

First, patch server/Diogenes/Perseus.pm by adding the following lines after the subroutine old_pdf_link at the lines 630 - 659:

my $silverdict_link = sub {
    my $word = shift;
    my $href = "http://localhost:2628/?group=Diogenes&key=$word";
    # We'll use a popup window to view the definition
    return qq{ <a onClick="window.open('$href', 'SilverDict', 'width=500,height=600,left='+ (window.screen.width - 500) +',top='+ (window.screen.height - 600)); return false;" href="#"><i>SilverDict</i></a>};
};

Also add the following line after the line $out .= $old_pdf_link->($key); in the munge_element subroutine.

        $out .= $silverdict_link->($key);

Here's a screenshot showing what the code looks like after modifying.

Screenshot_2024-03-17_17-25-29

Screenshot_2024-03-17_17-32-20

If you know how to do it, you could tweak the width and the height of the pop-up window.

Then, in SilverDict, create a new group named 'Diogenes' (without quotes) with the languages el, la and add the lexica you need.

Now restart the server and a 'SilverDict' link would appear if you click on a word.