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

Lone % signs are removed from the template. #2

Open
stephband opened this issue Apr 5, 2010 · 1 comment
Open

Lone % signs are removed from the template. #2

stephband opened this issue Apr 5, 2010 · 1 comment

Comments

@stephband
Copy link

Hi. I've been playing around with Djangode and ran into a problem. The template system is removing lone % characters. After a bit of searching I found that on line 38 of template.js the regexp:

/(?:{{|}}|{%|%})|[{}|]|[^{}%|]+/g

is removing, or ignoring, them. Now, I'm not sure if it's deliberately like that or not (although I don't remember % characters being an issue when working with Django templates). I think the fix is:

/(?:{{|}}|{%|%})|[{}%|]|[^{}%|]+/g

...but I'm not sure what I might be breaking by doing this, because I'll admit I don't fully understand all that is happening in the tokenizer/parser. I've run a few rudimentary tests and this change hasn't caused any problems.

Cheers!
Stephen.

@ahem
Copy link
Contributor

ahem commented Apr 5, 2010

All the tests still parse with the changed regex, so it looks like it works. I added the change to in change in my branch together with a test against the '%' bug.

Thanks for noticing this!

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