Thanks Sean, updated my patch: http://dev.radiantcms.org/radiant/attachment/ticket/611/enable_snippets_as_double_tag_with_yield.2.diff
Cheers, Drew On 14 Feb 2008, at 14:21, Sean Cribbs wrote: > Something like this: > > (in your snippet tag) > > tag.locals.yield = tag.expand > > > tag 'yield' do |tag| > tag.locals.yield > end > > Andrew Neil wrote: >> Sean, thanks for your reply. I thought there would be more to it than >> that, but you made it sound easy, so I gave it a go. Here is the >> ticket: >> >> http://dev.radiantcms.org/radiant/ticket/611 >> http://dev.radiantcms.org/radiant/attachment/ticket/611/enable_snippets_as_double_tag_with_yield.diff >> >> >>> You would need to capture the contents of the <r:snippet /> tag >>> before >>> rendering the snippet, either using tag.block or tag.expand and >>> saving >>> it in a local. Then your <r:yield /> tag would emit that local. >>> >> >> I wasn't sure how to save tag.expand in a local so that it was >> accessible from <r:yield/>, so I've cheated a little: >> >> snippet.content.gsub!(%r{<r\:yield\s?/?>}, tag.expand) >> >> and making <r:yield/> output nothing. It's not exactly idiomatic, but >> it passes the tests! >> >> Cheers, >> >> Drew >> _______________________________________________ >> Radiant mailing list >> Post: [email protected] >> Search: http://radiantcms.org/mailing-list/search/ >> Site: http://lists.radiantcms.org/mailman/listinfo/radiant >> >> > > _______________________________________________ > Radiant mailing list > Post: [email protected] > Search: http://radiantcms.org/mailing-list/search/ > Site: http://lists.radiantcms.org/mailman/listinfo/radiant _______________________________________________ Radiant mailing list Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
