From 45aef3a752af54575e00ac415ceaf51518b123ab Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 11 Nov 2016 11:46:58 +0100 Subject: dic: move to dedicated repo --- util/bin/dic | 78 ------------------------------------------------------------ 1 file changed, 78 deletions(-) delete mode 100755 util/bin/dic diff --git a/util/bin/dic b/util/bin/dic deleted file mode 100755 index b3dac847..00000000 --- a/util/bin/dic +++ /dev/null @@ -1,78 +0,0 @@ -#! /bin/sh -# usage: dic WORD [LANG] -# where LANG may be one of en, fr, es, it, ch, ru, pt, pl -# multiple WORDs may be seperated by + like this: multiple+words -set -euf - -main() { - - case $# in - 1|2) :;; # ok - *) usage; exit 23;; - esac - - # all three are used by GET - search="$1" - langlang="${2-en}de" - lang="de" - - GET | simplify | tac -} - -GET() { - curl -sS -b 'LEOABTEST=T; browser=webkit%3B5%3Bajax' \ - "https://dict.leo.org/dictQuery/m-vocab/$langlang/query.xml?tolerMode=nof&lp=$langlang&lang=$lang&rmWords=off&rmSearch=on&search=$search&searchLoc=0&resultOrder=basic&multiwordShowSingle=on" -} - -simplify() { - sed ' - s||\nREPR: |g - s||\n|g - ' | grep ^REPR | - sed ' - s/^REPR: // - 1~2{s/$//} - 2~2{s/$//} - ' | - tr -d \\n | - sed ' - s// - /g - s//\n/g - - #q - - s/⇔/⇔/g - s/ / /g; #   - s/ */ /g - - # - s/ *//g - - s| *|/|g - s| *|/|g - - s:1:¹:g; s:2:²:g; s:3:³:g; - s::^(:g - s::):g - - s:0:₀:g; - s:1:₁:g; s:2:₂:g; s:3:₃:g; - s:4:₄:g; s:5:₅:g; s:6:₆:g; - s:7:₇:g; s:8:₈:g; s:9:₉:g; - s::_(:g - s::):g - - s: *::g - s: *::g - - s| *||g - s| *||g - - ' -} - -usage() { - sed -rn '/^# usage:/,/^[^#]/{/^#/{s/# //;p}}' "$0" >&2 -} - -main "$@" -- cgit v1.2.3