From: Don-Duong Quach Date: 2003-12-24T15:16:00+09:00 Subject: Re: amrita question You can use attribute expansion by placing an "@" in front of the word you want to replace. Example: require 'amrita/template' include Amrita temp = TemplateText.new < END temp.expand(STDOUT, :action=>"foo.cgi") Output:
Don Quach Carl Youngblood wrote: > I'm having a weird problem with amrita. I need to have the contents > of a tag attribute be dynamically generated. So, if my template file > has: > >
> ... >
> > How do I do that? I tried: > >
"> > ... >
> > And amrita croaks during the parsing process. Here is what I get: > > /var/www/html/pt.fcgi:13 > /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:473:in `each_cgi' > /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:473:in `each' > /var/www/html/pt.fcgi:13:in `each_cgi' > /var/www/html/pt.fcgi:15 > /var/www/pennytracker/include/controller.rb:31:in `process_request' > /var/www/pennytracker/include/authentication.rb:54:in > `authenticate_if_needed' > /var/www/pennytracker/include/view.rb:42:in `display' > /usr/local/lib/ruby/site_ruby/1.8/amrita/template.rb:402:in `expand' > /usr/local/lib/ruby/site_ruby/1.8/amrita/template.rb:138:in `expand' > /usr/local/lib/ruby/site_ruby/1.8/amrita/template.rb:144:in `setup' > /usr/local/lib/ruby/site_ruby/1.8/amrita/template.rb:179:in > `setup_template' > /usr/local/lib/ruby/site_ruby/1.8/amrita/template.rb:396:in > `load_template' > /usr/local/lib/ruby/site_ruby/1.8/amrita/parser.rb:279:in `parse_file' > /usr/local/lib/ruby/site_ruby/1.8/amrita/parser.rb:279:in `open' > /usr/local/lib/ruby/site_ruby/1.8/amrita/parser.rb:280:in `parse_file' > /usr/local/lib/ruby/site_ruby/1.8/amrita/parser.rb:275:in `parse_io' > /usr/local/lib/ruby/site_ruby/1.8/amrita/parser.rb:301:in `parse' > error hapend in /var/www/pennytracker/templates/login.html:0(can't > happen) > ==>">"> > > Can somebody please explain how I can accomplish what I'm trying to do > with amrita? One way I know I can do it is to generate the whole >
tag dynamically, but that seems kind of kludgy. It would be > better to have a way of inserting only a specific piece of text > anywhere I wanted. > > Thanks, > > Carl Youngblood > > >