mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Update html and its test from CPython 3.10.5
This commit is contained in:
1 parent
33db28d6cc
commit
dbb128e1de
3 files changed
+4
-18
No files matched your search
Vendored
+1
@@ -4,6 +4,7 @@ __all__ = ['html5', 'name2codepoint', 'codepoint2name', 'entitydefs']
|
||||
|
||||
|
||||
# maps the HTML entity name to the Unicode code point
|
||||
# from https://html.spec.whatwg.org/multipage/named-characters.html
|
||||
name2codepoint = {
|
||||
'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
|
||||
'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1
|
||||
|
||||
Vendored
+3
-11
@@ -9,7 +9,6 @@
|
||||
|
||||
|
||||
import re
|
||||
import warnings
|
||||
import _markupbase
|
||||
|
||||
from html import unescape
|
||||
@@ -47,7 +46,7 @@ locatestarttagend_tolerant = re.compile(r"""
|
||||
|"[^"]*" # LIT-enclosed value
|
||||
|(?!['"])[^>\s]* # bare value
|
||||
)
|
||||
(?:\s*,)* # possibly followed by a comma
|
||||
\s* # possibly followed by a space
|
||||
)?(?:\s|/(?!>))*
|
||||
)*
|
||||
)?
|
||||
@@ -406,7 +405,7 @@ class HTMLParser(_markupbase.ParserBase):
|
||||
tagname = namematch.group(1).lower()
|
||||
# consume and ignore other stuff between the name and the >
|
||||
# Note: this is not 100% correct, since we might have things like
|
||||
# </tag attr=">">, but looking for > after tha name should cover
|
||||
# </tag attr=">">, but looking for > after the name should cover
|
||||
# most of the cases and is much simpler
|
||||
gtpos = rawdata.find('>', namematch.end())
|
||||
self.handle_endtag(tagname)
|
||||
@@ -418,7 +417,7 @@ class HTMLParser(_markupbase.ParserBase):
|
||||
self.handle_data(rawdata[i:gtpos])
|
||||
return gtpos
|
||||
|
||||
self.handle_endtag(elem.lower())
|
||||
self.handle_endtag(elem)
|
||||
self.clear_cdata_mode()
|
||||
return gtpos
|
||||
|
||||
@@ -461,10 +460,3 @@ class HTMLParser(_markupbase.ParserBase):
|
||||
|
||||
def unknown_decl(self, data):
|
||||
pass
|
||||
|
||||
# Internal -- helper to remove special character quoting
|
||||
def unescape(self, s):
|
||||
warnings.warn('The unescape method is deprecated and will be removed '
|
||||
'in 3.5, use html.unescape() instead.',
|
||||
DeprecationWarning, stacklevel=2)
|
||||
return unescape(s)
|
||||
Vendored
-7
@@ -537,13 +537,6 @@ text
|
||||
for html, expected in data:
|
||||
self._run_check(html, expected)
|
||||
|
||||
def test_unescape_method(self):
|
||||
from html import unescape
|
||||
p = self.get_collector()
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
s = '""""""&#bad;'
|
||||
self.assertEqual(p.unescape(s), unescape(s))
|
||||
|
||||
def test_broken_comments(self):
|
||||
html = ('<! not really a comment >'
|
||||
'<! not a comment either -->'
|
||||
|
||||
Reference in new issue
Block a user