Ticket #10655: indentation_t10655_r10178.diff
File indentation_t10655_r10178.diff, 1.5 KB (added by , 16 years ago) |
---|
-
TabularUnified django/utils/text.py
219 219 smart_split = allow_lazy(smart_split, unicode) 220 220 221 221 def _replace_entity(match): 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 222 text = match.group(1) 223 if text[0] == u'#': 224 text = text[1:] 225 try: 226 if text[0] in u'xX': 227 c = int(text[1:], 16) 228 else: 229 c = int(text) 230 return unichr(c) 231 except ValueError: 232 return match.group(0) 233 else: 234 try: 235 return unichr(name2codepoint[text]) 236 except (ValueError, KeyError): 237 return match.group(0) 238 238 239 239 _entity_re = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));") 240 240 241 241 def unescape_entities(text): 242 242 return _entity_re.sub(_replace_entity, text) 243 243 unescape_entities = allow_lazy(unescape_entities, unicode) 244 244 245 245 def unescape_string_literal(s):