diff --git a/configs/stardict.nix b/configs/stardict.nix index e30ebcf..51f4bfc 100644 --- a/configs/stardict.nix +++ b/configs/stardict.nix @@ -28,17 +28,8 @@ let }; Georges-Lat-De = pkgs.fetchzip { # TODO find out why this does not work with sdcv url = "http://tovotu.de/data/stardict/georges_lat-de.zip"; - # "http://download.huzheng.org/de/stardict-georges_lat-de-2.4.2.tar.bz2"; sha256 = "0cc5xipn60anxvq8z2mw53d4gi1k92wbrj9m4ws3g9rh87fmkvgz"; }; - SmithBiographyMythology = pkgs.fetchzip { - url = "https://github.com/latin-dict/Smith1873/releases/download/v1.0/Smith1873-stardict.zip"; - sha256 = "01h5fxacp2m60xir8kzslkfy772vs3vmz07zhdwfhcwdaxif2af2"; - }; - SmithAntiquities = pkgs.fetchzip { - url = "https://github.com/latin-dict/Smith1890/releases/download/v1.0/Smith1890-stardict.zip"; - sha256 = "0vpsv62p2lrzmgys4d1swpnc6lqhdi7rxwkj2ngy3lz5dk3fysyb"; - }; LewisShort = pkgs.fetchzip { url = "https://github.com/latin-dict/LewisShort1879/releases/download/v1.3/LewisShort1879-stardict.zip"; sha256 = "1y3ans47iv8bzzb1paimdqvcid8ms04ikjbqy3iw077i2js3qbjk"; @@ -58,14 +49,6 @@ let url = "http://download.huzheng.org/bigdict/stardict-Roget_s_II_The_New_Thesaurus_3th_Ed-2.4.2.tar.bz2"; sha256 = "1szyny9497bpyyccf9l5kr3bnw0wvl4cnsd0n1zscxpyzlsrqqbz"; }; - OED1 = builtins.fetchTarball { - url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P1-2.4.2.tar.bz2"; - sha256 = "0i5vv1rv44yfwyf9bfbdrb9brzhhpvz2jnh39fv8hh107nkv2vcf"; - }; - OED2 = builtins.fetchTarball { - url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P2-2.4.2.tar.bz2"; - sha256 = "1pk234pbq4pk55d8sjk0pp9j5sajm82f8804kf2xm2x5p387q1rg"; - }; JargonFile = builtins.fetchTarball { url = "http://download.huzheng.org/dict.org/stardict-dictd-jargon-2.4.2.tar.bz2"; sha256 = "096phar9qpmm0fnaqv5nz8x9lpxwnfj78g4vjfcfyd7kqp7iqla4"; @@ -90,6 +73,10 @@ let url = "http://download.huzheng.org/babylon/german/stardict-Duden_De_De-2.4.2.tar.bz2"; sha256 = "1fhay04w5aaj83axfmla2ql34nb60gb05dgv0k94ig7p8x4yxxlf"; }; + ConciseOED = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Concise_Oxford_English_Dictionary-2.4.2.tar.bz2"; + sha256 = "19kpcxbhqzpmhi94mp48nalgmsh6s7rsx1gb4kwkhirp2pbjcyl7"; + }; # Duden_Rechtschreibung = builtins.fetchTarball { # url = "http://download.huzheng.org/babylon/german/stardict-Duden_Rechtschreibung-2.4.2.tar.bz2"; # sha256 = "0xiprb45s88w62rn8rlbjrsagbiliay9hszsiy20glwabf6zsfji"; @@ -102,10 +89,6 @@ let # url = "http://download.huzheng.org/de/stardict-duden-2.4.2.tar.bz2"; # sha256 = "049i4ynfqqxykv1nlkyks94mvn14s22qdax5gg7hx1ks5y4xw64j"; # }; - # ConciseOED = builtins.fetchTarball { - # url = "http://download.huzheng.org/bigdict/stardict-Concise_Oxford_English_Dictionary-2.4.2.tar.bz2"; - # sha256 = "19kpcxbhqzpmhi94mp48nalgmsh6s7rsx1gb4kwkhirp2pbjcyl7"; - # }; # FreeOnlineDictionaryOfComputing = builtins.fetchTarball { # url = "http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_foldoc-2.4.2.tar.bz2"; # sha256 = "1lw2i8dzxpx929cpgvv0x366dnh4drr10wzqmrhcd0kvwglqawgm"; @@ -130,6 +113,99 @@ let }; }; makeStardictDataDir = dicts: pkgs.linkFarm "dictionaries" (lib.mapAttrsToList (name: path: { inherit name path; }) dicts); + + sdcvPager = pkgs.writeDash "sdcvPager" '' + export PATH=${lib.makeBinPath [pkgs.gnused pkgs.ncurses]} + sed " + s! style=\"color: #...\"!!g; + s!\([^<>]*\)!\1!g; + s!]*>!!g; + s!!!g; + s!\([^<>]*\)!\1 !g; + s!\([^<>]*\)!$(tput sitm)\2$(tput sgr0)!g; + s!\([^<>]*\)!\1!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!]*>\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; + s!\([^<>]*\)!$(tput setaf 3)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)\t!g; + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!$(tput sitm)!g + s!]*>!$(tput sgr0)!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!!!g + s!]*>!$(tput setaf 245)!g + s!]*>!$(tput sgr0)!g + s/
/$(tput bold)/g; + s:
:$(tput sgr0):g; + s/
/\n/g; + s:
::g; + s/<[bB]>/$(tput bold)/g; + s::$(tput sgr0):g; + s:<[bB][rR]\s*/\?>:\n:g; + s:<[iI]>:$(tput sitm):g; + s::$(tput sgr0):g; + s:<[uU]>:$(tput smul):g; + s::$(tput sgr0):g; + s:]*>::g; + s:::g; + s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)!g; + s!\([^<>]*\)!\2!g + s#
\(.*\)
#\\1#g; + s:\([^<>]*\):$(tput setaf 3)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 1)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 5)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput bold)\1$(tput sgr0):g + s:\([^<>]*\):$(tput setaf 3)\1$(tput sgr0):g + s:':':g + s:<:<:g + s:>:>:g + s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput bold)\\1$(tput sgr0):g; + s:]*>:ː:g; + s:]*>::g; + s!!!g + s!]*>!!g + s!!!g + s!]*>!!g + s!]*>!!g + s!\([^<>]*\)!$(tput setaf 245)\1$(tput sgr0)!g + s!]*>!!g + s! +! !g; + s!
!\n\n&!g + s!]*>!!g + s!]*>!!g + s!!!g # unbalanced in Frisk + s!^\s*[0-9])!$(tput setaf 5)&$(tput sgr0)!g + s#^\(-->.*\)\$#$(tput bold)\1$(tput sgr0)# + " + ''; in { # https://github.com/latin-dict/Georges1910/releases/download/v1.0/Georges1910-stardict.zip @@ -151,10 +227,26 @@ in url = "http://download.huzheng.org/lingvo/stardict-RG-LingvoUniversal-2.4.2.tar.bz2"; sha256 = "03f9wdmkgpjifpms7dyh10ma29wf3ka1j3zlp1av0cybhdldk2a8"; }; + SmithBiographyMythology = pkgs.fetchzip { + url = "https://github.com/latin-dict/Smith1873/releases/download/v1.0/Smith1873-stardict.zip"; + sha256 = "01h5fxacp2m60xir8kzslkfy772vs3vmz07zhdwfhcwdaxif2af2"; + }; + SmithAntiquities = pkgs.fetchzip { + url = "https://github.com/latin-dict/Smith1890/releases/download/v1.0/Smith1890-stardict.zip"; + sha256 = "0vpsv62p2lrzmgys4d1swpnc6lqhdi7rxwkj2ngy3lz5dk3fysyb"; + }; + OED1 = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P1-2.4.2.tar.bz2"; + sha256 = "0i5vv1rv44yfwyf9bfbdrb9brzhhpvz2jnh39fv8hh107nkv2vcf"; + }; + OED2 = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P2-2.4.2.tar.bz2"; + sha256 = "1pk234pbq4pk55d8sjk0pp9j5sajm82f8804kf2xm2x5p387q1rg"; + }; } // sanskritDictionaries // englishGermanDictionaries)); environment.variables = { - SDCV_PAGER = "${pkgs.w3m}/bin/w3m -T text/html -dump"; + SDCV_PAGER = toString sdcvPager; }; systemd.user.services.goldendict = {