Skip to content

bug(html): invisible links are reported in metadata #3255

Closed

Description

@scanny

Summary
partition_html() adds an empty link_texts entry for an <a> element that has no text or whitespace-only text (and therefore is not displayed or clickable in a browser).

To Reproduce

html_text = "<p>Time is an illusion. <a href="http://seo.com"></a>Lunchtime doubly so.</p>"

elements = partition_html(text=html_text)
print(f"{elements_to_json(elements, indent=2)}")

Expected:

[
  {
    "element_id": "5fe7349cfd2346fed5d638c216d7506e",
    "metadata": {
      "filetype": "text/html",
      "languages": ["eng"]
    },
    "text": "Time is an illusion. Lunchtime doubly so.",
    "type": "NarrativeText"
  }
]

Actual:

[
  {
    "element_id": "5fe7349cfd2346fed5d638c216d7506e",
    "metadata": {
      "filetype": "text/html",
      "languages": ["eng"]
      "link_texts": [""],
      "link_urls": ["http://seo.com"]
    },
    "text": "Time is an illusion. Lunchtime doubly so.",
    "type": "NarrativeText"
  }
]

Additional context
Fixed by #3218. Recorded here to explain ingest test output changes and to inform CHANGELOG.

Activity

  1. added
    bug
    on Jun 19, 2024
  2. self-assigned this
    on Jun 19, 2024
  3. added a commit that references this issue on Jul 11, 2024
    c27e0d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughtml

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions