Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

escapse sharp in multi-line mode #769

Closed
supersheep opened this issue Sep 17, 2012 · 3 comments
Closed

escapse sharp in multi-line mode #769

supersheep opened this issue Sep 17, 2012 · 3 comments

Comments

@supersheep
Copy link

I want to write client-side jade template within script tag, and try to perform like this:

script(type="tpl/jade")
    |ul
    |    each item in items
    |        li #{item.key}

but because "#{item.key}" is recognized as a varible, while "each imte in items" as pure text, this will cause a parsing error.

so I add a backslash before to make it like "li #{item.key}" , but the back slash just output together.

I want to know is this a bug , ok how can I achieve my require?

@tj
Copy link
Contributor

tj commented Sep 17, 2012

that's just text interpolation. You have to escape it with \#{}

@tj tj closed this as completed Sep 17, 2012
@supersheep
Copy link
Author

Yes, that's what I've done. The github editor eat the backslash.
I do escape it with \#{}, but what I get is not #{}, but \#{}.
And I found that this is not caused by multi line mode. It's just a common bug.
for example, I write code like this.

app.js

var jade = require("jade");
var fs = require("fs");

var fn = jade.compile(fs.readFileSync("./a.jade"));
console.log(fn());

a.jade

p \#{something}

except to get

<p>#{something}</p>

but get below actually

<p>\#{something}</p>

jade 0.27.2 from npm

tj added a commit that referenced this issue Sep 18, 2012
dont include the slash...
@tj
Copy link
Contributor

tj commented Sep 18, 2012

thanks, missed that, I thought we had that working properly but we didn't have test cov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants