| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | sourcedscip-shell shell apertium-nno-nob 1.6.0-1 sourced(). () { |
| 4 | [[ "$0" != "${BASH_SOURCE[0]}" ]] |
| 5 | } |
| 6 | |
| 7 | mainscip-shell shell apertium-nno-nob 1.6.0-1 main(). () { |
| 8 | set -e -u |
| 9 | apertium -d . nob-nno "$@" |
| 10 | } |
| 11 | |
| 12 | |
| 13 | # TODO: read the <incompatibilities> section and remove any where both have v="true" |
| 14 | |
| 15 | allPrefsExceptNPKscip-shell shell apertium-nno-nob 1.6.0-1 allPrefsExceptNPK(). () { |
| 16 | cd "$(dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}")"/.. |
| 17 | set -o pipefail |
| 18 | grepscip-shell system . . grep. -o '<preference *id="[^"]*"' prefs/nob-nno.xml \ |
| 19 | | sedscip-shell system . . sed. 's,.*id=",,;s,"$,,' \ |
| 20 | | grepscip-shell system . . grep. -vxe infa_infe -e me_vi |
| 21 | } |
| 22 | |
| 23 | # shopt -s inherit_errexit # apparently this doesn't exist in bash<4.4 |
| 24 | AP_SETVAR="$(allPrefsExceptNPKscip-shell shell apertium-nno-nob 1.6.0-1 allPrefsExceptNPK(). | trscip-shell system . . tr. '\n' ',' | sedscip-shell system . . sed. 's/,$//' )" |
| 25 | export AP_SETVAR |
| 26 | |
| 27 | # Simple sanity test, shout if we can't find all the variable names in one of monodix and biprefs |
| 28 | selftestscip-shell shell apertium-nno-nob 1.6.0-1 selftest(). () { |
| 29 | ( |
| 30 | cd "$(dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}")"/.. |
| 31 | if [[ ! -f ../apertium-nno/apertium-nno.nno.dix ]]; then |
| 32 | echoscip-shell system . . echo. "$PWD/../apertium-nno/apertium-nno.nno.dix doesn't exist, skipping selftest" |
| 33 | return |
| 34 | fi |
| 35 | allPrefsExceptNPKscip-shell shell apertium-nno-nob 1.6.0-1 allPrefsExceptNPK(). | while IFS=$'\n' read -r x; do |
| 36 | if [[ $x == kløyvd_inf ]]; then |
| 37 | # no sdef for this one, lemma-list in genprefs instead |
| 38 | continue |
| 39 | fi |
| 40 | grepscip-shell system . . grep. -q -w -F "VAR:$x" apertium-nno-nob.nob-nno.biprefs.rlx \ |
| 41 | || grepscip-shell system . . grep. -q -w -F "VAR:$x" merge-quotes.rlx \ |
| 42 | || grepscip-shell system . . grep. -q -F "sdef n=\"v:$x\"" ../apertium-nno/apertium-nno.nno.dix \ |
| 43 | || echoscip-shell system . . echo. "WARNING: v:$x not found in nno.dix / merge-quotes.rlx / biprefs.rlx" >&2 |
| 44 | done |
| 45 | ) |
| 46 | } |
| 47 | |
| 48 | # shellcheck disable=SC2310 |
| 49 | if sourcedscip-shell shell apertium-nno-nob 1.6.0-1 sourced().; then |
| 50 | selftestscip-shell shell apertium-nno-nob 1.6.0-1 selftest(). |
| 51 | else |
| 52 | mainscip-shell shell apertium-nno-nob 1.6.0-1 main(). "$@" |
| 53 | fi |