Brackets represent a Ruby hash that is used for specifying the attributes of an element. It is literally evaluated as a Ruby hash, so logic will work in it and local variables may be used. Quote characters within the attribute will be replaced by appropriate escape sequences. The hash is placed after the tag is defined. For example:
%head{ :name => "doc_head" }
%script{ 'type' => "text/" + "javascript",
:src => "javascripts/script_#{2 + 7}" }
is compiled to:
<head name="doc_head">
<script src='javascripts/script_9' type='text/javascript'>
</script>
</head>
%table
%col{:width => "200px"}/
%col{:width => "75px"}/
etc.
Sean
I agree, but tables are nasty things that are notoriously hard to style. Do what works for you.
Sean
Jarrod Spillers wRrote:
Like so:
%table
%tr
%th{:width => "200"} Name
%th{:width => "200"} Description