mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
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.
This commit is contained in:
parent
6d60befc70
commit
b5dba545cd
@ -286,7 +286,7 @@ def closing_tag(state, text, i, formats):
|
|||||||
def in_comment(state, text, i, formats):
|
def in_comment(state, text, i, formats):
|
||||||
' Comment, processing instruction or doctype '
|
' Comment, processing instruction or doctype '
|
||||||
end = {state.IN_COMMENT:'-->', state.IN_PI:'?>'}.get(state.parse, '>')
|
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']
|
fmt = formats['comment' if state.parse == state.IN_COMMENT else 'preproc']
|
||||||
if pos == -1:
|
if pos == -1:
|
||||||
num = len(text) - i
|
num = len(text) - i
|
||||||
@ -371,6 +371,8 @@ if __name__ == '__main__':
|
|||||||
launch_editor('''\
|
launch_editor('''\
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xml:lang="en" lang="en">
|
<html xml:lang="en" lang="en">
|
||||||
|
<!--
|
||||||
|
-->
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>A title with a tag <span> in it, the tag is treated as normal text</title>
|
<title>A title with a tag <span> in it, the tag is treated as normal text</title>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user