1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #29038 -- Removed closing slash from HTML void tags.

This commit is contained in:
Jon Dufresne
2018-01-20 23:09:10 -08:00
committed by Tim Graham
parent 4b0f39d9fb
commit ff05de760c
112 changed files with 1487 additions and 1483 deletions

View File

@@ -6,7 +6,7 @@ from django.utils.safestring import SafeText
def csrf_input(request):
return format_html(
'<input type="hidden" name="csrfmiddlewaretoken" value="{}" />',
'<input type="hidden" name="csrfmiddlewaretoken" value="{}">',
get_token(request))

View File

@@ -404,7 +404,7 @@ def force_escape(value):
def linebreaks_filter(value, autoescape=True):
"""
Replace line breaks in plain text with appropriate HTML; a single
newline becomes an HTML line break (``<br />``) and a new line
newline becomes an HTML line break (``<br>``) and a new line
followed by a blank line becomes a paragraph break (``</p>``).
"""
autoescape = autoescape and not isinstance(value, SafeData)
@@ -416,13 +416,13 @@ def linebreaks_filter(value, autoescape=True):
def linebreaksbr(value, autoescape=True):
"""
Convert all newlines in a piece of plain text to HTML line breaks
(``<br />``).
(``<br>``).
"""
autoescape = autoescape and not isinstance(value, SafeData)
value = normalize_newlines(value)
if autoescape:
value = escape(value)
return mark_safe(value.replace('\n', '<br />'))
return mark_safe(value.replace('\n', '<br>'))
@register.filter(is_safe=True)

View File

@@ -54,7 +54,7 @@ class CsrfTokenNode(Node):
if csrf_token == 'NOTPROVIDED':
return format_html("")
else:
return format_html("<input type='hidden' name='csrfmiddlewaretoken' value='{}' />", csrf_token)
return format_html("<input type='hidden' name='csrfmiddlewaretoken' value='{}'>", csrf_token)
else:
# It's very probable that the token is missing because of
# misconfiguration, so we raise a warning
@@ -1408,7 +1408,7 @@ def widthratio(parser, token):
For example::
<img src="bar.png" alt="Bar"
height="10" width="{% widthratio this_value max_value max_width %}" />
height="10" width="{% widthratio this_value max_value max_width %}">
If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100,
the image in the above example will be 88 pixels wide