adding idea
This commit is contained in:
@@ -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 = "<div><p>";
|
||||
for (let line of sheet.lines) {
|
||||
let rendered_line = ''
|
||||
@@ -33,7 +33,7 @@ function render_sheet(sheet: Sheet, renderChord:any): string {
|
||||
rendered_line = "</p><p>"
|
||||
} 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 "<span class='chord' style='cursor: pointer;'>" + renderer(chord) + "</span>"
|
||||
}
|
||||
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user