# Radius 0.5.1 -- Powerful Tag-Based Templates

**URL:** <https://www.ruby-forum.com/t/radius-0-5-1-powerful-tag-based-templates/95957>\
**Category:** Ruby\
**Created:** [June 20, 2006, 10:43pm UTC](https://www.ruby-forum.com/t/radius-0-5-1-powerful-tag-based-templates/95957 "2006-06-20T22:43:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_WSLong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@John\_WSLong](https://www.ruby-forum.com/u/John_WSLong)\
**Post date:** [June 20, 2006, 10:43pm UTC](https://www.ruby-forum.com/t/radius-0-5-1-powerful-tag-based-templates/95957/1 "2006-06-20T22:43:21Z")

</div>

I am pleased to announce the immediate release of Radius 0.5.1.

Radius is a small, but powerful tag-based template language for Ruby  
inspired by the template languages used in MovableType  
\<[www.movabletype.org](http://www.movabletype.org)\> and TextPattern \<[www.textpattern.com](http://www.textpattern.com)\>. It uses  
tags similar to XML, but can be used to generate any form of plain text  
(HTML, e-mail, etc…). Radiant CMS \<[www.radiantcms.org](http://www.radiantcms.org)\> currently uses  
Radius in its unique templating system.

This is a bug-fix release.

From the change log:

0.5.1

- Fixed a problem with parsing quotes where a single tag preceding a  
double tag would consume the start tag of the double tag if both  
contained attributes

Download:  
[http://rubyforge.org/frs/?group\_id=1262](http://rubyforge.org/frs/?group_id=1262)

Documentation:  
[http://radius.rubyforge.org](http://radius.rubyforge.org)

Instalation:  
% gem install --remote radius

A small example:

require ‘radius’

# Define tags on a context that will be available to a template:

context = Radius::Context.new do |c|  
c.define\_tag ‘hello’ do  
‘Hello world’  
end  
c.define\_tag ‘repeat’ do |tag|  
number = (tag.attr[‘times’] || ‘1’).to\_i  
result = ‘’  
number.times { result \<\< tag.expand }  
result  
end  
end

# Create a parser to parse tags that begin with ‘r:’

parser = Radius::Parser.new(context, :tag\_prefix =\> ‘r’)

# Parse tags and output the result

puts parser.parse(“A small example:\n” +  
‘\<r:repeat times=“3”\>\* \<r:hello /\>!\n\</r:repeat\>’)

Output:

A small example:

- Hello world!
- Hello world!
- Hello world!

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

Enjoy!
