Skip to content

fix: BibleTextNode whitespace parsing#46

Merged
davidfedor merged 3 commits intomainfrom
codex/add-tests-for-bibletextnode-parsing
Feb 13, 2026
Merged

fix: BibleTextNode whitespace parsing#46
davidfedor merged 3 commits intomainfrom
codex/add-tests-for-bibletextnode-parsing

Conversation

@davidfedor
Copy link
Copy Markdown
Member

Motivation

  • The previous parser used a pending-whitespace stack to track inter-node spaces which introduced extra state and complexity; a per-chunk collapsing approach is simpler while still preserving inline spacing semantics.

Description

  • Replace the Delegate pending-whitespace machinery with a simplified parser(_:foundCharacters:) that collapses runs of whitespace to a single space and treats a standalone " " segment as renderable only when the previous child is an inline/text node.
  • Merge appended segments into existing adjacent text nodes while collapsing repeated spaces and avoid inserting spaces before non-inline previous nodes.
  • Update Sources/YouVersionPlatformCore/Bible/BibleTextNode.swift to remove the pendingWhitespace stack and related helper functions and apply the new foundCharacters logic.
  • Add and keep regression tests in Tests/YouVersionPlatformCoreTests/BibleTextNodeTests.swift to cover spaces between inline spans, mixed whitespace collapse, and leading-whitespace behavior.

Testing

  • Ran swift test and the full test suite passed (191 tests passed).
  • Ran SwiftLint with LINUX_SOURCEKIT_LIB_PATH=/root/.local/share/swiftly/toolchains/6.1.3/usr/lib swiftlint --strict and found 0 violations.

Codex Task

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 13, 2026

LCOV of commit 046911a during Unit Tests #101

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /var/folders/2m/bm_csnqx7ql9dfhv0kjgqhw80000gn/T/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 70
  lines.......: 68.0% (4729 of 6959 lines)
  functions...: 57.9% (541 of 935 functions)
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate: n/a

@davidfedor davidfedor changed the title fix: simplify BibleTextNode whitespace parsing fix: BibleTextNode whitespace parsing Feb 13, 2026
@davidfedor davidfedor merged commit 63c6fad into main Feb 13, 2026
2 checks passed
@davidfedor davidfedor deleted the codex/add-tests-for-bibletextnode-parsing branch February 13, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant