On Sat, 20 Dec 2003, Michael Campbell wrote:
> First off, is this the place to ask? If not, apologies, and please point me
> to the right spot.
i'll let someone else answer that. IMHO ruby has big potential to be a
leading web development tool and being a leading web development tool means
being a leading development tool so discussion on how to get there are on
topic.
> 2 questions:
>
> 1 Is "span" the recommended way of dumping an element outside of any
> other tags, when no formatting is required (nor desired)?
yes. also there is <div/>, but IE does funny things with it. i generally use
div. note that when a span has no attributes _other_ that 'id' the tag is not
actually included in the output: it's simply a way to include data without
breaking the html files:
~/eg/ruby > cat a.rb
require 'amrita/template'; include Amrita
t = TemplateText.new '<span id=foo></span>'
t.expand STDOUT, :foo => 42
~/eg/ruby > ruby a.rb
42
> 2 Is there a way to mask out non-data elements if a data-element doesn't
> exist?
>
> Suppose I have in my html:
>
> Name: <span id=name></span>
>
> I don't want "Name:" to show if the :name id doesn't exist. I'm sure
> I'm overlooking something fundamental here, but I've just started so
> not sure where to look.
simply do not put ':name' into you data structure:
~/eg/ruby > cat b.rb
require 'amrita/template'; include Amrita
t = TemplateText.new '<span id=foo></span><span id=name>not included</span>'
t.expand STDOUT, :foo => 42
~/eg/ruby > ruby b.rb
42
you can use this approach to block out huge portions of html conditionally.
-a
--
ATTN: please update your address books with address below!
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| STP :: http://www.ngdc.noaa.gov/stp/
| NGDC :: http://www.ngdc.noaa.gov/
| NESDIS :: http://www.nesdis.noaa.gov/
| NOAA :: http://www.noaa.gov/
| US DOC :: http://www.commerce.gov/
|
| The difference between art and science is that science is what we
| understand well enough to explain to a computer.
| Art is everything else.
| -- Donald Knuth, "Discover"
|
| /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done'
===============================================================================