No need to define line feed sep
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Test the built package works basically. (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been cancelled
ChangeDetection.io App Test / lint-code (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-10 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-11 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-12 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-13 (push) Has been cancelled

This commit is contained in:
dgtlmoon
2025-10-26 12:10:52 +01:00
parent 6c166ba2c4
commit a8d06e9d69
3 changed files with 4 additions and 10 deletions
+3 -7
View File
@@ -11,6 +11,7 @@ import diff_match_patch as dmp_module
import re
from .tokenizers import TOKENIZERS, tokenize_words_and_html
from ..notification_service import CUSTOM_LINEBREAK_PLACEHOLDER
# Remember! gmail, outlook etc dont support <style> must be inline.
# Gmail: strips <ins> and <del> tags entirely.
@@ -384,7 +385,6 @@ def render_diff(
include_removed: bool = True,
include_added: bool = True,
include_replaced: bool = True,
line_feed_sep: str = "\n",
include_change_type_prefix: bool = True,
patch_format: bool = False,
word_diff: bool = True,
@@ -403,7 +403,6 @@ def render_diff(
include_removed (bool): Include removed parts
include_added (bool): Include added parts
include_replaced (bool): Include replaced parts
line_feed_sep (str): Separator for lines in output
include_change_type_prefix (bool): Add prefixes to indicate change types
patch_format (bool): Use patch format for output
word_diff (bool): Use word-level diffing for replaced lines (controls inline rendering)
@@ -418,12 +417,9 @@ def render_diff(
newest_lines = [line.rstrip() for line in newest_version_file_contents.splitlines()]
previous_lines = [line.rstrip() for line in previous_version_file_contents.splitlines()] if previous_version_file_contents else []
if newest_lines == previous_lines:
x=1
if patch_format:
patch = difflib.unified_diff(previous_lines, newest_lines)
return line_feed_sep.join(patch)
return CUSTOM_LINEBREAK_PLACEHOLDER.join(patch)
rendered_diff = customSequenceMatcher(
before=previous_lines,
@@ -447,7 +443,7 @@ def render_diff(
result.extend(x)
else:
result.append(x)
return line_feed_sep.join(result)
return CUSTOM_LINEBREAK_PLACEHOLDER.join(result)
return flatten(rendered_diff)
+1 -2
View File
@@ -121,11 +121,10 @@ class NotificationService:
base_kwargs = dict(
previous_version_file_contents=prev_snapshot,
newest_version_file_contents=current_snapshot,
line_feed_sep=CUSTOM_LINEBREAK_PLACEHOLDER,
ignore_junk=ignore_junk,
word_diff=not (word_mode and 'text' in n_object.get('notification_format', '')),
)
n_object.update({
'current_snapshot': snapshot_contents,
'diff': diff.render_diff(**base_kwargs),
@@ -585,7 +585,6 @@ class perform_site_check(difference_detection_processor):
include_added=watch.get('filter_text_added', True),
include_removed=watch.get('filter_text_removed', True),
include_replaced=watch.get('filter_text_replaced', True),
line_feed_sep="\n",
include_change_type_prefix=False
)