You can span multiple lines, but we don't encourage it, so the syntax is
somewhat awkward. To do so, add a pipe character ("|") to the end of
each line you want continued (even the last one). So your example would
look like:
!!!
%html{ :lang => "en", |
'xml:lang' => "en", |
'xmlns:dcel' => "http://purl.org/dc/elements/1.1/", |
'xmlns:dcterms' => "http://purl.org/dc/terms/", |
'xmlns:dctypes' => "http://purl.org/dc/dcmitype/", |
'xmlns:doap' => "http://usefulinc.com/ns/doap#", |
'xmlns:foaf' => "http://xmlns.com/foaf/0.1/", |
'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", |
'xmlns:rdfs' => "http://www.w3.org/2000/01/rdf-schema#", |
'xmlns:sioc' => "http://rdfs.org/sioc/ns#", |
'xmlns:swrc' => "http://swrc.ontoware.org/ontology#", |
'xmlns' => "http://www.w3.org/1999/xhtml" } |
A better solution, though, would be to move all that into a helper. If
you define a helper like so:
def html_attrs
{ :lang => "en",
'xml:lang' => "en",
'xmlns:dcel' => "http://purl.org/dc/elements/1.1/",
'xmlns:dcterms' => "http://purl.org/dc/terms/",
'xmlns:dctypes' => "http://purl.org/dc/dcmitype/",
'xmlns:doap' => "http://usefulinc.com/ns/doap#",
'xmlns:foaf' => "http://xmlns.com/foaf/0.1/",
'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
'xmlns:rdfs' => "http://www.w3.org/2000/01/rdf-schema#",
'xmlns:sioc' => "http://rdfs.org/sioc/ns#",
'xmlns:swrc' => "http://swrc.ontoware.org/ontology#",
'xmlns' => "http://www.w3.org/1999/xhtml" }
end
You can access it like so:
!!!
%html{html_attrs}
Moving your data out of the view and into a helper, and keeping the view
nice and clean-looking.
- Nathan
mylan wrote:
> I'm a little surprised I can't do:
>
> !!!
> %html{ :lang => "en",
> 'xml:lang' => "en",
> 'xmlns:dcel' => "http://purl.org/dc/elements/1.1/",
> 'xmlns:dcterms' => "http://purl.org/dc/terms/",
> 'xmlns:dctypes' => "http://purl.org/dc/dcmitype/",
> 'xmlns:doap' => "http://usefulinc.com/ns/doap#",
> 'xmlns:foaf' => "http://xmlns.com/foaf/0.1/",
> 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
> 'xmlns:rdfs' => "http://www.w3.org/2000/01/rdf-schema#",
> 'xmlns:sioc' => "http://rdfs.org/sioc/ns#",
> 'xmlns:swrc' => "http://swrc.ontoware.org/ontology#",
> 'xmlns' => "http://www.w3.org/1999/xhtml" }
>
>
> I receive:
> Illegal Nesting: Nesting within a tag that already has content is
> illegal.
>
> Assuming I can span multiple lines, is there a right way to do this?
>
> =my=
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---