Skip to content

Commit 293e81b

Browse files
authored
fix(html): access to variable not yet declared (#2171)
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
1 parent d68d8b6 commit 293e81b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docling/backend/html_backend.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,14 @@ def _extract_text_and_hyperlink_recursively(
467467

468468
@contextmanager
469469
def _use_hyperlink(self, tag: Tag):
470+
old_hyperlink: Union[AnyUrl, Path, None] = None
471+
new_hyperlink: Union[AnyUrl, Path, None] = None
470472
this_href = tag.get("href")
471473
if this_href is None:
472474
yield None
473475
else:
474476
if isinstance(this_href, str) and this_href:
475-
old_hyperlink: Union[AnyUrl, Path, None] = self.hyperlink
476-
new_hyperlink: Union[AnyUrl, Path, None] = None
477+
old_hyperlink = self.hyperlink
477478
if self.original_url is not None:
478479
this_href = urljoin(str(self.original_url), str(this_href))
479480
# ugly fix for relative links since pydantic does not support them.

0 commit comments

Comments
 (0)