Class: Nokogiri::XML::Node
- Inherits:
-
Object
- Object
- Nokogiri::XML::Node
- Defined in:
- lib/html/pipeline_plus.rb
Instance Method Summary collapse
-
#replace_with_encoding_fix(replacement) ⇒ Object
(also: #replace)
Work around an issue with utf-8 encoded data being erroneously converted to …
- #swap(replacement) ⇒ Object
Instance Method Details
#replace_with_encoding_fix(replacement) ⇒ Object Also known as: replace
Work around an issue with utf-8 encoded data being erroneously converted to … some other shit when replacing text nodes. See ‘utf-8 output 2’ in user_content_test.rb for details.
192 193 194 195 196 197 |
# File 'lib/html/pipeline_plus.rb', line 192 def replace_with_encoding_fix(replacement) if replacement.respond_to?(:to_str) replacement = document.fragment("<div>#{replacement}</div>").children.first.children end replace_without_encoding_fix(replacement) end |
#swap(replacement) ⇒ Object
202 203 204 205 |
# File 'lib/html/pipeline_plus.rb', line 202 def swap(replacement) replace(replacement) self end |