mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Allow spaces after inline template names. Fixes GH #61.
This commit is contained in:
parent
68d2d7b7e1
commit
3475f505ca
2 changed files with 9 additions and 1 deletions
|
@ -824,7 +824,7 @@ module Sinatra
|
|||
template = nil
|
||||
data.each_line do |line|
|
||||
lines += 1
|
||||
if line =~ /^@@\s*(.*)/
|
||||
if line =~ /^@@\s*(\S*)/
|
||||
template = ''
|
||||
templates[$1.to_sym] = [template, file, lines]
|
||||
elsif template
|
||||
|
|
|
@ -84,6 +84,11 @@ class TemplatesTest < Test::Unit::TestCase
|
|||
assert_equal "X\n= yield\nX\n", @app.templates[:layout][0]
|
||||
end
|
||||
|
||||
it 'ignores spaces after names of inline templates' do
|
||||
mock_app { enable :inline_templates }
|
||||
assert_equal "There's a space after 'bar'!\n\n", @app.templates[:bar][0]
|
||||
end
|
||||
|
||||
it 'loads templates from given source file' do
|
||||
mock_app { set :inline_templates, __FILE__ }
|
||||
assert_equal "this is foo\n\n", @app.templates[:foo][0]
|
||||
|
@ -154,6 +159,9 @@ __END__
|
|||
@@ foo
|
||||
this is foo
|
||||
|
||||
@@ bar
|
||||
There's a space after 'bar'!
|
||||
|
||||
@@ layout
|
||||
X
|
||||
= yield
|
||||
|
|
Loading…
Reference in a new issue