Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A small, but powerful tag-based template language for Ruby modeled after the ones used in MovableType and TextPattern. It has tags similar to XML, but can be used to generate any form of plain text (HTML, e-mail, etc...).
Failed to load latest commit information.
lib bump version to 0.7.4
test add simplecov/coveralls to test run
.gitignore ignore coverage directory
.travis.yml add env var for sending coverage report to coveralls
CHANGELOG mark support for ruby 2 in changelog
CONTRIBUTORS update version and contributors list
Gemfile add rdoc gem
LICENSE switch to jeweler, remove dependancies on newgem and hoe
QUICKSTART.rdoc work on Quick start: fixed typo, updated last paragraph
README.rdoc remove duplicate badge for travis
Rakefile Merge commit 'jlong/master'
radius.gemspec update version of rake and move test dependencies into Gemfile


Radius – Powerful Tag-Based Templates

Status Coverage

Radius is a powerful tag-based template language for Ruby inspired by the template languages used in MovableType and TextPattern. It uses tags similar to XML, but can be used to generate any form of plain text (HTML, e-mail, etc…).


With Radius, it is extremely easy to create custom tags and parse them. Here's a small example:

require 'radius'

# Define tags on a context that will be available to a template:
context = do |c|
  c.define_tag 'hello' do
    'Hello world'
  c.define_tag 'repeat' do |tag|
    number = (tag.attr['times'] || '1').to_i
    result = ''
    number.times { result << tag.expand }

# Create a parser to parse tags that begin with 'r:'
parser =, :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>})


A small example:
* Hello world!
* Hello world!
* Hello world!

Quick Start

Read the QUICKSTART file to get up and running with Radius.


Radius does not have any external requirements for using the library in your own programs.

Ragel is required to create the ruby parser from the Ragel specification, and both Ragel and Graphviz are required to draw the state graph for the parser.


It is recommended that you install Radius using the RubyGems packaging system:

% gem install --remote radius


Radius is released under the MIT license and is copyright © 2006-2010 John W. Long. A copy of the MIT license can be found in the LICENSE file.


This is a prioritized roadmap for future releases:

  1. Clean up the current code base. [Done]

  2. Add support for multi-level contexts: tags should be able to be defined to only be valid within other sets of tags. [Done]

  3. Create a simple DSL for defining contexts. [Done]

  4. Optimize for speed, modify scan.rl to emit C.


The latest version of Radius can be found on RubyForge:

Experimental and development versions of Radius can be found on Github:

If you are interested in helping with the development of Radius, feel free to fork the project on GitHub and send me a pull request.

John Long

Something went wrong with that request. Please try again.