public
Rubygem
Fork of bmizerany/sinatra
Description: Classy web-development dressed in a DSL
Homepage: http://sinatra.rubyforge.org
Clone URL: git://github.com/rtomayko/sinatra.git
fix in file templates w/ CR+LF line ends (#45)
Ryan Tomayko (author)
Fri Nov 07 04:27:09 -0800 2008
commit  b03d7171d9103974904d85424351883fb2357614
tree    69e089d360f4db572a563425ee2eec1ec06df3c6
parent  d389d27e1f5be58abfb4b0daa7c25920113e1b68
...
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
0
@@ -1,3 +1,7 @@
0
+= 0.3.3
0
+
0
+  * BUG: use_in_file_templates! failes with CR/LF (#45)
0
+
0
 = 0.3.2
0
 
0
   * BUG: Static and send_file read entire file into String before
...
1365
1366
1367
1368
1369
1370
 
 
1371
1372
 
1373
1374
1375
...
1365
1366
1367
 
 
 
1368
1369
1370
 
1371
1372
1373
1374
0
@@ -1365,11 +1365,10 @@ def helpers(&b)
0
 end
0
 
0
 def use_in_file_templates!
0
-  require 'stringio'
0
-  templates = IO.read(caller.first.split(':').first).split('__FILE__').last
0
-  data = StringIO.new(templates)
0
+  data = IO.read(caller.first.split(':').first).split('__FILE__').last
0
+  data.gsub! /\r\n/, "\n"
0
   current_template = nil
0
-  data.each do |line|
0
+  data.each_line do |line|
0
     if line =~ /^@@\s?(.*)/
0
       current_template = $1.to_sym
0
       Sinatra.application.templates[current_template] = ''

Comments