【发布时间】:2011-10-26 16:55:21
【问题描述】:
这是我的 sinatra 代码:
get '/' do
foo = 'not bar'
erb :index
end
我的布局.erb
<html>
<head></head>
<body>
<%= yield %>
</body>
</html>
我的 index.erb
<div class="container">
</div>
现在的问题是
多余的文字(用黄色突出显示)扰乱了我的设计 知道为什么会这样吗? 如果我不使用布局并且仅使用 index.erb 和所有 html 代码,则不会发生这种情况
[编辑:] 在 .... layout.rb 中使用 会引发错误(意外的 tUMINUS,期望 kEND ;@_out_buf.concat " "; - yield -; @_out_buf.concat "\n" )
【问题讨论】:
-
在....布局.rb
-
在 index.erb 中。 ..这是唯一的内容你得到一个输出
" "? (包含换行符的引号)?@zabba 是的,它是引号中的新行字符对于 sinatra add,set :erb, :trim => '-'使用 -%> rails 自动有这个。