Fix excessive vertical whitespace in passage headers #181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change fixes the issue where excessive vertical whitespace (large gaps) appeared before headers in Telegram messages for Bible passages. This was caused by the accumulation of newlines from various HTML elements (paragraphs, spans, headers) and whitespace text nodes.
The fix involves:
h*tag handler inParseNodesForPassagenow trims the text content before wrapping it in bold tags. This removes internal newlines that were being bolded.CleanPassageTextfunction that uses a regular expression (\n\s*\n[\s\n]*->\n\n) to collapse any sequence of 3 or more newlines (including those with intervening spaces) into a standard double newline (one blank line). This runs on the final parsed text string.This solution is robust against variations in the input HTML structure and ensures consistent spacing without modifying the fragile logic for individual elements like
span.PR created automatically by Jules for task 18071459911303667092 started by @julwrites