Forum: Ruby Radius 0.0.2 -- Powerful Tag-Based Templates

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6ec6f77ea603dd75b3a7a7775b059e79?d=identicon&s=25 John W. Long (Guest)
on 2006-02-15 04:22
(Received via mailing list)
Things have stabilized enough to release Radius 0.0.2. This release
contains a couple of minor refactorings.


What's New?
-----------

* Refactored Parser to use Context#render_tag instead of #send when
   rendering tags defined on a Context.

* UndefinedTagError is now thrown when the parser tries to render a tag
   which doesn't exist on a context.

* Added Context#tag_missing which works like method_method missing on
   Object, but is tag specific.


What is Radius?
---------------

A small, but powerful tag-based template language for Ruby similar to
the ones used in MovableType and TextPattern. It has tags similar to
HTML or XML, but can be used to generate any form of plain text (not
just HTML).

Installation:
% gem install radius

Download:
http://rubyforge.org/frs/?group_id=1262

Documentation:
http://radius.rubyforge.org

A small example of Radius in action:

   class ThreeStoogesContext < Radius::Context
     def initialize
       @prefix = 'ts'
     end
     def stooge(attr)
       content = ''
       ["Larry", "Moe", "Curly"].each do |name|
         @name = name
         content << yield
       end
       content
     end
     def name(attr)
       @name
     end
   end

   parser = Radius::Parser.new(ThreeStoogesContext.new)

   template = <<-TEMPLATE
   <ul>
   <ts:stooge>
   <li><ts:name /></li>
   </ts:stooge>
   </ul>
   TEMPLATE

   puts parser.parse(template)


This will output:

   <ul>

     <li>Larry</li>

     <li>Moe</li>

     <li>Curly</li>

   </ul>


Learn more by reading the Quick Start guide:
http://radius.rubyforge.org/files/QUICKSTART.html

Enjoy!
This topic is locked and can not be replied to.