Commit 238657f
authored
fix: chunking dropping table content (#4352)
## Preserve mixed-content tail text in table HTML
### Summary
`HtmlTable.from_html_text` compactification cleared every element's
`.tail`, silently dropping any text between inline children of a `<td>`.
In practice this deleted real content like `": do not..."` after
`<b>NOTICE</b>`, bullet lines following each `<br/>`, and any inter-tag
prose in rich table cells — visible whenever a table was chunked (any
strategy: `basic`, `by_title`, `by_page`).
Pure-whitespace tails are still stripped (those are just pretty-print
indent). Tails carrying content are now kept, with internal whitespace
runs collapsed and a single leading/trailing space preserved so adjacent
text doesn't run together.
### Changes
- `unstructured/common/html_table.py`: replace the blanket `e.tail =
None` with whitespace-aware normalization.
- `test_unstructured/common/test_html_table.py`: two regression tests
covering mixed inline markup, `<br/>`-separated lines, and whitespace
collapsing.
- Bump to `0.22.28` + changelog entry.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: localized change to table HTML minification that preserves
previously-dropped text; main risk is minor whitespace/serialization
differences in downstream table chunking output.
>
> **Overview**
> Fixes `HtmlTable.from_html_text()` compactification to **stop deleting
meaningful mixed-content tail text** (text between inline children like
`<b>foo</b> bar` or between `<br/>` siblings), while still dropping pure
formatting/indent whitespace and collapsing internal whitespace runs.
>
> Adds regression tests for mixed inline markup and `<br/>`-separated
cell content, and bumps the library to `0.22.28` with a changelog entry
describing the fix.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fe27d35. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 8daa154 commit 238657f
4 files changed
Lines changed: 41 additions & 3 deletions
File tree
- test_unstructured/common
- unstructured
- common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
1 | 7 | | |
2 | 8 | | |
3 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
128 | 150 | | |
129 | 151 | | |
130 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
108 | 112 | | |
109 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
110 | 120 | | |
111 | 121 | | |
112 | 122 | | |
| |||
0 commit comments