-
-
Save heycarsten/493034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I was thinking about it, and thought if you were going to do "mixins" in Haml | |
# then they ought to work in a predictable way. In ERB you can simply define a | |
# method and place more ERB inside of it. This does not work in Haml, but maybe | |
# it should. | |
require 'sinatra' | |
require 'haml' | |
get '/erb' do | |
erb :test_erb | |
end | |
get '/haml' do | |
haml :test_haml | |
end | |
__END__ | |
@@ test_erb | |
<% def hello(name) %> | |
<p>Hello, <%= name %>.</p> | |
<% end %> | |
<% hello 'Carsten' %> | |
@@ test_haml | |
-# This will fail. | |
- def hello(name) | |
%p Hello, #{name}. | |
- hello 'Carsten' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
interesting.