mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 20:58:11 +00:00
fix(html): access to variable not yet declared (#2171)
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
This commit is contained in:
committed by
GitHub
parent
d68d8b678e
commit
293e81bf9d
@@ -467,13 +467,14 @@ class HTMLDocumentBackend(DeclarativeDocumentBackend):
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def _use_hyperlink(self, tag: Tag):
|
def _use_hyperlink(self, tag: Tag):
|
||||||
|
old_hyperlink: Union[AnyUrl, Path, None] = None
|
||||||
|
new_hyperlink: Union[AnyUrl, Path, None] = None
|
||||||
this_href = tag.get("href")
|
this_href = tag.get("href")
|
||||||
if this_href is None:
|
if this_href is None:
|
||||||
yield None
|
yield None
|
||||||
else:
|
else:
|
||||||
if isinstance(this_href, str) and this_href:
|
if isinstance(this_href, str) and this_href:
|
||||||
old_hyperlink: Union[AnyUrl, Path, None] = self.hyperlink
|
old_hyperlink = self.hyperlink
|
||||||
new_hyperlink: Union[AnyUrl, Path, None] = None
|
|
||||||
if self.original_url is not None:
|
if self.original_url is not None:
|
||||||
this_href = urljoin(str(self.original_url), str(this_href))
|
this_href = urljoin(str(self.original_url), str(this_href))
|
||||||
# ugly fix for relative links since pydantic does not support them.
|
# ugly fix for relative links since pydantic does not support them.
|
||||||
|
|||||||
Reference in New Issue
Block a user