summaryrefslogtreecommitdiff
path: root/Konzerte/2020_01_05/mangle-inputs
diff options
context:
space:
mode:
Diffstat (limited to 'Konzerte/2020_01_05/mangle-inputs')
-rwxr-xr-xKonzerte/2020_01_05/mangle-inputs78
1 files changed, 78 insertions, 0 deletions
diff --git a/Konzerte/2020_01_05/mangle-inputs b/Konzerte/2020_01_05/mangle-inputs
new file mode 100755
index 0000000..6c4ac50
--- /dev/null
+++ b/Konzerte/2020_01_05/mangle-inputs
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+if [ -z "$1" ]; then
+ >&2 echo 'too few arguments'
+ exit 1
+fi
+
+Groeszen='
+Es_kommt_ein_Schiff_geladen:19
+Macht_hoch_die_Tuer:18
+Freuet_euch_allezeit:17
+Lobsinget_Gott_dem_Herrn:17
+Stern_ueber_Bethlehem_:20
+Freut_euch_von_Herzen:18
+Drei_Koenige_wandern:17
+Als_die_Welt_verloren:17
+Die_Nacht_ist_vorgedrungen:18
+Das_grosze_Wunder_hat_ganz_klein_begonnen:17.5
+'
+
+if printf '%s\n' "$1" \
+| grep -q '/\([^/]\+\)/\1\.ly$'; then
+
+ base="${1%/*.ly}"
+
+ sed '
+ s@\(include "\)\(\(artikulation\|satz\|stimmen\|texte\)\.ly"\)@\1'"${base}"'/\2@
+ t
+ s@\(include "\)\(\(artikulation\|satz\|stimmen\|texte\)\.pre"\)@\1'"${base##*/}"'_\2@
+ ' \
+ <"$1" \
+ | case "${base##*/}" in
+ 'O_du_froehliche')
+ sed '
+ s/%Oberstimme%//g
+ '
+ ;;
+ *)
+ cat
+ ;;
+ esac \
+ | if Groesze=$(
+ printf '%s\n' "${Groeszen}" \
+ | grep "^${base##*/}:"
+ ); then
+ sed '
+ /^\s*\\layout\s\+{\s*$/ a #(layout-set-staff-size '"${Groesze#*:}"')
+ '
+ else
+ cat
+ fi
+
+elif [ -z "${1##*/Freu_dich_Erd_und_Sternenzelt/stimmen.ly}" ] \
+|| [ -z "${1##*/Freu_dich_Erd_und_Sternenzelt/texte.ly}" ]; then
+
+ cat "$1"
+
+elif [ -z "${1##*/Es_ist_ein_Ros_entsprungen/satz.ly}" ] \
+|| [ -z "${1##*/Es_ist_ein_Ros_entsprungen/stimmen.ly}" ] \
+|| [ -z "${1##*/Es_ist_ein_Ros_entsprungen/texte.ly}" ]; then
+
+ sed '
+ s/%STR_[1-3]%//
+ s/%Variante_2%//
+ ' "$1"
+
+elif [ -z "${1##*/Freu_dich_Erd_und_Sternenzelt/satz.ly}" ]; then
+
+ sed '
+ s/%STR_[124]%//
+ ' "$1"
+
+else
+
+ >&2 printf 'unknown input "%s"\n' "$1"
+ exit 1
+
+fi