From 653af227c1e5ce45cfaf91ce5a3920d2690ff5d3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Oct 2020 09:17:12 +0530 Subject: [PATCH] Add support for syntax highlighting box-sizing --- src/calibre/gui2/tweak_book/editor/syntax/css.py | 5 +++-- src/calibre/gui2/tweak_book/editor/widget.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/syntax/css.py b/src/calibre/gui2/tweak_book/editor/syntax/css.py index 80b40d1e09..482ede539a 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/css.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/css.py @@ -40,8 +40,8 @@ content_tokens = [(re.compile(k), v, n) for k, v, n in [ r'border-right-style|border-right-width|border-right|border-top-color|' r'border-top-style|border-top-width|border-bottom|' r'border-collapse|border-left|border-width|border-color|' - r'border-spacing|border-style|border-top|border|caption-side|' - r'clear|clip|color|content|counter-increment|counter-reset|' + r'border-spacing|border-style|border-top|border-box|border|box-sizing|caption-side|' + r'clear|clip|color|content-box|content|counter-increment|counter-reset|' r'cue-after|cue-before|cue|cursor|direction|display|' r'elevation|empty-cells|float|font-family|font-size|' r'font-size-adjust|font-stretch|font-style|font-variant|' @@ -329,6 +329,7 @@ if __name__ == '__main__': /* A demonstration css sheet */ body { color: green; + box-sizing: border-box; font-size: 12pt } diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 18f697c0ee..ff8e10448c 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -604,6 +604,7 @@ class Editor(QMainWindow): def launch_editor(path_to_edit, path_is_raw=False, syntax='html', callback=None): + from calibre.gui2 import Application from calibre.gui2.tweak_book import dictionaries from calibre.gui2.tweak_book.main import option_parser from calibre.gui2.tweak_book.ui import Main @@ -611,7 +612,7 @@ def launch_editor(path_to_edit, path_is_raw=False, syntax='html', callback=None) dictionaries.initialize() refresh_spell_check_status() opts = option_parser().parse_args([]) - app = QApplication([]) + app = Application([]) # Create the actions that are placed into the editors toolbars main = Main(opts) # noqa if path_is_raw: