From e4e199e2139ccb7f8b71ac59b5fca857134bf9b4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 9 Mar 2023 17:34:34 +0530 Subject: [PATCH] Check book: Nicer handling of line offsets Apparently some errors from the CSS checker library reference line numbers, so rather than using an offset prepend extra newlines. Fixes #2009735 [Private bug](https://bugs.launchpad.net/calibre/+bug/2009735) --- src/calibre/ebooks/oeb/polish/check/css.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/ebooks/oeb/polish/check/css.py b/src/calibre/ebooks/oeb/polish/check/css.py index f910c47e92..ceeac61324 100644 --- a/src/calibre/ebooks/oeb/polish/check/css.py +++ b/src/calibre/ebooks/oeb/polish/check/css.py @@ -205,6 +205,9 @@ def create_job(name, css, line_offset=0, is_declaration=False, fix_data=None): if is_declaration: css = 'div{\n' + css + '\n}' line_offset -= 1 + if line_offset > 0: + css = ('\n' * line_offset) + css + line_offset = 0 return Job(name, css, line_offset, fix_data)