First off, is this the place to ask? If not, apologies, and please
point me to the right spot.
2 questions:
1 Is “span” the recommended way of dumping an element outside of any
other tags, when no formatting is required (nor desired)?
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:
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.
Thanks,
Michael
···
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
I checked out the amrita mailing list and the archives seem to indicate
that it is defunct. So I think that this is the next most closely
related list for stuff like this. At least, this has been my assumption.
I think the answer to #1 is yes. If you just want text of some kind and
no other formatting, or if formatting has been declared elsewhere
already, then span is what you want to use.
The answer to #2, is that this is what amrita does by default. If you
want to keep the unfound tags in, you have to set template.keep_id to
true (“template” here is an instance of TemplateFile).
However, your example is showing something slightly different. I would
do something like:
in my template file and then just
data[:name] = ‘Name: Joe Blow’
That way you get all or nothing.
Michael Campbell wrote:
···
First off, is this the place to ask? If not, apologies, and please
point me to the right spot.
2 questions:
1 Is “span” the recommended way of dumping an element outside of any
other tags, when no formatting is required (nor desired)?
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:
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.
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
, 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 ‘’
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:
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 ‘not included’
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
···
On Sat, 20 Dec 2003, Michael Campbell wrote:
ATTN: please update your address books with address below!
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’
===============================================================================