Engine for LaTeX songbooks http://www.patacrep.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
717 B

#!/bin/sh
#
#Author: Romain Goffe and Alexandre Dupas
#Date: 27/10/2010
#Description: fix typographic mistakes, some depending on language
# remove trailing space and double space
sed -i \
-e 's/\s*$//g' \
-e '/\s*%/! s/\([^ ]\)\s\+/\1 /g' \
$@
# formating rules depending on language
for song in $@;
do
if grep -q "selectlanguage{english}" $song
then
sed -i \
-e 's/\s*?/?/g' \
-e 's/\s*!/!/g' \
-e 's/\s*:/:/g' \
$song
elif grep -q "selectlanguage{french}" $song
then
sed -i \
-e 's/\([^ ]\)?/\1 ?/g' \
-e 's/\([^ ]\)!/\1 !/g' \
-e '/\\gtab.*/ ! s/\([^ ]\):/\1 :/g' \
$song
fi
done