fix: blank lines split implicit verses into separate sections (Closes #29) #30

Merged
shahondin1624 merged 1 commits from feature/issue-29-blank-lines-split-implicit-verses into main 2026-03-17 15:35:38 +01:00

Summary

  • Adds an explicitSection flag to ChordProParser to distinguish between sections started by explicit directives ({start_of_verse}, etc.) and implicit sections (started when a lyric line is encountered outside any section)
  • Blank lines now flush the current section when inside an implicit verse, allowing the next non-blank lyric line to start a new implicit VERSE section
  • Blank lines within explicit sections are still ignored, preserving backward compatibility
  • 7 new tests covering blank-line verse splitting, explicit section preservation, metadata blank lines, and mixed scenarios

Closes #29

Test plan

  • Blank line between implicit verses produces two separate VERSE sections
  • Blank lines within explicit {start_of_verse}/{end_of_verse} are still ignored
  • Blank lines between metadata directives do not create empty sections
  • Mixed explicit and implicit sections with blank lines work correctly
  • Multiple consecutive blank lines handled correctly
  • Three implicit verses separated by blank lines produce three sections
  • All 91 existing tests still pass
  • Full test suite across all modules passes
## Summary - Adds an `explicitSection` flag to `ChordProParser` to distinguish between sections started by explicit directives (`{start_of_verse}`, etc.) and implicit sections (started when a lyric line is encountered outside any section) - Blank lines now flush the current section when inside an implicit verse, allowing the next non-blank lyric line to start a new implicit VERSE section - Blank lines within explicit sections are still ignored, preserving backward compatibility - 7 new tests covering blank-line verse splitting, explicit section preservation, metadata blank lines, and mixed scenarios Closes #29 ## Test plan - [x] Blank line between implicit verses produces two separate VERSE sections - [x] Blank lines within explicit `{start_of_verse}`/`{end_of_verse}` are still ignored - [x] Blank lines between metadata directives do not create empty sections - [x] Mixed explicit and implicit sections with blank lines work correctly - [x] Multiple consecutive blank lines handled correctly - [x] Three implicit verses separated by blank lines produce three sections - [x] All 91 existing tests still pass - [x] Full test suite across all modules passes
shahondin1624 added 1 commit 2026-03-17 15:35:32 +01:00
The ChordPro parser previously skipped all blank lines unconditionally,
causing songs without explicit {start_of_verse}/{end_of_verse} directives
to be parsed as a single section. This adds an explicitSection flag to
track whether a section was started by an explicit directive or implicitly.
Blank lines now flush implicit sections, allowing the next lyric line to
start a new implicit VERSE section. Explicit sections still ignore blank
lines as before.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shahondin1624 merged commit 543fe66a44 into main 2026-03-17 15:35:38 +01:00
shahondin1624 deleted branch feature/issue-29-blank-lines-split-implicit-verses 2026-03-17 15:35:38 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shahondin1624/songbook#30