demarches-normaliennes/app/helpers/html_to_string_helper.rb
2017-12-11 12:40:12 +01:00

10 lines
209 B
Ruby

module HtmlToStringHelper
def html_to_string(html)
string_with_tags = html
.gsub(/<br[ ]?[\/]?>/, "\n")
.gsub('</p>', "\n")
.gsub('<p>', '')
strip_tags(string_with_tags)
end
end