From 8a947059a9fb5ed1b40ef9c734b04491e8f8c2f7 Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Fri, 6 Sep 2019 19:58:01 +0200 Subject: [PATCH] [folkets] Initail on Fokets Lexikon wrapper. The program works as expected. Some improvements possible: * Use w3m also for calling (limit complexity) * Consider make a short version for std out * Force w3m quit without confirmation (that is how mutt is using w3m) --- Makefile | 1 + folkets | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 folkets diff --git a/Makefile b/Makefile index 7605272..1f707f9 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ confluence-tk \ json2yaml \ yaml2json \ ip-check \ +folkets \ bash-completion = \ diff --git a/folkets b/folkets new file mode 100755 index 0000000..9f69e81 --- /dev/null +++ b/folkets @@ -0,0 +1,29 @@ +#!/bin/bash + +# provides translatsions with Folkets lexicon + +set -e + +BASE="https://folkets-lexikon.csc.kth.se" +LOC="folkets/service" +LANG="both" +INTERFACE="sv" +LOG="/tmp/folkets/error.out" +HTML="/tmp/folkets/out.html" + +word="$1" + +url="$BASE/$LOC" + +form=" + --data-urlencode word=$word + --data-urlencode lang=$LANG + --data-urlencode interface=$INTERFACE +" + +mkdir -p $(dirname $LOG $HTML) + +curl -v -L --get ${form} ${url} 2> $LOG | w3m -T text/html + +# Consider make also the call with w3m +# Consider put on stdout -- 2.39.2