bettermusic / ChordSheetJS

A JavaScript library for parsing and formatting ChordPro chord sheets
GNU General Public License v2.0
4 stars 1 forks source link

💡 RFC: Parse Metadata in a text chordsheet #219

Closed isaiahdahl closed 1 year ago

isaiahdahl commented 2 years ago

Parent Task: https://github.com/PraiseCharts/studio/issues/32

Background & Motivation

Want to explore the idea of having metadata in a text chord sheet.

I like the idea of markdown style frontmatter.

title: Honey In the Rock
key: F
---
Verse 1
D       Dsus           D       Dsus
 Praying for a miracle, thirsty

=

{title: Honey In the Rock}
{key: F}
{c:Verse 1}
[D] Praying[Dsus] for a miracle,[D] thirsty[Dsus]

Possible solutions

martijnversluis commented 2 years ago

Markdown frontmatter style makes sense!

It makes sense to have a different grammar. Converting AST to a Song can be reused.

martijnversluis commented 2 years ago

@isaiahdahl I'm currently trying to compose a grammar that can parse an entire chord sheet including the front matter.

What would you prefer:

isaiahdahl commented 2 years ago

I think we should include it in the grammar.

I think it would be ideal if the '---' was optional or not even needed. And it could grab metadata without it. That would be hard to do if it wasn't in the grammar.

What do you think the downsides are to not relying on the --- to separate it?

martijnversluis commented 2 years ago

Hmm I'm not sure. It would be convenient not to need it. It might result in weird corner cases though when lyrics include a colon.

But I can just try to get it to work, and we can test it with some example charts?

isaiahdahl commented 2 years ago

Ok let's aim for not needing it.