diff options
author | Leonard Richardson <leonardr@segfault.org> | 2019-07-21 14:58:16 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2019-07-21 14:58:16 -0400 |
commit | b2294f4f05d9e8583613560986f8aa64b18866b9 (patch) | |
tree | 5af13a59eca15ea082cb46ea286bc9c5b91996da /bs4/__init__.py | |
parent | 819fa4255063d6b8d16f62469afa6c6e504f284a (diff) |
Adapt Chris Mayo's code to track line number and position when using html.parser.
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r-- | bs4/__init__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bs4/__init__.py b/bs4/__init__.py index 9cd01c8..753aa73 100644 --- a/bs4/__init__.py +++ b/bs4/__init__.py @@ -531,7 +531,8 @@ class BeautifulSoup(Tag): return most_recently_popped - def handle_starttag(self, name, namespace, nsprefix, attrs): + def handle_starttag(self, name, namespace, nsprefix, attrs, lineno=None, + offset=None): """Push a start tag on to the stack. If this method returns None, the tag was rejected by the @@ -549,7 +550,8 @@ class BeautifulSoup(Tag): return None tag = Tag(self, self.builder, name, namespace, nsprefix, attrs, - self.currentTag, self._most_recent_element) + self.currentTag, self._most_recent_element, lineno=lineno, + offset=offset) if tag is None: return tag if self._most_recent_element is not None: |