Amrita question

Hi,

Using Amrita 1.0.2, I’ve got a small html snippet:

I’d like to fill the href for the a, the src for the img, and some text
inside the div.

So far, i’ve got

data = { :thumb_pic => a(:src => ‘image.png’), :title => name,
:main_elt=> a(:href=> ‘
http://www.google.com’) }

This doesn’t work ;
I only got the href filled up correctly…

Any clue ?
TIA

···


Pierre Baillet
Debian - What your mom would use if it were twenty times easier.
http://www.copyleft.net

what’s the purpose of the div? is it supposed to be the text you want for the
link?

i mean - this looks like you want an image AND some text to be links… is
this correct?

-a

Hi,

Using Amrita 1.0.2, I’ve got a small html snippet:

I’d like to fill the href for the a, the src for the img, and some text
inside the div.

So far, i’ve got

data = { :thumb_pic => a(:src => ‘image.png’), :title => name,
:main_elt=> a(:href=> ‘http://www.google.com’) }

This doesn’t work ;
I only got the href filled up correctly…

Any clue ?
TIA

Pierre Baillet
Debian - What your mom would use if it were twenty times easier.
http://www.copyleft.net

-a

···

On Thu, 12 Jun 2003, Pierre Baillet wrote:

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================

/tmp > cat amrita.rb
require ‘amrita/template’
include Amrita

TEMPLATE = <<-html




html

model = Hash[
:main_elt => a(:href => ‘http://www.google.com’) do
Hash[
:thumb_pic => a(:src => ‘image.png’),
:title => ‘name’,
]
end
]

(TemplateText.new TEMPLATE).expand STDOUT, model

/tmp > ruby amrita.rb



Amrita::a() can take a block. if a the calling the block returns a string that
string is used to replace body of the tag wholesale, if the block returns a
hash, it is used to fill in any nested template - like you have.

you could also write the model as:

model = { # a hash
  :main_elt => a(:href => 'http://www.google.com') { # a block
# the block returns a hash
{:thumb_pic => a(:src => 'image.png'), :title => 'name'}
  }
}

-a

···

On Thu, 12 Jun 2003, Pierre Baillet wrote:

Hi,

Using Amrita 1.0.2, I’ve got a small html snippet:

I’d like to fill the href for the a, the src for the img, and some text
inside the div.

So far, i’ve got

data = { :thumb_pic => a(:src => ‘image.png’), :title => name,
:main_elt=> a(:href=> ‘http://www.google.com’) }

This doesn’t work ;
I only got the href filled up correctly…

Any clue ?

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================

Hello, –

i mean - this looks like you want an image AND some text to be links… is
this correct?

Yes, this is exactly what i’m looking for.

···

On Thu, Jun 12, 2003, ahoward wrote:

-a

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================


Pierre Baillet
It is a good viewpoint to see the world as a dream. When you have something
like a nightmare, you will wake up and tell yourself that it was only a dream.
It is said that the world we live in is not a bit different from this.
Ghost Dog - The Way of the Samouraï

Hi,

···

On Thu, Jun 12, 2003, ahoward wrote:

you could also write the model as:

model = { # a hash
  :main_elt => a(:href => 'http://www.google.com') { # a block

the block returns a hash

{:thumb_pic => a(:src => ‘image.png’), :title => ‘name’}
}
}

It’s exactly what i was looking for, thank you !

Cheers,

Pierre Baillet
Support the Debian GNU/Linux Project (http://www.debian.org)