将容器div添加到Jade mixin

时间:2014-06-25 06:07:14

标签: javascript node.js pug keystonejs

我正试图在h2& p标签在keystonejs的后混合中称为.desc。但每次我添加这个,我得到以下错误:

Sorry, an error occurred loading the page (500)
blog.jade:5
3| mixin post(post)
4| .post(data-ks-editable=editable(user, { list: 'Post', id: post.id }))
>5| .desc
6| h2.entry-title=post.title
7| p.lead.text-muted.entry-utility Posted
8| if post.publishedDate

Invalid indentation, you can use tabs or spaces but not both

我正在尝试将.desc包装器添加到内容中:

mixin post(post)
.post(data-ks-editable=editable(user, { list: 'Post', id: post.id }))
    .desc
        h2.entry-title=post.title
        p.lead.text-muted.entry-utility Posted
            if post.publishedDate
                | #{post._.publishedDate.format('MMMM Do, YYYY')}
            if post.categories && post.categories.length
                | in
                each cat, i in post.categories
                    a(href='/category/' + cat.key)= cat.name
        if post.image.exists
            img(src=post._.image.fit(160,160)).img.pull-right
        p!= post.content.brief

这就是mixin通常的样子:

mixin post(post)
.post(data-ks-editable=editable(user, { list: 'Post', id: post.id }))
    h2.entry-title=post.title
    p.lead.text-muted.entry-utility Posted
        if post.publishedDate
            | #{post._.publishedDate.format('MMMM Do, YYYY')}
        if post.categories && post.categories.length
            | in
            each cat, i in post.categories
                a(href='/category/' + cat.key)= cat.name
    if post.image.exists
        img(src=post._.image.fit(160,160)).img.pull-right
    p!= post.content.brief

我使用的是phpstorm,并且只将间距设置为制表符。

0 个答案:

没有答案