diff --git a/tools/build-dialogues.sh b/tools/build-dialogues.sh index eb83353..d42f3b4 100755 --- a/tools/build-dialogues.sh +++ b/tools/build-dialogues.sh @@ -54,12 +54,37 @@ if [ ! -d "$ink_dir" ]; then exit 1 fi +# Prüft eine .ink-Datei auf Zeichen außerhalb von CP437 und gibt sie aus. +# Exit-Code 1 wenn Treffer gefunden, sonst 0. +check_cp437() { + python3 - "$1" <<'PYEOF' +import sys +path = sys.argv[1] +cp437 = set(bytes(range(256)).decode('cp437', errors='replace')) +hits = [] +with open(path, encoding='utf-8') as f: + for lineno, line in enumerate(f, 1): + for ch in line: + if ord(ch) > 127 and ch not in cp437: + hits.append(f' Z.{lineno}: U+{ord(ch):04X} {repr(ch)}') +for h in hits: + print(h) +sys.exit(1 if hits else 0) +PYEOF +} + built=0 skipped=0 failed=0 shopt -s nullglob for src in "$ink_dir"/*.ink; do out="${src%.ink}.ink.json" name="$(basename "$src")" + # CP437-Warnung: läuft immer, unabhängig vom Build-Status. + if ! cp437_warn="$(check_cp437 "$src")"; then + printf ' WARNUNG %s -- Nicht-CP437-Zeichen:\n' "$name" + printf '%s\n' "$cp437_warn" + fi + # Inkrementell: überspringen, wenn Ausgabe existiert und neuer ist. if [ "$force" -eq 0 ] && [ -f "$out" ] && [ "$out" -nt "$src" ]; then printf ' aktuell %s\n' "$name"