diff options
author | makefu <github@syntax-fehler.de> | 2018-12-02 23:42:17 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2018-12-02 23:42:17 +0100 |
commit | b88ce2f936d18ea7f2db6f3b8724086613a9c918 (patch) | |
tree | 1a793c7e10d19121ccc0bcd5f80011e898d31e24 | |
parent | a218c6040be6a8b765427528a1e6041167f3605a (diff) | |
parent | 45aef3a752af54575e00ac415ceaf51518b123ab (diff) |
Merge branch 'master' of github.com:krebscode/painload
-rwxr-xr-x | util/bin/dic | 78 |
1 files changed, 0 insertions, 78 deletions
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|<repr>|\nREPR: |g - s|</repr>|\n|g - ' | grep ^REPR | - sed ' - s/^REPR: // - 1~2{s/$//} - 2~2{s/$//} - ' | - tr -d \\n | - sed ' - s// [;30m-[m /g - s//\n/g - - #q - - s/⇔/⇔/g - s/ / /g; # - s/ */ /g - - # <!-- undefined_translation: en:pl_ext --> - s/ *<!--[^>]*-->//g - - s|<i> *|/|g - s| *</i>|/|g - - s:<sup>1</sup>:¹:g; s:<sup>2</sup>:²:g; s:<sup>3</sup>:³:g; - s:<sup>:^(:g - s:</sup>:):g - - s:<sub>0</sub>:₀:g; - s:<sub>1</sub>:₁:g; s:<sub>2</sub>:₂:g; s:<sub>3</sub>:₃:g; - s:<sub>4</sub>:₄:g; s:<sub>5</sub>:₅:g; s:<sub>6</sub>:₆:g; - s:<sub>7</sub>:₇:g; s:<sub>8</sub>:₈:g; s:<sub>9</sub>:₉:g; - s:<sub>:_(:g - s:</sub>:):g - - s:<b> *:[;4m:g - s: *</b>:[m:g - - s|<small> *|[;30;1m|g - s| *</small>|[m|g - - ' -} - -usage() { - sed -rn '/^# usage:/,/^[^#]/{/^#/{s/# //;p}}' "$0" >&2 -} - -main "$@" |