From fd98a2d3053279bd4a848faa52a3ac676db10cbb Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 10 Jul 2026 03:59:34 +0200 Subject: Stop diff output from corrupting the document on structural tag changes sdiff aligned an inserted paragraph break correctly, but the renderer wrapped the raw

/

tokens in regardless -- invalid nesting that browsers silently repair by dropping the unmatched closing tag, leaving everything downstream rendered inside an with nothing left to close it. Same failure mode as the retired cacycle_diff.js, different cause. Tag tokens now render as a plain-text pilcrow with a tooltip naming the actual tag, never as literal markup inside /. Applies to both inline and side-by-side. Side-by-side's new panel flattening a real paragraph break into a marker, rather than showing its own true structure, is a known, accepted trade-off for now -- not the same problem, and not fixed here. --- test/models/page_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/models/page_test.rb b/test/models/page_test.rb index ac5691a..3868a53 100644 --- a/test/models/page_test.rb +++ b/test/models/page_test.rb @@ -210,4 +210,22 @@ class PageTest < ActiveSupport::TestCase assert_match "Old", old_html assert_match "New", new_html end + + test "diff_against handles an inserted paragraph split without corrupting the document" do + n = Node.root.children.create! :slug => "paragraph_split_test" + d = n.find_or_create_draft @user1 + d.body = "

Der Vortragsraum ist ab 19 Uhr geöffnet, der Zugang erfolgt über den Hinterhof.

" + d.save! + n.publish_draft! + + d2 = n.find_or_create_draft @user1 + d2.body = "

Der Vortragsraum ist ab 19 Uhr geöffnet,

\n

der Zugang erfolgt über den Hinterhof.

" + d2.save! + + diff = d2.diff_against(n.head) + fragment = Nokogiri::HTML::DocumentFragment.parse(diff[:body]) + + assert_equal 2, fragment.css('ins.diff_structural').length + assert_match "der Zugang erfolgt über den Hinterhof.", fragment.text + end end -- cgit v1.3