How to disable '&' in Jade

Finding some difficulties rendering '&' using the Jade engine. I need to call Google Maps using the following line: script(type='text/javascript', src='http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE')

But this will be done in Jade as: src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE

+7
source share
3 answers

According to https://github.com/visionmedia/jade/issues/198 you can now write:

 script(type='text/javascript', src!='http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE') 

Note != For the src argument; therefore its contents do not slip away.

+10
source

If someone still needs a workaround; they can read here .

So my workaround is to simply use script tags. Here is the content for the jade file.

 !!! html head link(rel='stylesheet', href='/stylesheets/test.css') <script src="http://maps.googleapis.com/maps/api/js?key=API_KEY&sensor=false"></script> script(src='/javascripts/test.js') body button(onclick='initialize()') Click Me! div#map_canvas 
0
source

&amp; is how you represent Ampersand in HTML. & means "start character reference".

Your current result is correct and will work (unless something is wrong with it). You are trying to create the wrong code that depends on the browsers in order to perform error recovery.

-3
source

All Articles