diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.py b/src/calibre/gui2/tweak_book/editor/syntax/html.py index a8c2c6a8d5..40ddefb3b3 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.py @@ -8,17 +8,19 @@ __copyright__ = '2013, Kovid Goyal ' import re -from PyQt4.Qt import (QTextCharFormat) +from PyQt4.Qt import (QTextCharFormat, QFont) from calibre.gui2.tweak_book.editor.syntax.base import SyntaxHighlighter from html5lib.constants import cdataElements, rcdataElements +cdata_tags = cdataElements | rcdataElements entity_pat = re.compile(r'&#{0,1}[a-zA-Z0-9]{1,8};') tag_name_pat = re.compile(r'/{0,1}[a-zA-Z0-9:]+') space_chars = ' \t\r\n\u000c' -attribute_name_pat = re.compile(r'''[^%s"'/>=]+''' % space_chars) +attribute_name_pat = re.compile(r'''[^%s"'/><=]+''' % space_chars) self_closing_pat = re.compile(r'/\s*>') unquoted_val_pat = re.compile(r'''[^%s'"=<>`]+''' % space_chars) +cdata_close_pats = {x:re.compile(r' or + +

A heading that should appear in bold, with an italic word

+ ''')