Represent in the History diff pane when an image was the thing that changed

This commit is contained in:
Miguel Jacq 2025-11-05 21:36:38 +11:00
parent 76806bca08
commit a7c8cc5dbf
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
2 changed files with 3 additions and 0 deletions

View file

@ -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)<img\b[^>]*>")
STYLE_SCRIPT_RE = re.compile(r"(?is)<(script|style)[^>]*>.*?</\1>")
COMMENT_RE = re.compile(r"<!--.*?-->", re.S)
BR_RE = re.compile(r"(?i)<br\s*/?>")
@ -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)