module Loofah

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/loofah.rbs

module Loofah
  def html4_fragment: (*Array[String] args, ) -> Loofah::HTML4::DocumentFragment
end

def html4_document(*args, &block)

This method accepts the same parameters as Nokogiri::HTML4::Document.parse

Shortcut for Loofah::HTML4::Document.parse(*args, &block)
def html4_document(*args, &block)
  Loofah::HTML4::Document.parse(*args, &block)
end

def html4_fragment(*args, &block)

Experimental RBS support (using type sampling data from the type_fusion project).

def html4_fragment: (* args, ) -> Loofah::HTML4::DocumentFragment

This signature was generated using 11 samples from 1 application.

This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse

Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
def html4_fragment(*args, &block)
  Loofah::HTML4::DocumentFragment.parse(*args, &block)
end

def html5_document(*args, &block)

This method accepts the same parameters as Nokogiri::HTML5::Document.parse

Shortcut for Loofah::HTML5::Document.parse(*args, &block)
def html5_document(*args, &block)
  Loofah::HTML5::Document.parse(*args, &block)
end

def html5_document(*args, &block)

def html5_document(*args, &block)
  raise NotImplementedError, "Loofah::HTML5 is not supported by your version of Nokogiri"
end

def html5_fragment(*args, &block)

This method accepts the same parameters as Nokogiri::HTML5::DocumentFragment.parse

Shortcut for Loofah::HTML5::DocumentFragment.parse(*args, &block)
def html5_fragment(*args, &block)
  Loofah::HTML5::DocumentFragment.parse(*args, &block)
end

def html5_fragment(*args, &block)

def html5_fragment(*args, &block)
  raise NotImplementedError, "Loofah::HTML5 is not supported by your version of Nokogiri"
end

def html5_support?

def html5_support?
  # Note that Loofah can only support HTML5 in Nokogiri >= 1.14.0 because it requires the
  # subclassing fix from https://github.com/sparklemotion/nokogiri/pull/2534
  return @html5_support if defined? @html5_support
  @html5_support =
    Gem::Version.new(Nokogiri::VERSION) > Gem::Version.new("1.14.0") &&
    Nokogiri.uses_gumbo?
end

def remove_extraneous_whitespace(string)

A helper to remove extraneous whitespace from text-ified HTML
def remove_extraneous_whitespace(string)
  string.gsub(/\n\s*\n\s*\n/, "\n\n")
end

def scrub_html4_document(string_or_io, method)

Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
def scrub_html4_document(string_or_io, method)
  Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
end

def scrub_html4_fragment(string_or_io, method)

Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
def scrub_html4_fragment(string_or_io, method)
  Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
end

def scrub_html5_document(string_or_io, method)

Shortcut for Loofah::HTML5::Document.parse(string_or_io).scrub!(method)
def scrub_html5_document(string_or_io, method)
  Loofah::HTML5::Document.parse(string_or_io).scrub!(method)
end

def scrub_html5_document(string_or_io, method)

def scrub_html5_document(string_or_io, method)
  raise NotImplementedError, "Loofah::HTML5 is not supported by your version of Nokogiri"
end

def scrub_html5_fragment(string_or_io, method)

Shortcut for Loofah::HTML5::DocumentFragment.parse(string_or_io).scrub!(method)
def scrub_html5_fragment(string_or_io, method)
  Loofah::HTML5::DocumentFragment.parse(string_or_io).scrub!(method)
end

def scrub_html5_fragment(string_or_io, method)

def scrub_html5_fragment(string_or_io, method)
  raise NotImplementedError, "Loofah::HTML5 is not supported by your version of Nokogiri"
end

def scrub_xml_document(string_or_io, method)

Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
def scrub_xml_document(string_or_io, method)
  Loofah.xml_document(string_or_io).scrub!(method)
end

def scrub_xml_fragment(string_or_io, method)

Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
def scrub_xml_fragment(string_or_io, method)
  Loofah.xml_fragment(string_or_io).scrub!(method)
end

def xml_document(*args, &block)

This method accepts the same parameters as Nokogiri::XML::Document.parse

Shortcut for Loofah::XML::Document.parse(*args, &block)
def xml_document(*args, &block)
  Loofah::XML::Document.parse(*args, &block)
end

def xml_fragment(*args, &block)

This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse

Shortcut for Loofah::XML::DocumentFragment.parse(*args, &block)
def xml_fragment(*args, &block)
  Loofah::XML::DocumentFragment.parse(*args, &block)
end