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

inline quoted functions needs to not escape quote #89

Closed
mkcode opened this issue Jul 24, 2012 · 3 comments
Closed

inline quoted functions needs to not escape quote #89

mkcode opened this issue Jul 24, 2012 · 3 comments

Comments

@mkcode
Copy link

mkcode commented Jul 24, 2012

I have a function like this where I need to use inline quoting because it's an attribute:

%meta{"name": "description", "content": "{% block description %}{{ _("Some text to translate") }}{% endblock %}"}

This outputs:

<meta content='{% block description %}{{ _(\'Learning for everyone, by everyone, about almost anything.\') }}{% endblock %}' name='description' />

The _() function is our translation function. It's argument needs to not be quoted! Is it possible to turn this off in some option.

@bcoughlan
Copy link
Collaborator

Edit: More confused now than I was :) Can you double check the HamlPy and HTML to make sure they're exactly as you posted?

I see the problem, but I'm confused as to why your HamlPy compiles at all (it doesn't for me using the current development version). Are there backslashes around the quotes of your HamlPy "Some text to translate" that are not in your post?

Note that a workaround would be to use single quotes on the attribute value, i.e. "content": '...._("....")...'

I would suggest as a solution that escaped apostrophes in Django variables tags should have their backslashes removed after parsing. Does anybody foresee any negative side effects to this?

@bcoughlan
Copy link
Collaborator

I'm going to close this as it's the same issue as #86, so we can keep discussion on the #86 thread just to make it visible to all interested.

@mkcode
Copy link
Author

mkcode commented Jul 25, 2012

Yes, no problem. The work around worked for us. Thanks for the quick response.

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