Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: The <div> text element with one <br> will not be regarded as a text element by _is_text_tag #3209

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion unstructured/documents/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,9 @@ def _is_text_tag(
# NOTE(robinson) - This indicates that a div tag has no children. If that's the
# case and the tag has text, its potential a text tag
children = list(tag_elem)
if tag_elem.tag in SECTION_TAGS + ["body"] and len(children) == 0:
# Exclude <br> tags when counting children
children_count = len([ child for child in children if child.tag not in TEXTBREAK_TAGS])
if tag_elem.tag in SECTION_TAGS + ["body"] and children_count == 0:
return True

if _has_adjacent_bulleted_spans(tag_elem, children):
Expand Down