Not anymore! Haml has a new feature: filters. You can now embed another
parsing system right into your document. What was once
#script
%h2 Hamlet
%p
Where wilt thou lead me?
= succeed ';'
%em speak
I'll go no further.
%h2 Ghost
%p
%strong Mark me.
%h2 Hamlet
%p I will.
%h2 Ghost
%p
My hour is almost come,
When I to sulphurous and tormenting flames
Must render up myself.
%h2 Hamlet
%p Alas, poor ghost!
Now becomes
#script
:markdown
Hamlet
======
Where wilt thou lead me? *speak*; I'll go no further.
Ghost
=====
**Mark me.**
Hamlet
======
I will.
Ghost
=====
My hour is almost come,
When I to sulphurous and tormenting flames
Must render up myself.
Hamlet
======
Alas, poor ghost!
Far nicer, and easier to read.
Haml comes predefined with several filters, and has a simple interface
for defining your own. It comes with:
Markdown, Textile and Redcloth: Markdown and Textile are the human
markup languages with those names, and Redcloth is a combination of the
two. These are all only available if the Redcloth gem is installed, with
the exception of Markdown, which is also available if BlueCloth is
installed.
ERB: Uses ERB to parse the text.
Ruby: Runs the text through the Ruby interpreter, and outputs anything
from the text printed to standard output.
Sass: Sass. Duh.
Plain: Doesn't parse the text at all, just outputs it straight out. This
allows you to write text without worrying about stuff like "." or "%"
causing Haml to try to parse the line.
In the future, you may be able to pass instance variables to the
code-aware filters, like ERB and Ruby.
As usual, this feature is already implemented in trunk, so if you want
to try it out, all you have to do is download. Enjoy!
- Nathan
!highlight_color = #5d3526
...
.line-below
:border-bottom= !highlight_color 1px solid
This will not, of course, work. Is there a Sassy way to accomplish this?
Thanks
We were discussing the exact same issue.
Hopefully, it will be possible soon....
:border-bottom= !highlight_color + \ 1px\ solid
or, more elegantly,
:border-bottom= !highlight_color + " 1px solid"
In the future, a lack of operator may default to concatenation with a space.
- Nathan