Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro 'null' #1163

Closed
gpr19 opened this issue May 6, 2024 · 4 comments · Fixed by #1174
Closed

Erro 'null' #1163

gpr19 opened this issue May 6, 2024 · 4 comments · Fixed by #1174

Comments

@gpr19
Copy link

gpr19 commented May 6, 2024

I'm having an error in this new version, before I was using 9.0.0. This week I started a new project to test with the latest version (9.0.1).

When the enter key shows 'null'

Version 9.0.1:
image

But in version 9.0.0 works fine:
image

@martijnversluis
Copy link
Owner

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.

@ldelia
Copy link

ldelia commented May 11, 2024

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:

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.

@ldelia
Copy link

ldelia commented May 16, 2024

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?

martijnversluis added a commit that referenced this issue May 17, 2024
`Paragraph#isLiteral()` would return `true` for empty paragraphs, which
caused formatters to render a literal section with a label containing
`"null"`.

Fixes #1163

Thanks to @gpr19 for reporting
martijnversluis added a commit that referenced this issue May 17, 2024
`Paragraph#isLiteral()` would return `true` for empty paragraphs, which
caused formatters to render a literal section with a label containing
`"null"`.

Fixes #1163

Thanks to @gpr19 for reporting
@martijnversluis
Copy link
Owner

@gpr19 I think if found the issue, and I merged a fix. Will try to publish it soon 👍

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 a pull request may close this issue.

3 participants