forked from kate/uniborg
Simplify aesthetify
This commit is contained in:
parent
facd436014
commit
c41792af6b
|
@ -31,16 +31,15 @@ def get_tag_parser(tag, entity):
|
||||||
return re.compile(tag + r'(.+?)' + tag, re.DOTALL), tag_parser
|
return re.compile(tag + r'(.+?)' + tag, re.DOTALL), tag_parser
|
||||||
|
|
||||||
|
|
||||||
PRINTABLE_ASCII = range(0x21, 0x7f)
|
|
||||||
def parse_aesthetics(m):
|
def parse_aesthetics(m):
|
||||||
def aesthetify(string):
|
def aesthetify(string):
|
||||||
for c in string:
|
for c in string:
|
||||||
c = ord(c)
|
if " " < c <= "~":
|
||||||
if c in PRINTABLE_ASCII:
|
yield chr(ord(c) + 0xFF00 - 0x20)
|
||||||
c += 0xFF00 - 0x20
|
elif c == " ":
|
||||||
elif c == ord(" "):
|
yield "\u3000"
|
||||||
c = 0x3000
|
else:
|
||||||
yield chr(c)
|
yield c
|
||||||
return "".join(aesthetify(m[1])), None
|
return "".join(aesthetify(m[1])), None
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue