Код: Выделить всё
@blueprint.app_template_filter('process_trans_for_html')
def process_trans_for_html(string):
def replace_xn(match):
match = match.group()
return x_HK_to_UNI(match[:1]).upper()+x_HK_to_UNI(match[1:3]).lower()
def replace_xh(match):
match = match.group()
return x_HK_to_UNI(match)
string = re.sub("([a-zA-Z])+_xn", replace_xn, string)
string = re.sub("([a-zA-Z])+_xh", replace_xh, string)
return string
Код: Выделить всё
@blueprint.app_template_filter('process_trans_for_html')
def process_trans_for_html(string):
def replace_xn(match):
match = match.group()
return x_HK_to_UNI(match[:1]).upper()+x_HK_to_UNI(match[1:3]).lower()
string = re.sub("([a-zA-Z])+_xn", replace_xn, string)
return string
Подробнее здесь: https://stackoverflow.com/questions/329 ... er-crashes
Мобильная версия