How to escape pug's keyword, such as when #{when}

Viewed 134

we use pug to compile .pug file into .xml file.

one of xml file are using <when></when>

but when I try to add

p
   when #{when}

pug said when is keyword and syntax is error.

How could I escape keyword when in pug file as normal tag like h1 or p?

1 Answers

You can use interpolation, like this:

- let when = 'foo'
p
  #{'when'} #{when}

Which compiles to this:

<p>
  <when>foo</when>
</p>
Related