#!/bin/bash set -e cd "$(dirname "$0")" teile_params=( 'Veni_Creator_Spiritus:STROPHEN=[147]' 'Schmueckt_das_Fest_mit_Maien:STROPHEN=[1-3]' # EG_135 # 'Liturgie' 'Nun_bitten_wir_den_Heiligen_Geist:STROPHEN=[1-3]' 'Komm_Gott_Schoepfer_Heiliger_Geist' # EG_126 'Wie_lieblich_ist_der_Maien_:STROPHEN=[1-4]' 'Komm_Heilger_Geist:UNTERSTIMMEN=0 TRANSPOSE=a,' 'Herr_erbarme_dich_erbarme_dich' # EG_178.11 'Der_Maie_bringt_uns_der_Bluemlein_viel' 'O_komm_du_Geist_der_Wahrheit:STROPHEN=7' # EG_136 ) rm -f *.pre for teil_params in "${teile_params[@]}" do if [ -z ${teil_params%%'"'*} ]; then continue fi teil="${teil_params%%:*}" params="${teil_params#${teil}}" params="${params#:}" ( cd ../../${teil} sed -n ' s/^\([^:]*%\|'"${teil##*/}"'\)\.pdf.*:\s*// T :a /\\$/ { N s/\\\n/ / ta } s/\n.*$// s/%/'"${teil##*/}"'/g p ' Makefile | \ tr ' ' '\n' | \ grep '\.pre$' | \ xargs -r make ${params} "$@" ) done { printf '\n\n' cat alles.ly printf '\n\n' } | \ while read -r line do if [[ "${line}" = '%LOOP%'* ]] then loopLines="${loopLines} ${line#%LOOP%}" else if [ -n "${loopLines}" ] then for teil_param in "${teile_params[@]}" do teil="${teil_param%%:*}" echo "${loopLines}" | \ if [ -z ${teil%%'"'*} ]; then sed ' s/\\include "[^"]*"/\\markup { '"${teil_param}"'" }/g ' else cat fi | \ sed " s|%TEIL%|${teil}|g s|%TEIL-BASE%|${teil##*/}|g /%IF \([^=%]\+\)!=\1%/d s|%IF [^=%]\+!=[^=%]\+%||g s|%IF \([^=%]*[^=!%]\)=\1%||g /%IF [^=%]\+=[^=%]\+%/d " done unset loopLines fi echo "${line}" fi done > alles.pre lilypond alles.pre #ps2pdf -sPAPERSIZE=a4 - empty.pdf