mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-11-05 21:44:56 +00:00
* fix(filters): separate each match on its own line for source: watches #4477 A `source:` watch passes append_pretty_line_formatting=False to the filter helpers, and then keeps the filtered text verbatim instead of running it through html_to_text(). TEXT_FILTER_LIST_LINE_SUFFIX ('<br>') only works because Inscriptis turns it into a newline, so for that path no separator was emitted at all and every match ran into the next on a single line. Add filter_match_separator(), which picks '\n' instead of '<br>' when the result will not be passed through Inscriptis, and use it from xpath_filter(), xpath1_filter() and include_filters() - all three carried the same condition. The first match still never gets a separator, so no leading newline is introduced, and the Inscriptis path is byte-for-byte unchanged. * fix(filters): don't double-space xpath element matches on source: watches xpath_filter/xpath1_filter serialise whole elements with etree.tostring(pretty_print=True), which already terminates every match with a newline. Adding the new source: separator unconditionally put a second newline between matched elements, so each one landed on its own line separated by a blank line. Only emit the separator when the accumulated output does not already end on a line break, which leaves attribute and text() matches (plain strings, no newline of their own) separated as before. Found while producing the before/after output requested on #4492. --------- Co-authored-by: Yi-111-a <yi-111-a@users.noreply.github.com> Co-authored-by: Yi-111-a <41898262+github-actions[bot]@users.noreply.github.com>