blob: 88a220beaa58aa9aed529925dd63b222bb707887 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/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\|stimmen\|texte\)\.ly"\)@\1'"${base}"'/\2@
t
s@\(include "\)\(\(artikulation\|stimmen\|texte\)\.pre"\)@\1'"${base##*/}"'_\2@
' \
<"$1" \
| case "${base##*/}" in
'Es_kommt_ein_Schiff_geladen')
sed 's/%STR_[1-4]%//g'
;;
'Macht_hoch_die_Tuer')
sed 's/%STR_[1-3]%//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##*/Macht_hoch_die_Tuer/stimmen.ly}" ]; then
sed '
/%fermate$/ s/2\([_^]\?\\fermata\)\? /4 s /
' "$1"
else
>&2 printf 'unknown input "%s"\n' "$1"
exit 1
fi
|