parent
1e5a4ba48c
commit
3dbf1bf3d3
|
@ -18,6 +18,8 @@
|
||||||
to the source Haml file from which it was generated. Thanks [Alex Babkin](https://github.com/ababkin).
|
to the source Haml file from which it was generated. Thanks [Alex Babkin](https://github.com/ababkin).
|
||||||
* Fix #@foo and #$foo style interpolation that was not working in html_safe mode. (Akira Matsuda)
|
* Fix #@foo and #$foo style interpolation that was not working in html_safe mode. (Akira Matsuda)
|
||||||
* Add `haml_tag_if` to render a block, conditionally wrapped in another element (Matt Wildig)
|
* Add `haml_tag_if` to render a block, conditionally wrapped in another element (Matt Wildig)
|
||||||
|
* The `haml` command's debug option (`-d`) no longer executes the Haml code, but
|
||||||
|
rather checks the generated Ruby syntax for errors.
|
||||||
|
|
||||||
## 4.0.6
|
## 4.0.6
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,12 @@ END
|
||||||
|
|
||||||
if @options[:debug]
|
if @options[:debug]
|
||||||
puts engine.precompiled
|
puts engine.precompiled
|
||||||
puts '=' * 100
|
error = validate_ruby(engine.precompiled)
|
||||||
|
if error
|
||||||
|
puts '=' * 100
|
||||||
|
puts error.message.split("\n")[0]
|
||||||
|
end
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
result = engine.to_html
|
result = engine.to_html
|
||||||
|
@ -326,6 +331,15 @@ END
|
||||||
output.write(result)
|
output.write(result)
|
||||||
output.close() if output.is_a? File
|
output.close() if output.is_a? File
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def validate_ruby(code)
|
||||||
|
begin
|
||||||
|
eval("BEGIN {return nil}; #{code}")
|
||||||
|
# Not sure why, but rescuing "SyntaxError" does not work here.
|
||||||
|
rescue Exception
|
||||||
|
$!
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue