module Loofah
Strings and IO Objects as Input
The following methods accept any IO object in addition to accepting a string:
That IO object could be a file, or a socket, or a StringIO, or anything that responds to read and close.
Constants
- HTML
-
Alias for
Loofah::HTML4 - VERSION
-
The version of
Loofahyou are using
Public Class Methods
Source
# File lib/loofah.rb, line 70 def html4_document(*args, &block) Loofah::HTML4::Document.parse(*args, &block) end
Shortcut for Loofah::HTML4::Document.parse(*args, &block)
This method accepts the same parameters as Nokogiri::HTML4::Document.parse
Source
# File lib/loofah.rb, line 77 def html4_fragment(*args, &block) Loofah::HTML4::DocumentFragment.parse(*args, &block) end
Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse
Source
# File lib/loofah.rb, line 95 def html5_document(*args, &block) Loofah::HTML5::Document.parse(*args, &block) end
Shortcut for Loofah::HTML5::Document.parse(*args, &block)
This method accepts the same parameters as Nokogiri::HTML5::Document.parse
Source
# File lib/loofah.rb, line 102 def html5_fragment(*args, &block) Loofah::HTML5::DocumentFragment.parse(*args, &block) end
Shortcut for Loofah::HTML5::DocumentFragment.parse(*args, &block)
This method accepts the same parameters as Nokogiri::HTML5::DocumentFragment.parse
Source
# File lib/loofah.rb, line 163 def remove_extraneous_whitespace(string) string.gsub(/\n\s*\n\s*\n/, "\n\n") end
A helper to remove extraneous whitespace from text-ified HTML
Source
# File lib/loofah.rb, line 82 def scrub_html4_document(string_or_io, method) Loofah::HTML4::Document.parse(string_or_io).scrub!(method) end
Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
Source
# File lib/loofah.rb, line 87 def scrub_html4_fragment(string_or_io, method) Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method) end
Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
Source
# File lib/loofah.rb, line 107 def scrub_html5_document(string_or_io, method) Loofah::HTML5::Document.parse(string_or_io).scrub!(method) end
Shortcut for Loofah::HTML5::Document.parse(string_or_io).scrub!(method)
Source
# File lib/loofah.rb, line 112 def scrub_html5_fragment(string_or_io, method) Loofah::HTML5::DocumentFragment.parse(string_or_io).scrub!(method) end
Shortcut for Loofah::HTML5::DocumentFragment.parse(string_or_io).scrub!(method)
Source
# File lib/loofah.rb, line 158 def scrub_xml_document(string_or_io, method) Loofah.xml_document(string_or_io).scrub!(method) end
Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
Source
# File lib/loofah.rb, line 153 def scrub_xml_fragment(string_or_io, method) Loofah.xml_fragment(string_or_io).scrub!(method) end
Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
Source
# File lib/loofah.rb, line 141 def xml_document(*args, &block) Loofah::XML::Document.parse(*args, &block) end
Shortcut for Loofah::XML::Document.parse(*args, &block)
This method accepts the same parameters as Nokogiri::XML::Document.parse
Source
# File lib/loofah.rb, line 148 def xml_fragment(*args, &block) Loofah::XML::DocumentFragment.parse(*args, &block) end
Shortcut for Loofah::XML::DocumentFragment.parse(*args, &block)
This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse