PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 9, 2022

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

 July 09, 2022     escaping, keyword, pug     No comments   

Issue

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?


Solution

You can use interpolation, like this:

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

Which compiles to this:

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


Answered By - Sean
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,214,254

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing