Project

weblet

0.0
Low commit activity in last 3 years
No release in over a year
Intended for retrieving HTML templates from a convenient to use Hash-like object.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.5, >= 1.5.14
~> 0.1, >= 0.1.2
 Project Readme

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