== Radius
Lets say we have a Radius document called 'test.radius' containing:
Example
This is an example of a Radius template.
We can render Radius documents via the +render+ method, as we can any format.
data = {:title=>"Document"}
html = Malt.render(:file=>'tmp/test.radius', :data=>data, :tag_prefix=>'r')
html.assert.include?('Example Document
')
We can get a hold of the Radius document via the Malt.file function.
radi = Malt.file('tmp/test.radius', :tag_prefix=>'r')
radi.class.assert == Malt::Format::Radius
Notice here we have passed an option to the file constructor. This option
is passed on the underlying Radius.new method. Now we can convert Radius
documents to HTML documents via #to_html.
data = {:title => "Document"}
html = radi.to_html(data)
First we will notice that the output is an instance of Malt::Format::HTML.
html.class.assert == Malt::Format::HTML
And that by calling #to_s we can get the rendered HTML document.
html.to_s.assert.include?('Example Document
')
Or we can convert the Radius document directly to HTML via the #html method.
out = radi.html(data)
out.assert.include?('Example Document
')