html2haml autodetects ERB files.

This commit is contained in:
Nathan Weizenbaum 2008-08-03 00:27:12 -04:00
parent 1a0d994e3a
commit 50f0ef199e
1 changed files with 7 additions and 0 deletions

View File

@ -292,6 +292,10 @@ END
@module_opts[:rhtml] = true
end
opts.on('--no-rhtml', "Don't parse RHTML tags.") do
@options[:no_rhtml] = true
end
opts.on('-x', '--xhtml', 'Parse the input using the more strict XHTML parser.') do
@module_opts[:xhtml] = true
end
@ -305,6 +309,9 @@ END
input = @options[:input]
output = @options[:output]
@module_opts[:rhtml] ||= input.respond_to?(:path) && input.path =~ /\.(rhtml|erb)$/
@module_opts[:rhtml] &&= @options[:no_rhtml] != false
output.write(::Haml::HTML.new(input, @module_opts).render)
end
end