Browse Source

Utils: correct regexp for removing spaces before punctuation symbols

remotes/origin/cmake
Romain Goffe 13 years ago
parent
commit
433366d2ea
  1. 2
      songs/Yodelice/Sunday_with_a_flu.sg
  2. 4
      utils/rules.py

2
songs/Yodelice/Sunday_with_a_flu.sg

@ -41,7 +41,7 @@
\endverse
\musicnote[english]{\Chorus; whistled verse; \Chorus}
\musicnote[french]{\Chorus ; couplet sifflé ; \Chorus}
\musicnote[french]{\Chorus; couplet sifflé; \Chorus}
\beginverse
Called a cabbage, threw the garbage

4
utils/rules.py

@ -139,13 +139,13 @@ for filename in songfiles:
elif (re.compile("selectlanguage{english}").search(data)):
#print "english song"
#ensure no spaces before symbols ? ! ; : )
data = re.sub("(?P<last_char>\S)(?P<symbol>[!?;:\)])","\g<last_char>\g<symbol>", data)
data = re.sub("(?P<last_char>\S)\s(?P<symbol>[!?;:\)])","\g<last_char>\g<symbol>", data)
#ensure no spaces after symbols (
data = re.sub("(?P<symbol>[\(])\s(?P<next_char>\S)","\g<symbol>\g<next_char>", data)
elif (re.compile("selectlanguage{spanish}").search(data)):
#print "spanish song"
#ensure no spaces before symbols ? ! ; : )
data = re.sub("(?P<last_char>\S)(?P<symbol>[!?;:\)])","\g<last_char>\g<symbol>", data)
data = re.sub("(?P<last_char>\S)\s(?P<symbol>[!?;:\)])","\g<last_char>\g<symbol>", data)
#ensure no spaces after symbols ¿ ¡ (
data = re.sub("(?P<symbol>[¿¡\(])\s(?P<next_char>\S)","\g<symbol>\g<next_char>", data)
elif (re.compile("selectlanguage{portuguese}").search(data)):

Loading…
Cancel
Save