Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

html2haml autodetects ERB files.

  • Loading branch information...
commit 50f0ef199ea5b3c5e5741a451328a409ab4765a1 1 parent 1a0d994
@nex3 nex3 authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/haml/exec.rb
View
7 lib/haml/exec.rb
@@ -292,6 +292,10 @@ def set_opts(opts)
@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 @@ def process_result
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
Please sign in to comment.
Something went wrong with that request. Please try again.