Skip to content

Rewrite lyrics parser to handle inline markup - #72

Open
vlnst wants to merge 2 commits into
Insprill:masterfrom
vlnst:fix-lyrics-parsing
Open

vlnst wants to merge 2 commits into
Insprill:masterfrom
vlnst:fix-lyrics-parsing

Conversation

@vlnst

@vlnst vlnst commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Lyrics break when Genius puts inline markup inside a line or a sidebar block between paragraphs, as described in #55.

The parser now reads each line as a whole before deciding whether it's a heading, joins text split over inline tags, and treats the start of every lyrics container as a paragraph break. The template no longer adds whitespace between the parts of a line. This also fixes an empty heading above the first section of every song, and a page error when the lyrics contain a link that isn't an annotation.

The parser had no tests, so I added some. One runs against a small placeholder page laid out like a Genius lyrics page (containers split by sidebar and ad blocks, inline markup, multi-line and heading annotations). Three small hand-written ones cover what those pages don't: Genius has since fixed the "M ike" lyrics, links that are or aren't annotations, and the template output, since half of the "M ike" fix is there.

Closes #55

@vlnst
vlnst requested a review from Insprill October 18, 2026 19:24
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.

Captions containing markup parsed incorrectly

2 participants