From b5dba545cd5a41a36510231fa755b79ed9978ac6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 Mar 2014 19:17:36 +0530 Subject: [PATCH] Edit book: Fix syntax highlighting in HTML files breaks if the closing of a comment or processing instruction is a tthe start of a new line. --- src/calibre/gui2/tweak_book/editor/syntax/html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.py b/src/calibre/gui2/tweak_book/editor/syntax/html.py index 25bcb3189b..5890481323 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.py @@ -286,7 +286,7 @@ def closing_tag(state, text, i, formats): def in_comment(state, text, i, formats): ' Comment, processing instruction or doctype ' end = {state.IN_COMMENT:'-->', state.IN_PI:'?>'}.get(state.parse, '>') - pos = text.find(end, i+1) + pos = text.find(end, i) fmt = formats['comment' if state.parse == state.IN_COMMENT else 'preproc'] if pos == -1: num = len(text) - i @@ -371,6 +371,8 @@ if __name__ == '__main__': launch_editor('''\ + A title with a tag <span> in it, the tag is treated as normal text