node.js + jade - link是自闭的,不应该有内容

use*_*r19 3 javascript node.js pug

我在MEAN堆栈上引用了以下很棒的教程.

现在我面临一个模板(JADE)相关的问题,我无法解决:(如果可能的话,你能看看并帮助我.

http://www.ibm.com/developerworks/library/wa-nodejs-polling-app/

    doctype 5
    html(lang='en')
      head
        meta(charset='utf-8')
        meta(name='viewport', content='width=device-width, 
initial-scale=1, user-scalable=no')
        title= title
        link(rel='stylesheet', href='//netdna.bootstrapcdn.com/bootstrap/3.0.1/
css/bootstrap.min.css')
        link(rel='stylesheet', href='/stylesheets/style.css')                
      body
        nav.navbar.navbar-inverse.navbar-fixed-top(role='navigation')
          div.navbar-header
            a.navbar-brand(href='#/polls')= title
        div.container
          div
Run Code Online (Sandbox Code Playgroud)

我得到了这个例外.尝试了几个变种,但还没有解决它.

Error: C:\DevEnv\UT3_Node\HelloWorldNodeProject\views\index.jade:14
    12|         a.navbar-brand(href='#/polls')= title
    13|     div.container
  > 14|       div

**link is self closing and should not have content.**
Run Code Online (Sandbox Code Playgroud)

谢谢你.

log*_*yth 8

你的问题是这一行:

link(rel='stylesheet', href='/stylesheets/style.css')                
Run Code Online (Sandbox Code Playgroud)

你在StackOverflow上看不到它,但是在标签之后你有一堆空格.

此处显示的空格替换为_:

link(rel='stylesheet', href='/stylesheets/style.css')________________
Run Code Online (Sandbox Code Playgroud)

所以你的玉会产生类似的东西:

<link rel="stylesheet" href="/stylesheets/style.css">________________</link>
Run Code Online (Sandbox Code Playgroud)

这是不允许的,因为不允许<link>元素具有子节点.