reformat code
This commit is contained in:
@@ -24,6 +24,11 @@ export class SongComponent implements OnInit {
|
|||||||
public faDown = faCaretDown;
|
public faDown = faCaretDown;
|
||||||
public keyFormControl: FormControl;
|
public keyFormControl: FormControl;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private showSongService: ShowSongService,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
public _song: Song;
|
public _song: Song;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
@@ -32,11 +37,6 @@ export class SongComponent implements OnInit {
|
|||||||
this.keys = !!song ? getScale(song.key) : [];
|
this.keys = !!song ? getScale(song.key) : [];
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
|
||||||
private showSongService: ShowSongService,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
this.keyFormControl = new FormControl(this.showSong.key);
|
this.keyFormControl = new FormControl(this.showSong.key);
|
||||||
this.keyFormControl.valueChanges.subscribe(async value => {
|
this.keyFormControl.valueChanges.subscribe(async value => {
|
||||||
|
|||||||
@@ -28,15 +28,15 @@ export interface Section {
|
|||||||
})
|
})
|
||||||
export class TextRenderingService {
|
export class TextRenderingService {
|
||||||
|
|
||||||
constructor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private regexSection = /(Strophe|Refrain|Bridge)/;
|
private regexSection = /(Strophe|Refrain|Bridge)/;
|
||||||
private regexChords = /\b([CDEFGAHBcdefgahb](#|##|b|bb|sus|maj|maj7|min|aug|\d+|\/[CDEFGAHBcdefgahb])?\b)/;
|
private regexChords = /\b([CDEFGAHBcdefgahb](#|##|b|bb|sus|maj|maj7|min|aug|\d+|\/[CDEFGAHBcdefgahb])?\b)/;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
public parse(text: string): Section[] {
|
public parse(text: string): Section[] {
|
||||||
const arrayOfLines = text.split(/\r?\n/).filter(_ => _);
|
const arrayOfLines = text.split(/\r?\n/).filter(_ => _);
|
||||||
const sections = arrayOfLines.reduce((array, line) => {
|
return arrayOfLines.reduce((array, line) => {
|
||||||
if (line.match(this.regexSection)) return [...array, {
|
if (line.match(this.regexSection)) return [...array, {
|
||||||
type: this.getSectionTypeOfLine(line),
|
type: this.getSectionTypeOfLine(line),
|
||||||
number: -1,
|
number: -1,
|
||||||
@@ -45,8 +45,6 @@ export class TextRenderingService {
|
|||||||
array[array.length - 1].lines.push(this.getLineOfLineText(line));
|
array[array.length - 1].lines.push(this.getLineOfLineText(line));
|
||||||
return array;
|
return array;
|
||||||
}, [] as Section[]);
|
}, [] as Section[]);
|
||||||
|
|
||||||
return sections;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLineOfLineText(text: string): Line {
|
private getLineOfLineText(text: string): Line {
|
||||||
|
|||||||
Reference in New Issue
Block a user