Wikiwurdboek:Skripts

De folgjende skripts kinne brûkt wurde by it bewurkjen fan it wikiwurdboek.

Oersettings

bewurkje

Dizze skripts dogge it rûge wurk. Hjir en dêr sille der noch wurdsjes oerset of taalkoades taheakke wurde moatte, benammen yn de sublisten.

UN*X of webblêder

bewurkje
#!/bin/sh
# Skript set oersettings fan nlwikt/enwikt om foar fywikt Berjocht:trans-top.
# Gebrûk POSIX shell of https://tio.run/#bash en set de koade tusken de EOF-rigels.
LANG="en_US.UTF-8"; export LANG
TAC=$(command -v tac) || TAC="tail -r"
(
$TAC <<'EOF'
*{{afr}}: {{trad|af|voël}}
*{{jpn}}:
**Kanji: {{trad|ja|鳥}}
**Hiragana: {{trad|ja|とり}}
**Romaji: {{trad|ja|tori}}
{{trans-mid}}
* Afrikaans: {{t+|af|voël}}
* Sorbian:
*: Lower Sorbian: {{t|dsb|ptašk|m}}
*: Upper Sorbian: {{t|hsb|ptačk|m}}
EOF
) | sed -e '/{{trans-mid}}/d' \
-e '/^::[*]/ba' \
-e 's/^:*[*][[:space:]]*{{[[:lower:]][[:lower:]][[:lower:]]}}[[:space:]]*:[[:space:]]*\({{trad|[[:space:]]*\)\([[:lower:]][[:lower:]]\)\([[:space:]]*[|}]\)/* {{\2}}: \1\2\3/' \
-e ':a' \
-e "s/^[*][[:space:]]*{{\([^[:space:]:]*\)}}[[:space:]]*:[[:space:]]*/| \1$(printf '\t\t')= /" \
-e "s/$(printf '\t\t')= \([^/]*\)<\/dd>\(.*\)/$(printf '\t\t')= \1\2<\/dd>/" \
-e 't' \
-e 's/^:[*]/*/' \
-e 's/^::[*]/*:/' \
-e 's/^[*][^*:{][^*:{]*:[[:space:]]*{{t-egy|/* {{egy}}: {{t-egy|/' \
-e 's/^[*][^*:{][^*:{]*:[[:space:]]*\({{t[^|]*|[[:space:]]*\)\([^|}]*\)\([[:space:]]*[|}]\)/* {{\2}}: \1\2\3/' \
-e 's/^[*][^*:{][^*:{]*:/* {{TAALKOADE}}:/' \
-e 'ta' \
-e '/^[*][*:]/N' \
-e 's/^[*][*:][[:space:]]*\([^\n]*\)\n\(.*\)/\2<\/dd><dd>\1/' \
-e 's/^[*][[:space:]]*{{[[:lower:]][[:lower:]][[:lower:]]}}[[:space:]]*:/* {{TAALKOADE}}:/' \
-e 'ta' | sort -dft '=' -k 1
#!/bin/sh
# Skript set oersettings fan nlwikt/enwikt om foar fywikt Berjocht:trans-top.
# Ferzje mei xclip: kopiearje (ynkl. lêste rigelein), útfiere, plakke.
LANG="en_US.UTF-8"; export LANG
TAC=$(command -v tac) || TAC="tail -r"
xclip -o -sel c | $TAC | sed -e '/{{trans-mid}}/d' \
-e '/^::[*]/ba' \
-e 's/^:*[*][[:space:]]*{{[[:lower:]][[:lower:]][[:lower:]]}}[[:space:]]*:[[:space:]]*\({{trad|[[:space:]]*\)\([[:lower:]][[:lower:]]\)\([[:space:]]*[|}]\)/* {{\2}}: \1\2\3/' \
-e ':a' \
-e "s/^[*][[:space:]]*{{\([^[:space:]:]*\)}}[[:space:]]*:[[:space:]]*/| \1$(printf '\t\t')= /" \
-e "s/$(printf '\t\t')= \([^/]*\)<\/dd>\(.*\)/$(printf '\t\t')= \1\2<\/dd>/" \
-e 't' \
-e 's/^:[*]/*/' \
-e 's/^::[*]/*:/' \
-e 's/^[*][^*:{][^*:{]*:[[:space:]]*{{t-egy|/* {{egy}}: {{t-egy|/' \
-e 's/^[*][^*:{][^*:{]*:[[:space:]]*\({{t[^|]*|[[:space:]]*\)\([^|}]*\)\([[:space:]]*[|}]\)/* {{\2}}: \1\2\3/' \
-e 's/^[*][^*:{][^*:{]*:/* {{TAALKOADE}}:/' \
-e 'ta' \
-e '/^[*][*:]/N' \
-e 's/^[*][*:][[:space:]]*\([^\n]*\)\n\(.*\)/\2<\/dd><dd>\1/' \
-e 's/^[*][[:space:]]*{{[[:lower:]][[:lower:]][[:lower:]]}}[[:space:]]*:/* {{TAALKOADE}}:/' \
-e 'ta' | sort -dft '=' -k 1 | xclip -i -sel c