Skip to content

bug(html): source-formatting whitespace appears in link_texts metadata and Element text #3230

Closed

Description

@scanny

Summary

  • Whitespace used for indent and otherwise format the HTML source appears in link_texts metadata.
  • Whitespace also appears in the text of the element that contains the link.

To Reproduce

html_text = """
<p>
  foo
  <a href="http://eie.io">
    bar
  </a>
</p>
"""

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

Expected:

[
  {
    "element_id": "13576562f85267c48e44286353dbc991",
    "metadata": {
      "filetype": "text/html",
      "languages": ["eng"],
      "link_texts": ["bar"],
      "link_urls": ["http://eie.io"]
    },
    "text": "foo bar",
    "type": "UncategorizedText"
  }
]

Actual:

[
  {
    "element_id": "cfa1474ad714b51d88959042ecce79dd",
    "metadata": {
      "category_depth": 0,
      "filetype": "text/html",
      "languages": ["eng"],
      "link_texts": ["\n    bar\n  "],
      "link_urls": ["http://eie.io"]
    },
    "text": "foo\n  \n    bar",
    "type": "Title"
  }
]

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

Activity

  1. added
    bug
    on Jun 18, 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