I create something like this
Which produces a partial - creates the code elements and renders the code partial I would like to wrap this all into one tidy element - ie calling the code partial will automatically render the partials inside the code block... so avoiding the replication
-# Text
= partial "./forms/input",
:locals => { :name => "text",
:label => [ "Text Input" ],
:placeholder => "Enter Text",
:required => true }
-# Code
:ruby
code = %Q{
partial "./forms/input",
:locals => { :name => "text",
:label => [ "Text Input" ],
:placeholder => "Enter Text",
:required => true }}
= partial "./scaffolding/code", :locals => { :code => code }
I thought it may be something like:
- haml_engine = Haml::Engine.new( code )
- output = haml_engine.render
- puts output
But I get undefined method `partial'
Any help appreciated
Thanks
Ian
Basically the following is what I wanted.
-# Code
:ruby
code = %{partial "./forms/input",
:locals => { :name => "text",
:label => [ "Text Input" ],
:placeholder => "Enter Text",
:required => true }}
= eval( code )
-# Code
:code
#lang: #{ lang }
= code