On 23 Feb 2013, at 11:47, Andre Jaenisch wrote:
>
> Now my question:
> Is it possible to use Microdata information in a standalone Haml
> environment?
> I know, that I could overwrite the TagHelper in
> ActionView<http://stackoverflow.com/questions/4867404/rails-3-html-5-microdata>
> -
> but I don't know, whether I can use Rails later.
> And Rails for static HTML would be like to crack a nut with a sledgehammer …
>
I'm guessing you're asking if you can use Haml to create "valueless" attributes
such as `itemscope`.
If you use a boolean as the value of the attribute, then if the value is `true`
it will be rendered as a valueless attribute when the format is html, and with
the appropriate value when the format is xhtml.
For example, the following Haml:
%section{:itemscope => true, :itemtype => "http://schema.org/Person"}
Hello, my name is
%span{:itemprop => "name"} John Doe
Produces the following with the `format` option set to `:html5` (which is the
default):
<section itemscope itemtype='http://schema.org/Person'>
Hello, my name is
<span itemprop='name'>John Doe</span>
</section>
and with format set to `:xhtml` it produces:
<section itemscope='itemscope' itemtype='http://schema.org/Person'>
Hello, my name is
<span itemprop='name'>John Doe</span>
</section>
See the section on boolean attributes in the docs:
<http://haml.info/docs/yardoc/file.REFERENCE.html#boolean_attributes>.
Matt
--
You received this message because you are subscribed to the Google Groups
"Haml" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/haml?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.