mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 06:10:12 +01:00
[parsing] unify tag nesting
This commit is contained in:
parent
65f91148fc
commit
8d87bb4d91
|
@ -325,9 +325,9 @@ def test_tag_return_order(self):
|
|||
str(tags), str([
|
||||
[Tag('t0'),
|
||||
[Tag('t1'),
|
||||
[Tag('t2'), Tag('t3'), Tag('t4')]],
|
||||
[Tag('t5'), Tag('t6')]],
|
||||
[Tag('t7'), Tag('t8')]]))
|
||||
[Tag('t2'), [Tag('t3')], [Tag('t4')]]],
|
||||
[Tag('t5'), [Tag('t6')]]],
|
||||
[Tag('t7'), [Tag('t8')]]]))
|
||||
|
||||
def test_html_ignored_ranges(self):
|
||||
def mark_comments(_string, char='^', nochar='-'):
|
||||
|
|
|
@ -174,12 +174,11 @@ def handle_starttag(self, tag, attrs):
|
|||
if self.predicate(tag, attrs):
|
||||
tag_obj = self.Tag(tag, string=self.rawdata, attrs=attrs)
|
||||
tag_obj.openrange(self._offset, len(tag_text))
|
||||
nesting = [tag_obj]
|
||||
self._nestedtags[-1].append(nesting)
|
||||
if tag_is_open:
|
||||
nesting = [tag_obj]
|
||||
self._nestedtags[-1].append(nesting)
|
||||
self._nestedtags.append(nesting)
|
||||
else:
|
||||
self._nestedtags[-1].append(tag_obj)
|
||||
self.callback(tag_obj)
|
||||
if tag_is_open:
|
||||
self.tagstack.appendleft(tag_obj)
|
||||
|
|
Loading…
Reference in New Issue
Block a user