-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added escaping tip #6633
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
Added escaping tip #6633
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1550,6 +1550,18 @@ a template helper function: | |
Read this blog post. | ||
</a> | ||
|
||
.. tip:: | ||
|
||
If you are generating the route inside a script tag, you might need to properly escape it for Javascript | ||
|
||
.. code-block:: javascript | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's use |
||
|
||
<script> | ||
var route = "{{ path('blog_show', {'slug': 'my-blog-post'})|escape('js') }}"; | ||
</script> | ||
|
||
For more information, see the Twig documentation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should link to the documentation of the For more information, see the `Twig documentation`_. You then need to add the following to the bottom of the document too: .. _`Twig documentation`: http://twig.sensiolabs.org/doc/filters/escape.html |
||
|
||
.. index:: | ||
single: Routing; Absolute URLs | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should end the sentence with a colon. And can you please also wrap this paragraph after the first word that crosses the 72nd character?