From 4ff64c0b2117ffb0c219cad6d9c8c22dad837994 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 23 Feb 2025 13:21:36 +0530 Subject: [PATCH] wrap pure whitespace --- src/calibre/ebooks/oeb/polish/kepubify.py | 2 +- src/calibre/ebooks/oeb/polish/tests/kepubify.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/kepubify.py b/src/calibre/ebooks/oeb/polish/kepubify.py index a1ab1e5830..1cda24b25c 100644 --- a/src/calibre/ebooks/oeb/polish/kepubify.py +++ b/src/calibre/ebooks/oeb/polish/kepubify.py @@ -164,7 +164,7 @@ def add_kobo_spans(inner, root_lang): paranum += 1 segnum = 0 increment_next_para = False - stripped = leading_whitespace_pat.sub('', text) + stripped = leading_whitespace_pat.sub('', text) or text ws = None if num := len(text) - len(stripped): ws = text[:num] diff --git a/src/calibre/ebooks/oeb/polish/tests/kepubify.py b/src/calibre/ebooks/oeb/polish/tests/kepubify.py index 7e0692f66d..11d51f9b65 100644 --- a/src/calibre/ebooks/oeb/polish/tests/kepubify.py +++ b/src/calibre/ebooks/oeb/polish/tests/kepubify.py @@ -59,6 +59,9 @@ div#book-inner {{ margin-top: 0; margin-bottom: 0; }}