Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix in file templates w/ CR+LF line ends (#45)

  • Loading branch information...
commit b03d7171d9103974904d85424351883fb2357614 1 parent d389d27
@rtomayko rtomayko authored
Showing with 7 additions and 4 deletions.
  1. +4 −0 ChangeLog
  2. +3 −4 lib/sinatra.rb
View
4 ChangeLog
@@ -1,3 +1,7 @@
+= 0.3.3
+
+ * BUG: use_in_file_templates! failes with CR/LF (#45)
+
= 0.3.2
* BUG: Static and send_file read entire file into String before
View
7 lib/sinatra.rb
@@ -1365,11 +1365,10 @@ def helpers(&b)
end
def use_in_file_templates!
- require 'stringio'
- templates = IO.read(caller.first.split(':').first).split('__FILE__').last
- data = StringIO.new(templates)
+ data = IO.read(caller.first.split(':').first).split('__FILE__').last
+ data.gsub! /\r\n/, "\n"
current_template = nil
- data.each do |line|
+ data.each_line do |line|
if line =~ /^@@\s?(.*)/
current_template = $1.to_sym
Sinatra.application.templates[current_template] = ''
Please sign in to comment.
Something went wrong with that request. Please try again.