martijnversluis/ChordSheetJS

Preserving whitespace and comma parsing error with ChordPro parser

Closed this issue · 5 comments

Hi there,

I'm trying to parse the following ChordPro and I'm getting a weird output:

{comment: Intro}
[|] [B]              [|] [Bsus]        [|] [B]              [|] [Bsus]         [|]
[|] [B]              [|] [Bsus]        [|] [G#m7]       [|] [F#(4)]       [|]

{comment: Verse 1}
I've come [B]  for a day [C#m]  of fun
I've come [G#m7]  for the ho       [F#(4)]- le in one [E]
All I want [B]  is to cel     [C#m]- ebrate with you [G#m7]      [F#(4)]      [E]

Gives me this output with the HTML table formatter:
image

Issues I've noticed:

  • The whitespace in the intro isn't preserved (the lyrics pairs are just empty instead of something like  
  • The whitespaces in the second and third lines are generating erroneous comma , characters for some reason...

Is this able to be fixed? I'm happy to investigate myself if you can give me some pointers of where to look...

Thanks!

An additional observation I've seen with the comma issue is when there are extra spaces after the lyrics and before another chord, like ho [F#(4)]. The other way around just collapses white space, ie. [F#(4)] ho

After doing some more digging, I think I've narrowed the issue down to the parser rather than the formatter. In the parser object, I see the following:

image

@aonghas I just published 10.6.1 which addresses the whitespace parsing bug. Please let me know if that solves your issue. 🙏

@aonghas It turns out, due to Parcel's caching, that some new features did not end up in the compiled bundle. Please use version 10.9.2 (or just the latest release).

Brilliant thanks a lot! That's done it :)