nicoscandolo opened a new pull request, #1926: URL: https://github.com/apache/stormcrawler/pull/1926
Fixes #1925 **Problem** When a block-level element (e.g. `<h3>`) is immediately followed by an inline element (e.g. `<a>`, `<span>`), the extracted text concatenates both without any space. For instance, this HTML from a real page (https://www.acai-island.com/contact): ```html <h3>Email</h3> <a href="mailto:[email protected]">[email protected]</a> ``` Produces `[email protected]` instead of `Email [email protected]`. **Root cause** In `tail()`, the space after a block element is only appended when `nextSibling() instanceof TextNode`. This misses cases where the next sibling is an inline Element. **Fix** Changed the condition to `nextSibling() != null`, so a space is appended after any block element regardless of the sibling type. The existing `lastCharIsWhitespace` guard prevents duplicate spaces. **Tests** Added two test cases covering block+inline combinations (`<h3>`+`<a>` and `<div>`+`<span>`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
