class Strelka::CMS::PageFilter::Cleanup

A filter that cleans up broken HTML using libtidy.

Constants

TIDY_OPTIONS

Options to pass to libtidy

Public Instance Methods

process( source, page ) click to toggle source

Process the page's source with the filter and return the altered content.

# File lib/strelka/cms/pagefilter/cleanup.rb, line 28
def process( source, page )
        Tidy.open( TIDY_OPTIONS ) do |tidy|
                xml = tidy.clean( source )

                errors = tidy.errors
                self.log.error( errors.join('; ') ) unless errors.empty?

                return xml
        end
end