martijnversluis / ChordSheetJS

A JavaScript library for parsing and formatting chords and chord sheets
https://github.com/users/martijnversluis/projects/4
GNU General Public License v2.0
318 stars 50 forks source link

[Bug] Ultimate Guitar tab to Chordsheet gives too much spaces in chord names #205

Closed TomJansen closed 3 years ago

TomJansen commented 3 years ago

Hello. I use this program to convert ultimate guitar tabs to chordsheets but it gives a weird output for chords. Example (https://tabs.ultimate-guitar.com/tab/ajj-andrew-jackson-jihad/normalization-blues-chords-2953307):

E
I'm detached and I'm distracted
E
All keyed up and unproductive
E
Vacillating between being all excited and disgusted
A
And then dozing lackadaisically
A                                       E
In this bubble where I've made my mental home
 B7                                 A
Connection's more important now than it ever was
                    E
But I'd rather be alone

Gives

[E]I'm detached and I'm distracted
[E]All keyed up and unproductive
[E]Vacillating between being all excited and disgusted
[A]And then dozing lackadaisically
[A                                      ]In this bubble where I've made my mental[E]home
C[B7                                ]onnection's more important now than[A]it ever was
[                   ]But I'd rather be al[E]one

Notice the spaces in the chord names

martijnversluis commented 3 years ago

Hi @TomJansen,

Thanks for submitting your question. This is probably related to the ChordSheetParser settings. Could you try instantiating the parser like below?

new ChordSheetParser({ preserveWhitespace: false })

This should remove the weird spacing. Could you let me know if this solves your issue?

I’m thinking of changing the default of this option, but that will require releasing a new major version.

TomJansen commented 3 years ago

Oh wow yes that worked! Thanks!