Highlight carriage return changes

This commit is contained in:
BrokenEagle
2020-01-07 02:31:45 +00:00
parent 34542fdf5c
commit 9182a4f556
3 changed files with 11 additions and 3 deletions

View File

@@ -9,5 +9,9 @@ div#c-pool-versions {
background: var(--wiki-page-versions-diff-ins-background); background: var(--wiki-page-versions-diff-ins-background);
text-decoration: none; text-decoration: none;
} }
span.paragraph-mark {
opacity: 0.25;
}
} }
} }

View File

@@ -9,6 +9,10 @@ div#c-wiki-page-versions {
background: var(--wiki-page-versions-diff-ins-background); background: var(--wiki-page-versions-diff-ins-background);
text-decoration: none; text-decoration: none;
} }
span.paragraph-mark {
opacity: 0.25;
}
} }
#a-index { #a-index {

View File

@@ -32,10 +32,10 @@ class DiffBuilder
case chg.action case chg.action
when '-' when '-'
oldstart = chg.old_position oldstart = chg.old_position
output[chg.old_position] = '<br>' if chg.old_element.match(/^\r?\n$/) output[chg.old_position] = '<span class="paragraph-mark">¶</span><br>' if chg.old_element.match(/^\r?\n$/)
when '+' when '+'
if chg.new_element.match(/^\r?\n$/) if chg.new_element.match(/^\r?\n$/)
output.insert(chg.old_position, '<br>') output.insert(chg.old_position, '<span class="paragraph-mark">¶</span><br>')
else else
output.insert(chg.old_position, (escape_html[chg.new_element]).to_s) output.insert(chg.old_position, (escape_html[chg.new_element]).to_s)
end end
@@ -52,6 +52,6 @@ class DiffBuilder
end end
end end
output.join.gsub(/\r?\n/, '<br>').html_safe output.join.gsub(/\r?\n/, '<span class="paragraph-mark">¶</span><br>').html_safe
end end
end end