-
Notifications
You must be signed in to change notification settings - Fork 640
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
Add striptags filter #589
Add striptags filter #589
Conversation
Looks like the build is failing. I'd be happy to merge this with a green build. |
The build is also failing on master (of this repo) with the same messages on my local machine with node 0.10 and 0.11. I don't think it comes from this PR |
There seems to be a problem with the last version of jshint. Using jshint 2.8.x fixes the problem on both versions. Should I make a second PR to fix this ? |
Just pushed a fix to master to pin jshint to 2.8.x. Rebase on that and see if we get a green build. |
Done. |
Not a very good implementation because it strips whitespace.
But .replace(/\s+/gi, ' ') It would be better to squash every group of multiple spaces to single space and every group of multiple caret feeds to single one separately. Something like: .replace(/ +/g, ' ').replace(/(\r\n?)+/g, '\n').replace(/\n+/g, '\n') |
Can you file a pull request? |
Yes, I'll give it a second look and make a PR. |
Thank you! |
Keep in mind that what you propose is different from jinja's implementation and won't pass the same test jinja has. |
Yes, I'll update tests accordingly. |
Hmmm. Thanks for pointing that out, @antogyn. I think I prefer to maintain Jinja2 compatibility here by default, but I'm not opposed to adding this as an optional behavior controlled by a flag, e.g. |
Yes, I was going to put it under non-default flag. Will try to send PR tomorrow. |
Sorry for delay. A tons of work activity. |
I migrated from swig to nunjucks and realized there was no striptags filter. There is already an opened issue : #359
One of the tests is very similar to this one (from jinja)