From ad2ffc8fe2b51c4c06eba143065240e32f2028fe Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Nov 2014 14:23:12 +0530 Subject: [PATCH] ... --- src/calibre/gui2/tweak_book/editor/smart/html.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/smart/html.py b/src/calibre/gui2/tweak_book/editor/smart/html.py index 01b4321960..ba2b1344c6 100644 --- a/src/calibre/gui2/tweak_book/editor/smart/html.py +++ b/src/calibre/gui2/tweak_book/editor/smart/html.py @@ -269,12 +269,13 @@ def set_style_property(tag, property_name, value, editor): d.setProperty(property_name, value) c.insertText('"%s"' % css(d)) +entity_pat = re.compile(r'&(#{0,1}[a-zA-Z0-9]{1,8});$') + class Smarts(NullSmarts): def __init__(self, *args, **kwargs): NullSmarts.__init__(self, *args, **kwargs) self.last_matched_tag = None - self.entity_pat = re.compile(r'&(#{0,1}[a-zA-Z0-9]{1,8});$') def get_extra_selections(self, editor): ans = [] @@ -544,7 +545,7 @@ class Smarts(NullSmarts): c.insertText(';') c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor) text = editor.selected_text_from_cursor(c) - m = self.entity_pat.search(text) + m = entity_pat.search(text) if m is not None: ent = m.group() repl = xml_entity_to_unicode(m)