GithubHelp home page GithubHelp logo

Erro 'null' about chordsheetjs HOT 4 CLOSED

gpr19 avatar gpr19 commented on June 30, 2024 1
Erro 'null'

from chordsheetjs.

Comments (4)

martijnversluis avatar martijnversluis commented on June 30, 2024 1

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

from chordsheetjs.

martijnversluis avatar martijnversluis commented on June 30, 2024

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.

from chordsheetjs.

ldelia avatar ldelia commented on June 30, 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.

from chordsheetjs.

ldelia avatar ldelia commented on June 30, 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?

from chordsheetjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.