我做了以下事情:
mixin article(newTitle)
#title
if (newTitle)
newTitle
else
block article-block-title
#content
if block
block
else
block article-block-content
block article-block-title
Default title text
block article-block-content
Default content text
所以我可以在我的主页上使用它,如
+article //Will render the Default article
+article // Should render default title and new content
p Some more content
+article("New Title") // Should render the new title and the default content
+article("New Title and Content") // Should render a new article
p Some more content
但它不起作用。永远不会渲染默认值,只有块是。传入的新标题都没有起作用。有线索吗?
答案 0 :(得分:0)
据我所知,您只能通过扩展模板来覆盖块。您应该直接声明默认值:
mixin article(newTitle)
#title
if (newTitle)
newTitle
else
Default title text
#content
if block
block
else
p Default content text