用例是我有一个非常简单的哈巴狗文档。我需要创建两个文档...一个是原始文档,另一个是使“私有”标签模糊不清的文档。为了以编程方式执行此操作,我需要能够遍历所有标签。 pug API是否提供该功能?
h1
private Foobar
p
Lorem ipsum
在tags.pug
中
-
let tags = [
{
tag: "h1",
private: true,
content: "private Foobar"
},
{
tag: "p",
content: "Lorem ipsum"
}
]
在public.pug
中
include tags.pug
each tag in tags
if !tag.private
...etc
在private.pug
中
include tags.pug
each tag in tags
...etc