The problem with using 'yield' here, at least in the context of Rails, is
that 'yield' only ever returns a string and Haml attributes must be in hash
form. You could just use instance variables, though; do %ht...@namespaces},
and then assign @namespaces = {:dc => :foaf} in your template.

On Thu, Nov 4, 2010 at 2:51 AM, Russell Garner <[email protected]>wrote:

> Hi,
>
> I've been writing some RDFa sites in Erb for a while, and I've ended
> up using the following kind of approach in my application layout:
>
> <html xmlns='etc' <%= yield namespaces %>>
> ...
>
> This means that when a view for a resource requires foaf/dc namespaces
> etc, I can say this:
>
> <%= content_for :namespaces %>
>    <%= RDF::Namespaces.declare(:dc, :foaf)
> <% end %>
>
> ... and only the namespaces I need will make it into the document.  Is
> there a way I can do something similar in HAML?  I note you can say
>
> %html{method_returning_a_hash, another_method_returning_a_hash}
>
> but I'm struggling to turn this 'yield' approach into haml where only
> attributes need to be extended.  I may be missing something obvious,
> but does anyone have any idea how I can yield to another block in my
> %html declaration?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to