Use this filter to cleanup the generated html.
Methods
Constants
| PATH | = | `locate libtidy.so`.strip |
Public Class methods
[ show source ]
# File lib/raw/compiler/filter/tidy.rb, line 14
14: def self.apply(source)
15: ::Tidy.path = PATH
16:
17: defaults = {
18: :output_xml => true,
19: :input_encoding => :utf8,
20: :output_encoding => :utf8,
21: :indent_spaces => 2,
22: :indent => :auto,
23: :markup => :yes,
24: :wrap => 500
25: }
26:
27: ::Tidy.open(:show_warnings => true) do |tidy|
28: for key, value in defaults
29: tidy.options.send("#{key}=", value.to_s)
30: end
31: tidy.clean(source)
32: end
33: rescue LoadError => ex
34: error ex
35: error "cannot load 'tidy', please `gem install tidy`"
36: error "you can find it at http://tidy.rubyforge.org/"
37: end
Public Instance methods
[ show source ]
# File lib/raw/compiler/filter/tidy.rb, line 39
39: def apply(source)
40: self.class.apply(source)
41: end