From d0c7c8061605ae4a5a4ef7fc5dcabeb54f03eb08 Mon Sep 17 00:00:00 2001 From: ewandor Date: Mon, 8 Jul 2024 02:03:36 +0200 Subject: [PATCH] adding idea --- .idea/.gitignore | 5 +++++ .idea/2h2r.iml | 12 ++++++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ src/Editor.js.ts | 11 ++++++----- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/2h2r.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/2h2r.iml b/.idea/2h2r.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/2h2r.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2a24eda --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Editor.js.ts b/src/Editor.js.ts index 2842b42..c1c272a 100644 --- a/src/Editor.js.ts +++ b/src/Editor.js.ts @@ -25,7 +25,7 @@ class Sheet { lines: Line[] = []; } -function render_sheet(sheet: Sheet, renderChord:any): string { +function render_sheet_html(sheet: Sheet, renderChord:any): string { let result = "

"; for (let line of sheet.lines) { let rendered_line = '' @@ -33,7 +33,7 @@ function render_sheet(sheet: Sheet, renderChord:any): string { rendered_line = "

" } else { if (line.lyrics != "") { - rendered_line = line.lyrics; + rendered_line = line.lyrics.replace(" ", " "); } else if (line.chords.length > 0) { for (let chord of line.chords) { rendered_line += " ".repeat(chord.spaces_before) + render_chord(chord.chord, renderChord) @@ -51,6 +51,8 @@ function render_chord(chord: Chord, renderer:any): string { return "" + renderer(chord) + "" } + + export function get_chord_sheet_html(normalized_txt: string): string { const parseChord = chordParserFactory(); const renderChord = chordRendererFactory({ useShortNamings: true }); @@ -70,7 +72,7 @@ export function get_chord_sheet_html(normalized_txt: string): string { } const chord = parseChord(word); if (chord.error) { - sheet_line.lyrics = line.replace(' ', " "); + sheet_line.lyrics = line; break; } else { sheet_line.chords.push(new ChordNotation(chord, space_before_chord)); @@ -86,6 +88,5 @@ export function get_chord_sheet_html(normalized_txt: string): string { } sheet.lines.push(sheet_line) } - console.log(sheet) - return render_sheet(sheet, renderChord) + return render_sheet_html(sheet, renderChord) }