jhtong
jhtong

Reputation: 1589

Create nested <p> tag in Jade JS without trailing newline

How does one do the following in Jade JS?

<div id="container">
    Temperature<p id = "temp">00.00</p>
</div>

i.e., create a nested tag without a newline.

I have tried:

// outputs newline
#container
    p#temp 00.00

and

// outputs literal p#temp text
#container p#temp 00.00

But it does not seem to work. Indentation gives a parse error as well. I have looked at the documentation but it does not seem to yield anything.

Upvotes: 1

Views: 1025

Answers (4)

Plato
Plato

Reputation: 11052

You can always just type the html inline:

//thermometer.jade
#container Temperature<p id="temp">#{locals.tempValue}</p>

Upvotes: 1

user568109
user568109

Reputation: 48003

You can use:

#container
  |Temperature
  p#temp 00.00

Upvotes: 2

malix
malix

Reputation: 3572

If you must, you could use:

#container Temperature<p id='temp>00.00</p>

How and why is your whitespace significant?

Upvotes: 0

Noah
Noah

Reputation: 34313

A span is the way to go instead of a p tag

#container
    span#temp 00.00

Upvotes: 0

Related Questions