Weblet: Content is now enclosed within a CDATA element
require 'weblet'
s3 = %q(
#fun
<p>hut</p>
#good
<p>star #{s2}</p>
#saturday
It's sunny!
#svg
#reply
<svg>
i like that #{s2}
</svg>
#favorite
<p>231</p>
)
s2 = 'tree'
w = Weblet.new(s3, binding, debug: true)
puts w.render('svg/reply') #=> <svg>\n i like that tree ...
puts w.render(:saturday) #=> It's sunny!
puts w.render(:reply) #=> <svg>\n i like that tree ...
puts w.to_xml
Output:
<weblet> <node id='fun'><![CDATA[<p>hut</p>]]></node> <node id='good'><![CDATA[<p>star #{s2}</p>]]></node> <node id='saturday'><![CDATA[It's sunny!]]></node> <node id='svg'> <node id='reply'><![CDATA[<svg> i like that #{s2} </svg>]]></node> <node id='favorite'><![CDATA[<p>231</p>]]></node> </node> </weblet>
weblet
Introducing the Weblet gem
require 'weblet'
s3 = %q(
#fun
<p>hut</p>
#good
<p>star #{s2}</p>
#svg
#reply
<svg>
i like that #{s2}
</svg>
#favorite
<p>231</p>
)
s2 = 'tree'
w = Weblet.new(s3, binding)
puts w.render('svg/reply')
Output:
<svg> i like that tree </svg>
A slim-like template is used to store the HTML templates which are used by the Weblet gem to render the output.
Resources
weblet template html builder weblit weblets weblits