class Nokogiri::XML::Node

Public Instance Methods

replace(replacement)
Also aliased as: replace_without_encoding_fix
replace_with_encoding_fix(replacement) click to toggle source

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.

# File lib/html/pipeline.rb, line 195
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
Also aliased as: replace
replace_without_encoding_fix(replacement)
Alias for: replace
swap(replacement) click to toggle source
# File lib/html/pipeline.rb, line 205
def swap(replacement)
  replace(replacement)
  self
end