Html 为什么我的slim模板呈现错误?
我的layout.slim视图是:Html 为什么我的slim模板呈现错误?,html,ruby-on-rails,ruby,sinatra,slim-lang,Html,Ruby On Rails,Ruby,Sinatra,Slim Lang,我的layout.slim视图是: doctype html html head meta charset="utf-8" meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" title= "Title" meta name="description" content="" meta name="author" content="" meta na
doctype html
html
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
title= "Title"
meta name="description" content=""
meta name="author" content=""
meta name="keywords" content=""
meta name="viewport" content="width=device-width, initial-scale=1.0"
link href='/css/base.css' rel='stylesheet' type='text/css'
body
== yield
我的主要观点是
== slim :layout
h1 hello
h2 world
它渲染得很好,但是我渲染的html将头部属性也复制到body标记中!看起来是这样的:
html
head
meta..
meta..
title ...
...
body
meta..
meta..
title ...
...
<h1>Hello</h1>
...
html
头
元。。
元。。
标题
...
身体
元。。
元。。
标题
...
你好
...
为什么会这样
(顺便说一句,我之所以使用“==slim:layout”是为了启用模板的嵌套继承(即layout.slim->main.slim->form.slim)如果布局中的缩进错误,
body
应该在html
内,==yield
在body内,因此:
doctype html
html
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
title= "Title"
meta name="description" content=""
meta name="author" content=""
meta name="keywords" content=""
meta name="viewport" content="width=device-width, initial-scale=1.0"
link href='/css/base.css' rel='stylesheet' type='text/css'
body
== yield
使用以下命令:
doctype html
html
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
title= "Title"
meta name="description" content=""
meta name="author" content=""
meta name="keywords" content=""
meta name="viewport" content="width=device-width, initial-scale=1.0"
link href='/css/base.css' rel='stylesheet' type='text/css'
body
== yield