Class: Redmine::WikiFormatting::HtmlParser::WikiTags
- Inherits:
-
Loofah::Scrubber
- Object
- Loofah::Scrubber
- Redmine::WikiFormatting::HtmlParser::WikiTags
- Defined in:
- lib/redmine/wiki_formatting/html_parser.rb
Instance Method Summary collapse
-
#initialize(tags_to_text) ⇒ WikiTags
constructor
A new instance of WikiTags.
- #scrub(node) ⇒ Object
Constructor Details
#initialize(tags_to_text) ⇒ WikiTags
Returns a new instance of WikiTags
41 42 43 44 |
# File 'lib/redmine/wiki_formatting/html_parser.rb', line 41 def initialize() @direction = :bottom_up @tags_to_text = || {} end |
Instance Method Details
#scrub(node) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/redmine/wiki_formatting/html_parser.rb', line 46 def scrub(node) formatting = @tags_to_text[node.name] case formatting when Hash node.add_next_sibling Nokogiri::XML::Text.new("#{formatting[:pre]}#{node.content}#{formatting[:post]}", node.document) node.remove when String node.add_next_sibling Nokogiri::XML::Text.new(formatting, node.document) node.remove else CONTINUE end end |