注释(Comments)
¥Comments
缓冲注释看起来与单行 JavaScript 注释相同。它们的作用有点像标记标签,在渲染的页面中生成 HTML 注释。
¥Buffered comments look the same as single-line JavaScript comments. They act sort of like markup tags, producing HTML comments in the rendered page.
与标签一样,缓冲注释必须出现在自己的行上。
¥Like tags, buffered comments must appear on their own line.
Pug 还支持无缓冲注释。只需在注释的开头添加一个连字符 (-
) 即可。
¥Pug also supports unbuffered comments. Simply add a hyphen (-
) to the start of the comment.
这些仅用于对 Pug 代码本身进行注释,不会出现在渲染的 HTML 中。
¥These are only for commenting on the Pug code itself, and do not appear in the rendered HTML.
块注释(Block Comments)
¥Block Comments
块注释也有效:
¥Block comments work, too:
条件注释(Conditional Comments)
¥Conditional Comments
Pug 没有任何特殊的条件注释语法。(条件注释是为旧版本的 Internet Explorer 添加后备标记的一种特殊方法。)
¥Pug does not have any special syntax for conditional comments. (Conditional comments are a peculiar method of adding fallback markup for old versions of Internet Explorer.)
但是,由于所有以 <
开头的行都被视为 纯文本,因此正常的 HTML 样式条件注释可以正常工作。
¥However, since all lines beginning with <
are treated as plain text, normal HTML-style conditional comments work just fine.