From a7c8cc5dbf70709f0c389184a51f5cdb1b9dab21 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 5 Nov 2025 21:36:38 +1100 Subject: [PATCH] Represent in the History diff pane when an image was the thing that changed --- CHANGELOG.md | 1 + bouquin/history_dialog.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47c0cc7..425b5f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Improve search results window and highlight in calendar when there are matches. * Fix styling issue with text that comes after a URL, so it doesn't appear as part of the URL. * Add ability to export to Markdown (and fix heading styles) + * Represent in the History diff pane when an image was the thing that changed # 0.1.9 diff --git a/bouquin/history_dialog.py b/bouquin/history_dialog.py index fee2a4f..98399b9 100644 --- a/bouquin/history_dialog.py +++ b/bouquin/history_dialog.py @@ -18,6 +18,7 @@ from PySide6.QtWidgets import ( def _html_to_text(s: str) -> str: """Lightweight HTML→text for diff (keeps paragraphs/line breaks).""" + IMG_RE = re.compile(r"(?is)]*>") STYLE_SCRIPT_RE = re.compile(r"(?is)<(script|style)[^>]*>.*?") COMMENT_RE = re.compile(r"", re.S) BR_RE = re.compile(r"(?i)") @@ -25,6 +26,7 @@ def _html_to_text(s: str) -> str: TAG_RE = re.compile(r"<[^>]+>") MULTINL_RE = re.compile(r"\n{3,}") + s = IMG_RE.sub("[ Image changed - see Preview pane ]", s) s = STYLE_SCRIPT_RE.sub("", s) s = COMMENT_RE.sub("", s) s = BR_RE.sub("\n", s)