On Sun, Aug 15, 2010 at 4:06 PM, oillio <[email protected]> wrote:
> I have a tag I would like to write, but I am not sure it is possible.
>
> I have a set of tabs.  The tabs are defined within a list, while the
> data to display for each tab is in specially identified divs below.  I
> want to set this up in DRYML, but I don't want to have two tags, one
> for the actual tab and one for the data.  I would like to define the
> information required for the tag as attributes of the data tag.
>
> So, I want something like this:
> The DRYML:
> <tabs>
>  <tab name="Feature1" text="One">The info for one</tab>
>  <tab name="Feature2" text="Two">Additional info on another tab</tab>
> </tabs>
>
> And this would result in the HTML:
> <ul class="tabs">
>  <li><a href="#Feature1">One</a></li>
>  <li><a href="#Feature2">Two</a></li>
> </ul>
> <div id="Feature1">The info for one</div>
> <div id="Feature2">Additional info on another tab</div>
>
> Is it possible to use attributes from a contained tag in the parent
> tag like this?

Yes, with a little bit of scope trickery. Here's a rough cut:

http://gist.github.com/526966

Basically, you end up collecting all the contents and spitting them
out after the ul. The trickiest bit is this one:


  <do if="&false">
    <do param="default" />
  </do>

This keeps the 'merge' on the a tag in tab-content from stuffing the
default param inside the link, which is *definitely* not what you
want. This should probably be documented somewhere.

The code in the Gist above *should* work, but I haven't actually
tested it. Let me know if there are errors.

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to