Erro 'null'
Closed this issue · 4 comments
Hey @gpr19. Thanks for reaching out!
Could you elaborate on the code that is used to render the sheet? It would be nice to have the minimal bit of code that breaks on 9.0.1 or returns a different result.
I'm experiencing this issue, for example, with this setup:
- Parser: ChordsOverWordsParser
- Formatter: HtmlTableFormatter
- Sheet:
const sheet = ` F Am Dm Gm C
Tonight I’m gonna have myself a real good time, I feel alive
F F7 Bb Gm7 D7
And the world, I'll turn it inside out yeah, I'm floating around in ecstasy
Gm F C Gm Gm F C
So don’t stop me now, don’t stop me
Gm F/G Gm7 C Dm7/C C7
Cause I’m having a good time, having a good time
`;
The last empty line will produce a null being displayed, as you can see in this image:
This could be fixed by the client that is using the ChordSheetJS library by just trimming the sheet, but it would be great if the library could handle this scenario by itself.
The same happens when two or more line breaks appear together in the middle of the sheet.
Here is the fix that I'm using before calling the ChordsOverWordsParser class:
phraseToParse = phraseToParse.replace(/\n\n/g, '\n').trim();
Does it make sense to include the fix in the ChordsOverWordsParser parser method?
@gpr19 I think if found the issue, and I merged a fix. Will try to publish it soon 👍