8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/helpers/ifd_tools/application_helper.rb', line 8
def cleanse_for_flash(str)
s = str.gsub(%r{>\s+}, ">").gsub(%r{</p>}, "</p><br />")
replacements = []
replacements << { find: %w(&trade; ™), replace: "™" }
replacements << { find: %w(&copy; ©), replace: "©" }
replacements << { find: %w(&reg; ®), replace: "®" }
replacements << { find: %w(&rsquo; ’), replace: "'" }
replacements << { find: %w(&rdquo; ”), replace: '"' }
replacements << { find: %w(&bull; •), replace: "•" }
replacements << { find: %w(&hellip; …), replace: "..." }
replacements << { find: %w(&ndash; – &mdash; —), replace: "-" }
replacements.map do |repl|
repl[:find].map { |find| s.gsub! find, repl[:replace] }
end
s
end
|