# File lib/ezamar/morpher.rb, line 113 def self.transform(template) template = template.to_s hp = Hpricot(template) MORPHS.each do |morph, replacement| hp.search("[@#{morph}]") do |elem| expr = elem[morph] elem.remove_attribute(morph) repl = replacement. sub('%morph', morph). sub('%expression', expr). sub('%content', elem.to_html) elem.swap(repl) end end hp.to_html end