Sha256: 954b917cfd9746b95133e143bd386fd3e602168e61b48d7e20fcc5daf14e672f

Contents?: true

Size: 608 Bytes

Versions: 6

Compression:

Stored size: 608 Bytes

Contents

module MasterView
  module TidyHelper
    def self.tidy(html)
      Tidy.path = ::MasterView::TidyPath unless Tidy.path
      xml = Tidy.open do |tidy|
        tidy.options.output_xml = true
        tidy.options.indent = true
        tidy.options.wrap = 0
        xml = tidy.clean(html)
      end
      xml = ::MasterView::EscapeErbHelper.escape_erb(xml)
      ::MasterView::Log.debug { 'tidy corrected xml='+xml }
      xml
    end


  end

  module EscapeErbHelper
    def self.escape_erb(html)
      html = html.gsub(/<%/, InlineErbStart)
      html.gsub!(/%>/, InlineErbEnd)
      html
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
masterview-0.2.0 lib/masterview/filter_helpers.rb
masterview-0.2.1 lib/masterview/filter_helpers.rb
masterview-0.2.3 lib/masterview/filter_helpers.rb
masterview-0.2.2 lib/masterview/filter_helpers.rb
masterview-0.2.4 lib/masterview/filter_helpers.rb
masterview-0.2.5 lib/masterview/filter_helpers.rb