Class: Redmine::WikiFormatting::HtmlParser
- Inherits:
-
Object
- Object
- Redmine::WikiFormatting::HtmlParser
- Defined in:
- lib/redmine/wiki_formatting/html_parser.rb
Overview
Direct Known Subclasses
Defined Under Namespace
Classes: WikiTags
Class Method Summary collapse
Class Method Details
.to_text(html) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/redmine/wiki_formatting/html_parser.rb', line 30 def self.to_text(html) html = html.gsub(/[\n\r]/, '').squeeze(' ') doc = Loofah.document(html) doc.scrub!(WikiTags.new()) doc.scrub!(:newline_block_elements) Loofah::Helpers.remove_extraneous_whitespace(doc.text).strip end |