mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Allow spaces in inline template names (still ignoring trailing spaces).
This commit is contained in:
parent
f96c6ef7d8
commit
7f2b234ffe
2 changed files with 5 additions and 1 deletions
|
@ -824,7 +824,7 @@ module Sinatra
|
|||
template = nil
|
||||
data.each_line do |line|
|
||||
lines += 1
|
||||
if line =~ /^@@\s*(\S*)/
|
||||
if line =~ /^@@\s*(.*\S)\s*$/
|
||||
template = ''
|
||||
templates[$1.to_sym] = [template, file, lines]
|
||||
elsif template
|
||||
|
|
|
@ -87,6 +87,7 @@ class TemplatesTest < Test::Unit::TestCase
|
|||
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]
|
||||
assert_equal "this is not foo\n\n", @app.templates[:"foo bar"][0]
|
||||
end
|
||||
|
||||
it 'loads templates from given source file' do
|
||||
|
@ -162,6 +163,9 @@ this is foo
|
|||
@@ bar
|
||||
There's a space after 'bar'!
|
||||
|
||||
@@ foo bar
|
||||
this is not foo
|
||||
|
||||
@@ layout
|
||||
X
|
||||
= yield
|
||||
|
|
Loading…
Reference in a new issue