I'm developing a tag inspired by the way <r:navigation /> works; by using nested tags to let the user specify how he wants to render a given collection.

The user could write:

- and the tag uses this nested tag by doing:
    hash = tag.locals.collection_tag = {}

- and then later:

- to render the contents of the nested tag.

However, I want the user to also be able to write just:
<r:collection_tag />

- and the tag will populate hash[:normal] with a default value of, say, <r:link />.

However, I don't know how to create a default value for a nested tag, least not when it contains other Radius tags that need to be parsed in the context of each iteration of the collection.

I have tried assigning default values with code such as:
    hash[:normal]   ||= '<li><r:link /></li>'

- or:
    hash[:normal]   ||= Proc.new {'<li><r:link /></li>'}

- but the first is just a string, and does not respond to the #call method, and the second is just a proc, and do not in fact render <r:link /> in the context, it just returns the string unparsed.

I know of several examples on using default values for tag attributes, but not for nested tags. Any hints, ideas, examples?

Casper Fabricius

Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to