Any Amrita experts out there...

I have a tag which contains another tag. I want to set the body text of the
parent tag *and* set an attribute of the child tag, and I can't for the life
of me figure out how to do it.

Here's the example:

# --- 8< -------------------------------------------------------------
require 'amrita/template'
include Amrita

template = Amrita::TemplateText.new(<<EOS)
<div id="items">
  <div id="item">REPLACE ME <a id="add">(Add)</a></div>
</div>
EOS

# What I want to do is:
# (1) replace 'REPLACE ME ' with some text
# (2) Conditionally keep the hyperlink, and set its href attribute

# Desired output:
# <div>
#   <div>Foo thing (Add)</div>
# </div><div>
#   <div>bar</div>
# </div>

# 'add' is a child of 'item', but how do I set 'item's body text whilst at
# the same time setting the child attribute?

template.expand($stdout, { :items=>[
	{ :item=>{
		:body=>'Foo thing',    # <<<<< Not like this, but how?
		:add=>a(:href=>"wibble.cgi?add=foo")
	} },
	{ :item=>'bar' },    # no :add, this item doesn't need the <a> tag
]})

# This version sets the text, but removes the <a>(Add)</a> tag

template.expand($stdout, { :items=>[
	{ :item=>proc { |e|
		e.set_text('Foo thing')
		e
	} },
	{ :item=>'bar' },
]})
# --- 8< -------------------------------------------------------------

I guess I could change my template to

<div id="items">
  <div id="item"><span id="body">REPLACE ME</span><a id="add">(Add)</a></div>
</div>

in which case it's straightforward, but I just wondered if I was missing
a way of doing this directly?

Cheers...

Brian.