rubocop: fix various style issues.
This commit is contained in:
@@ -19,15 +19,15 @@ class WikiPagePresenter
|
||||
cbo = Diff::LCS::ContextDiffCallbacks.new
|
||||
diffs = thisarr.diff(otharr, cbo)
|
||||
|
||||
escape_html = ->(str) {str.gsub(/&/,'&').gsub(/</,'<').gsub(/>/,'>')}
|
||||
escape_html = ->(str) {str.gsub(/&/, '&').gsub(/</, '<').gsub(/>/, '>')}
|
||||
|
||||
output = thisarr;
|
||||
output = thisarr
|
||||
output.each { |q| q.replace(CGI.escape_html(q)) }
|
||||
|
||||
diffs.reverse_each do |hunk|
|
||||
newchange = hunk.max{|a,b| a.old_position <=> b.old_position}
|
||||
newchange = hunk.max {|a, b| a.old_position <=> b.old_position}
|
||||
newstart = newchange.old_position
|
||||
oldstart = hunk.min{|a,b| a.old_position <=> b.old_position}.old_position
|
||||
oldstart = hunk.min {|a, b| a.old_position <=> b.old_position}.old_position
|
||||
|
||||
if newchange.action == '+'
|
||||
output.insert(newstart, "</ins>")
|
||||
@@ -42,7 +42,7 @@ class WikiPagePresenter
|
||||
if chg.new_element.match(/^\r?\n$/)
|
||||
output.insert(chg.old_position, "[nl]")
|
||||
else
|
||||
output.insert(chg.old_position, "#{escape_html[chg.new_element]}")
|
||||
output.insert(chg.old_position, (escape_html[chg.new_element]).to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -52,7 +52,7 @@ class WikiPagePresenter
|
||||
end
|
||||
|
||||
if hunk[0].action == '-'
|
||||
output.insert((newstart == oldstart || newchange.action != '+') ? newstart+1 : newstart, "</del>")
|
||||
output.insert((newstart == oldstart || newchange.action != '+') ? newstart + 1 : newstart, "</del>")
|
||||
output.insert(oldstart, "<del>")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user