Project

General

Profile

Patch #42737 » 0001-Switch-from-a-multi-pass-approach-to-a-single-pass-a.patch

Marius BĂLTEANU, 2026-02-03 04:19

View differences:

lib/redmine/wiki_formatting/common_mark/formatter.rb
html = MarkdownFilter.new(@text, PIPELINE_CONFIG).call
fragment = Redmine::WikiFormatting::HtmlParser.parse(html)
SANITIZER.call(fragment)
SCRUBBERS.each do |scrubber|
fragment.scrub!(scrubber)
scrubber = Loofah::Scrubber.new do |node|
SCRUBBERS.each do |s|
s.scrub(node)
break if node.parent.nil?
end
end
fragment.scrub!(scrubber)
fragment.to_s
end
end
lib/redmine/wiki_formatting/html_sanitizer.rb
def self.call(html)
fragment = HtmlParser.parse(html)
SANITIZER.call(fragment)
SCRUBBERS.each do |scrubber|
fragment.scrub!(scrubber)
scrubber = Loofah::Scrubber.new do |node|
SCRUBBERS.each do |s|
s.scrub(node)
break if node.parent.nil?
end
end
fragment.scrub!(scrubber)
fragment.to_s
end
end
lib/redmine/wiki_formatting/textile/formatter.rb
def to_html(*rules)
html = @filter.to_html(rules)
fragment = Loofah.html5_fragment(html)
SCRUBBERS.each do |scrubber|
fragment.scrub!(scrubber)
scrubber = Loofah::Scrubber.new do |node|
SCRUBBERS.each do |s|
s.scrub(node)
break if node.parent.nil?
end
end
fragment.scrub!(scrubber)
fragment.to_s
end
end
(3-3/4)