From a3b11124c99a5e47867bddab71037cc76f6661b1 Mon Sep 17 00:00:00 2001 From: Alexandre Dupas Date: Mon, 1 Nov 2010 15:30:26 +0100 Subject: [PATCH] Add command to remove trailing space and double space in the typo script --- utils/typo.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/utils/typo.sh b/utils/typo.sh index 72a5f701..2a44edef 100755 --- a/utils/typo.sh +++ b/utils/typo.sh @@ -1,25 +1,31 @@ #!/bin/sh - -#Author: Romain Goffe +# +#Author: Romain Goffe and Alexandre Dupas #Date: 27/10/2010 -#Description: apply typo rules depending on language for songs (.sg files) -#Commentary: to be merge with latex-preprocessing script +#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' \ + $@ -for song in $@; do - echo $song +# 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; + $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; + $song + fi +done