示例#1
0
def handler(x):
    """ Callback to convert entity to UC """
    v = x.group(1)
    if v.startswith('#'):
        try:
            return unichr(int(v[1:]))
        except ValueError:
            pass
    return entitydefs.get(v, '')
示例#2
0
文件: entities.py 项目: boothead/karl
def handler(x):
    """ Callback to convert entity to UC """
    v = x.group(1)
    return entitydefs.get(v, '')