lib/ro/template.rb in ro-1.1.1 vs lib/ro/template.rb in ro-1.2.0

- old
+ new

@@ -12,15 +12,22 @@ ext = exts.shift case ext.to_s.downcase when 'erb', 'eruby' content = Ro.erb(content, node) + when 'yml' content = YAML.load(content) + else - tilt = Tilt[ext].new{ content } - content = tilt.render(node) + tilt = Tilt[ext] || Tilt['txt'] + + if tilt.nil? + content + else + content = tilt.new{ content }.render(node) + end end end content end @@ -37,10 +44,15 @@ ext = exts.shift if exts.empty? code = content language = ext - content = ::Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'}) + content = + begin + ::Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'}) + rescue + content + end else case ext.to_s.downcase when 'erb', 'eruby' content = Ro.erb(content, node) when 'yml'