I would have done like this:

mab = Markaby::Builder.new
mab.instance_eval template
mab.to_s


2006/7/19, Farrel Lifson <farrel.lifson / gmail.com>:
> Hi folks,
>
> I'm not sure if I'm grokking how to use Markaby correctly. I'm trying
> to render some external Markaby code as follows but get the
> ArgumentError at the end:
> >> require 'markaby'
> => true
> >> template =<<EOS
> html do
>   h1 "Header" do
>     p "Paragraph"
>   end
> end
> EOS
> => "html do\n  h1 \"Header\" do\n    p \"Paragraph\"\n  end\nend\n"
> >> Markaby::Template.new(template).render
> ArgumentError: /usr/lib/ruby/gems/1.8/gems/builder-2.0.0/lib/builder/xmlbase.rb:53:in
> `method_missing': XmlMarkup cannot mix a text argument with a block
>
> What would be the correct way to render the given Markaby code
> fragment? The error is bubbling up from XmlBuilder
>
> Farrel
>
>