2017-12-11 12:40:12 +01:00
|
|
|
module HtmlToStringHelper
|
|
|
|
def html_to_string(html)
|
2017-12-12 10:06:50 +01:00
|
|
|
if html.blank?
|
|
|
|
html
|
|
|
|
else
|
|
|
|
string_with_tags = html
|
|
|
|
.gsub(/<br[ ]?[\/]?>/, "\n")
|
|
|
|
.gsub('</p>', "\n")
|
|
|
|
.gsub('<p>', '')
|
2017-12-11 12:40:12 +01:00
|
|
|
|
2017-12-12 10:06:50 +01:00
|
|
|
strip_tags(string_with_tags)
|
|
|
|
end
|
2017-12-11 12:40:12 +01:00
|
|
|
end
|
|
|
|
end
|