From d5aa4da720c5cc069fa6211f3c79bb42b4355c30 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 20 Feb 2025 12:56:14 +0530 Subject: [PATCH] More work on kepubify --- src/calibre/ebooks/oeb/polish/kepubify.py | 2 +- .../ebooks/oeb/polish/tests/kepubify.py | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/kepubify.py b/src/calibre/ebooks/oeb/polish/kepubify.py index 311d40c996..3537b78e22 100644 --- a/src/calibre/ebooks/oeb/polish/kepubify.py +++ b/src/calibre/ebooks/oeb/polish/kepubify.py @@ -28,7 +28,7 @@ KOBO_STYLE_HACKS = 'kobostylehacks' OUTER_DIV_ID = 'book-columns' INNER_DIV_ID = 'book-inner' SKIPPED_TAGS = frozenset(( - 'script', 'style', 'atom', 'pre', 'audio', 'video', 'svg', 'math' + '', 'script', 'style', 'atom', 'pre', 'audio', 'video', 'svg', 'math' )) BLOCK_TAGS = frozenset(( 'p', 'ol', 'ul', 'table', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', diff --git a/src/calibre/ebooks/oeb/polish/tests/kepubify.py b/src/calibre/ebooks/oeb/polish/tests/kepubify.py index 65b980ad53..86ffb4d620 100644 --- a/src/calibre/ebooks/oeb/polish/tests/kepubify.py +++ b/src/calibre/ebooks/oeb/polish/tests/kepubify.py @@ -26,15 +26,30 @@ div#book-inner { margin-top: 0; margin-bottom: 0; }
An imagewith tail': - '

An image' - 'with tail

' + '

An imagewith tailwithout': + '

An image' + 'with tail' + 'without

', # comments + '

A commentwith tail' + '

A commentwithout tail': + '

A commentwith tail

' + '

A commentwithout tail

', # nested block tags + '
A div
nested.
  • A list

    with nested block

    tail1
  • tail2
tail3': + '
A div
nested.' + '
  • A list

    with nested block

    ' + ' tail1
  • tail2
' + ' tail3
', # skipped tags + '
Script: with tail': + '
Script: with tail
', + '
Svg: mouse no tail': + '
Svg: mouse' + ' no tail
', }.items(): with self.subTest(src=src): root = kepubify_html_data(src)