Created
December 19, 2008 14:19
-
-
Save mikker/38013 to your computer and use it in GitHub Desktop.
Haml block link helper
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 use this in Sinatra/Webby/whatever to make Haml-links | |
# Examples: | |
# link("/") { "Go home" } | |
# link("#bang") do | |
# %img{:src => "image.jpg"} | |
# .caption Some image | |
def link(url, opts={}, &block) | |
opts.merge!(:href => url) | |
haml_tag(:a, opts) { yield } | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment