lib/musterb/musterbifier.rb in musterb-0.0.1 vs lib/musterb/musterbifier.rb in musterb-0.0.2
- old
+ new
@@ -6,18 +6,22 @@
def to_erb
@template.gsub(/\{\{(\{?[^\}]*\}?)\}\}/) do |match|
match = $1
case match[0]
when '#'
- "<% musterb.block '#{match[1..-1]}' do %>"
+ "<% musterb.block '#{match[1..-1].strip}' do %>"
when '^'
- "<% musterb.block_unless '#{match[1..-1]}' do %>"
+ "<% musterb.block_unless '#{match[1..-1].strip}' do %>"
when "/"
"<% end %>"
when '{'
- "<%= musterb['#{match[1..-2]}'] %>"
+ "<%= musterb['#{match[1..-2].strip}'] %>"
+ when '&'
+ "<%= musterb['#{match[1..-1].strip}'] %>"
+ when '!'
+ ""
else
- "<%== musterb['#{match}'] %>"
+ "<%== musterb['#{match.strip}'] %>"
end
end
end
end
\ No newline at end of file