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

Placeholders inside hrefs are encoded #5

Open
pduersteler opened this issue May 10, 2013 · 2 comments
Open

Placeholders inside hrefs are encoded #5

pduersteler opened this issue May 10, 2013 · 2 comments

Comments

@pduersteler
Copy link

As many times references in alexdunae/premailer, I am also bringing this up here.

Having a link with special chars in it does convert/encode it to a html-safe one. However, this feature is a bit too eager because it e.g. also converts ampersands to its according html entity.

It also breaks templating functionality when e.g. using it with mustache. <a href="{{some_url}}"> gets converted to <a href="%7B%7Bsome_url%7B%7B">.

I'd suggest that this either becomes less paranoid, or can be turned off by supplying an option.

@akzhan
Copy link

akzhan commented May 11, 2013

Will be reviewed later (now I'm on leave). But pull requests very apprepriated.

@markedmondson
Copy link

We hit this too, currently we clean up the code through a regex on a Rails callback but a nicer solution would be preferred.

html = html.gsub(/(%7B%7B|{{)+(\s|%20)?/i, '{{ ')
html = html.gsub(/(\s|%20)?(%7D%7D|}})+/i, ' }}')

Seemingly URI.unescape works just as well!

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

3 participants