Outer whitespace removal is "all or nothing" and I've had a few
instances with inline tags where that has given me a problem (OK, a
workaround is use to HTML, but this is a Haml file, right?)
A couple of examples:
1. Inline tag immediately following opening parenthesis
(
%a(href="url") Link
more text)
The desired result is "(Link more text)"
2. Comma separated list of links
%a(href="url1") Link1
,
%a(href="url2") Link2
,
%a(href="url3") Link3
The desired output is "Link1, Link2, Link3"
To enable the desired outputs, outer whitespace removal needs finer
control, i.e. remove only whitespace before or after the tag.
A solution I have come with is to allow modifiers to the outer
whitespace control
|> means remove outer whitespace, but not before the tag, only after
it
>| means remove outer whitespace, but not after the tag, only before it
> means remove all outer whitespace a sit does now.
I chose "|" as the modifier as it looks like a wall were you have to
stop.
Using the modifiers I can now get the output I want without resorting
to using inline HTML tags in Haml. The examples above become:
(
%a(href="url")>| Link
more text)
and
%a(href="url1")|> Link1
,
%a(href="url2")|> Link2
,
%a(href="url3")|> Link3
I hope this is of interest.
--
You received this message because you are subscribed to the Google Groups "Haml Dev" group.
To post to this group, send email to
haml...@googlegroups.com.
To unsubscribe from this group, send email to
haml-dev+u...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/haml-dev?hl=en.