Sha256: 329b5a8014a13b7f21aceebd9d172d993326b8f344baa7d34b2ef7e04941d21d

Contents?: true

Size: 619 Bytes

Versions: 6

Compression:

Stored size: 619 Bytes

Contents

module Nanoc::Toolbox::Filters
  # NANOC Filter for html output tidy
  #
  # @author Anouar ADLANI <anouar@adlani.com>
  class HtmlTidy < Nanoc::Filter

    identifier :html_tidy

    # Tidy the HTML output
    # Runs the content through Nokogiry document parser, and request the html output,
    # which is tidied by default.
    #
    # @param [String] content The content to filter
    # @param [String] params This method takes no options.
    # @return [String] The filtered content
    def run(content, params = {})
      require 'nokogiri'
      Nokogiri::HTML::Document.parse(content).to_html
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-toolbox-0.2.1 lib/nanoc/toolbox/filters/html_tidy.rb
nanoc-toolbox-0.2.0 lib/nanoc/toolbox/filters/html_tidy.rb
nanoc-toolbox-0.1.3 lib/nanoc/toolbox/filters/html_tidy.rb
nanoc-toolbox-0.1.2 lib/nanoc/toolbox/filters/html_tidy.rb
nanoc-toolbox-0.1.1 lib/nanoc/toolbox/filters/html_tidy.rb
nanoc-toolbox-0.1.0 lib/nanoc/toolbox/filters/html_tidy.rb