Class: Decidim::DiffyExtension::UnescapedHtmlFormatter

Inherits:
Diffy::HtmlFormatter
  • Object
show all
Defined in:
decidim-core/lib/decidim/diffy_extension.rb

Overview

HtmlFormatter that returns basic html output (no inline highlighting) and does not escape HTML tags.

Constant Summary collapse

TAGS =

We exclude the tags ‘del` and `ins` so the diffy styling does not apply.

(UserInputScrubber.new.tags.to_a - %w(del ins)).freeze

Instance Method Summary collapse

Instance Method Details

#to_sObject



12
13
14
15
# File 'decidim-core/lib/decidim/diffy_extension.rb', line 12

def to_s
  str = wrap_lines(@diff.map { |line| wrap_line(line) })
  ActionView::Base.new(ActionView::LookupContext.new(nil), {}, nil).sanitize(str, tags: TAGS)
end