Skip to content

fix: line break#525

Merged
daveallie merged 7 commits intocrosspoint-reader:masterfrom
vjapolitzer:fix/line-break
Jan 27, 2026
Merged

fix: line break#525
daveallie merged 7 commits intocrosspoint-reader:masterfrom
vjapolitzer:fix/line-break

Conversation

@vjapolitzer
Copy link
Contributor

@vjapolitzer vjapolitzer commented Jan 23, 2026

Summary

Additional Context

  • The <br/> tag is self closing and in-line, so the existing logic for closing block tags does not get applied to <br/> tags.
  • This PR adds the in-line logic to:
    • Flush the word preceding the <br/> tag from partWordBuffer to currentTextBlock before calling startNewTextBlock
  • New function: ChapterHtmlSlimParser::flushPartWordBuffer()
    • Purpose: Consolidates the logic for flushing partWordBuffer to currentTextBlock
    • Impact: Simplifies ChapterHtmlSlimParser::characterData(…), ChapterHtmlSlimParser::startElement(…), and ChapterHtmlSlimParser::endElement(…) by integrating reused code into single function

AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO

vjapolitzer and others added 3 commits January 23, 2026 15:35
Flush the word preceding the line break tag to currentTextBlock before calling startNewTextBlock.
@vjapolitzer
Copy link
Contributor Author

The block of code that gets the EpdFontFamily::Style, as well as the portion which flushes partWordBuffer are used in a few places. The fix for #519 adds another repetition. I will refactor these into functions to improve readability and maintainability.

@vjapolitzer vjapolitzer marked this pull request as draft January 24, 2026 13:54
@vjapolitzer vjapolitzer marked this pull request as ready for review January 24, 2026 14:11
alpsfordays added a commit to ruby-builds/crosspoint-reader that referenced this pull request Jan 26, 2026
Fixes improper <br/> behaviour
alpsfordays added a commit to ruby-builds/crosspoint-reader that referenced this pull request Jan 26, 2026
Copy link
Member

@daveallie daveallie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find!

@daveallie daveallie merged commit bf6cf83 into crosspoint-reader:master Jan 27, 2026
1 check passed
Jessica765 pushed a commit to Jessica765/crosspoint-reader that referenced this pull request Feb 3, 2026
## Summary

* Fixes crosspoint-reader#519 
* Refactors repeated code into new function:
`ChapterHtmlSlimParser::flushPartWordBuffer()`
    
## Additional Context 
  
* The `<br/>` tag is self closing and _in-line_, so the existing logic
for closing block tags does not get applied to `<br/>` tags.
* This PR adds the _in-line_ logic to:
* Flush the word preceding the `<br/>` tag from `partWordBuffer` to
`currentTextBlock` before calling `startNewTextBlock`
* **New function**: `ChapterHtmlSlimParser::flushPartWordBuffer()`
* **Purpose**: Consolidates the logic for flushing `partWordBuffer` to
`currentTextBlock`
* **Impact**: Simplifies `ChapterHtmlSlimParser::characterData(…)`,
`ChapterHtmlSlimParser::startElement(…)`, and
`ChapterHtmlSlimParser::endElement(…)` by integrating reused code into
single function

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_
Unintendedsideeffects pushed a commit to Unintendedsideeffects/crosspoint-reader that referenced this pull request Feb 17, 2026
## Summary

* Fixes crosspoint-reader#519 
* Refactors repeated code into new function:
`ChapterHtmlSlimParser::flushPartWordBuffer()`
    
## Additional Context 
  
* The `<br/>` tag is self closing and _in-line_, so the existing logic
for closing block tags does not get applied to `<br/>` tags.
* This PR adds the _in-line_ logic to:
* Flush the word preceding the `<br/>` tag from `partWordBuffer` to
`currentTextBlock` before calling `startNewTextBlock`
* **New function**: `ChapterHtmlSlimParser::flushPartWordBuffer()`
* **Purpose**: Consolidates the logic for flushing `partWordBuffer` to
`currentTextBlock`
* **Impact**: Simplifies `ChapterHtmlSlimParser::characterData(…)`,
`ChapterHtmlSlimParser::startElement(…)`, and
`ChapterHtmlSlimParser::endElement(…)` by integrating reused code into
single function

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<br/> tag incorrectly wraps preceding word to new line

2 participants