Is it possible in HAML to create variable TAGs as the subject asks?
Want to do
- tag = "h1"
%tag
Cheers
Final Version I used was
-# Type Default
- if ! defined? locals[ :type ]
- type = "h1"
- else
- type = locals[ :type ]
-# Heading
- haml_tag type do
-# Main Text
= locals[:text]
-# Add the secondary text if required
-if defined? locals[ :small ]
%small= locals[ :small ]
Yeah, it's possible.
Try this.
- tag = 'h1'
- haml_tag tag, "I'm h1."