From d2b7303e40d2edee01eb838c4b6e02550ae73e9a Mon Sep 17 00:00:00 2001 From: un-pogaz <46523284+un-pogaz@users.noreply.github.com> Date: Sat, 10 Feb 2024 08:50:47 +0100 Subject: [PATCH] Fix some wrong bold cleaning --- __init__.py | 2 +- changelog.md | 5 +++++ comments_cleaner.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index 0fcf07d..d3b630a 100644 --- a/__init__.py +++ b/__init__.py @@ -27,7 +27,7 @@ class ActionCommentsCleaner(InterfaceActionBase): description = _('Remove the scraps CSS in HTML comments') supported_platforms = ['windows', 'osx', 'linux'] author = 'un_pogaz' - version = (1, 12, 1) + version = (1, 12, 2) minimum_calibre_version = (5, 0, 0) #: This field defines the GUI plugin class that contains all the code diff --git a/changelog.md b/changelog.md index 7db461f..a4be39f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog - Comments Cleaner +## [1.12.2] - 2024/02/10 + +### Bug fixes +- Fix some wrong bold cleaning + ## [1.12.1] - 2024/01/27 ### Bug fixes diff --git a/comments_cleaner.py b/comments_cleaner.py index 7b8bc9a..b3d56ac 100644 --- a/comments_cleaner.py +++ b/comments_cleaner.py @@ -563,9 +563,9 @@ def clean_style(text: str, PREFS: Optional[dict]=None) -> str: text = text.replace(m.group(0), rpl) if PREFS[KEY.FONT_WEIGHT] == 'bold': - text = regex.loop(r' style="([^"]*) font-weight: [5-9]\d\d;([^"]*)"', r' style="\1 font-weight: xxx;\2"', text) + text = regex.loop(r' style="([^"]*) font-weight: [6-9]\d\d;([^"]*)"', r' style="\1 font-weight: xxx;\2"', text) + text = regex.loop(r' style="([^"]*) font-weight: [1-5]\d\d;([^"]*)"', r' style="\1\2"', text) text = regex.loop(r' style="([^"]*) font-weight: xxx;([^"]*)"', r' style="\1 '+FONT_WEIGHT+r';\2"', text) - text = regex.loop(r' style="([^"]*) font-weight: [1-4]\d\d;([^"]*)"', r' style="\1\2"', text) elif PREFS[KEY.FONT_WEIGHT] == 'del': text = regex.loop(r'<(/?)strong(| [^>]*)>', r'<\1span\2>', text)