Skip to content

Commit

Permalink
fix in file templates w/ CR+LF line ends (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Nov 7, 2008
1 parent d389d27 commit b03d717
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions 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
Expand Down
7 changes: 3 additions & 4 deletions lib/sinatra.rb
Expand Up @@ -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] = ''
Expand Down

0 comments on commit b03d717

Please sign in to comment.