From 33ec496462e26702ca85eaa39901fd47b64fd83c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Aug 2014 08:12:32 +0530 Subject: [PATCH] Edit Book: Fix Live CSS not working for self-closing tags/closing tags --- src/calibre/gui2/tweak_book/editor/smart/html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/smart/html.py b/src/calibre/gui2/tweak_book/editor/smart/html.py index 3a36aaec0e..1a5ce996c5 100644 --- a/src/calibre/gui2/tweak_book/editor/smart/html.py +++ b/src/calibre/gui2/tweak_book/editor/smart/html.py @@ -395,9 +395,11 @@ class HTMLSmarts(NullSmarts): nblock, boundary = next_tag_boundary(block, offset, forward=False) if boundary is None: return None, None + in_tag_definition = False if boundary.is_start: # We are inside a tag, use this tag start_block, start_offset = nblock, boundary.offset + in_tag_definition = True else: start_block = None while start_block is None and block.isValid(): @@ -414,7 +416,7 @@ class HTMLSmarts(NullSmarts): ud = start_block.userData() if ud is None: return None, None - if for_position_sync: + if for_position_sync or in_tag_definition: return sourceline, [ t.name for t in ud.tags if (t.is_start and not t.closing and t.offset <= start_offset)] # We discard self-closing as well as tags that are both opened and