pug:link是一个自闭元素:<link />但包含嵌套内容

时间:2018-10-14 17:36:17

标签: pug

该错误显示在以下行:

    link(rel='stylesheet',href='https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css')

下面是标记:

html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css',type='text/css')
    link(rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css",type='text/css')
  body
    .add-entry
      h3#title Add an entry
        form(id='add', method='post', action='/entry/add')
            .form-group
                label(for='comment') 
                h6  Description:
                input#comment.form-control(rows='5' type='text' size='30' name='description')
            .form-group
                label(for='sev') 
                h6 Severity
                select#sev.form-control(name='severity')
                    option Low
                    option Average
                    option Critical
                br
                br    
                button.btn.btn-primary(type='submit') Submit

有人可以帮忙吗?更新了标记。错误显示在第4行

1 个答案:

答案 0 :(得分:2)

当您缩进link元素下方的行时,会发生此错误,如下所示:

head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css',type='text/css')
      link(rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css",type='text/css')

这试图在另一个链接元素(如错误所述)无效的内部创建一个链接元素。

以后,请确保所有链接元素在同一级别对齐:

head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css',type='text/css')
    link(rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css",type='text/css')