Skip to content

Commit

Permalink
More lowwer_case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ospalh committed Oct 17, 2012
1 parent b799bc5 commit 4e0a0cc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Compare to kana.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@

__version__ = "1.0.1"

kanjiKanaRe = r' ?([^ ]+?)\[(.+?)\]'
kanji_kana_re = r' ?([^ ]+?)\[(.+?)\]'


def noSound(repl):
def no_sound(repl):
def func(match):
if match.group(2).startswith("sound:"):
# return without modification
return match.group(0)
else:
return re.sub(kanjiKanaRe, repl, match.group(0))
return re.sub(kanji_kana_re, repl, match.group(0))

return func


Expand All @@ -44,7 +45,7 @@ def kana(txt, *args):
except TypeError:
# which will not work when this is already unicode
pass
return re.sub(kanjiKanaRe, noSound(r'\2'), txt, flags=re.UNICODE)
return re.sub(kanji_kana_re, no_sound(r'\2'), txt, flags=re.UNICODE)


def kana_type_ans_answer_filter(self, buf):
Expand Down

0 comments on commit 4e0a0cc

Please sign in to comment.