翡翠:正确逃离前元素

时间:2013-07-20 20:59:09

标签: escaping pug pre

我希望在pre元素中包含注释块,但是我会收到以下错误:

Line 573: Unexpected token ===

我的玉pre块是:

pre(class = "brush:javascript")
            /*------------------------------------------------------------------------------------------------------------------------
            @Author: Author Name
            @www: www.author-site.ca
            @github: author-github-username

            @package: project-name
            =============================================================================
            Filename: filename.js
            =============================================================================
            This file is responsible for...
            --------------------------------------------------------------------------------------------------------------------- */

我在Jade Documentation上看到pre元素默认转义;但是,鉴于上述错误,情况似乎并非如此。

如何在不收到语法错误的情况下转义上述代码块?

2 个答案:

答案 0 :(得分:1)

只需在标记后添加一个点(在the Jade documentation as "Block in a Tag"中引用)。

pre.(class = "brush:javascript")
  /*------------------------------------------------------------------------------------------------------------------------
  @Author: Author Name
  @www: www.author-site.ca
  @github: author-github-username

答案 1 :(得分:0)

我发现了问题......

您必须将转义内容作为pre(duh?)的一部分包含在内,而不是将其嵌套在其下:

pre(class = "brush:javascript")
  | /*------------------------------------------------------------------------------------------------------------------------
  | @Author: Author Name
  | @www: www.author-site.ca
  | @github: author-github-username
  |
  | @package: project-name
  | =============================================================================
  | Filename: filename.js
  | =============================================================================
  | This file is responsible for...
  |
  | --------------------------------------------------------------------------------------------------------------------- */

所以在玉器中,|表示这个......