Browse Source

Add command to remove trailing space and double space in the typo script

remotes/origin/translate_notes
Alexandre Dupas 14 years ago
parent
commit
a3b11124c9
  1. 26
      utils/typo.sh

26
utils/typo.sh

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

Loading…
Cancel
Save