add comments in show

This commit is contained in:
2025-01-03 15:59:00 +01:00
parent 802c309679
commit 898c6c4d7e
8 changed files with 42 additions and 43 deletions

View File

@@ -2,4 +2,5 @@ export enum SectionType {
Verse,
Chorus,
Bridge,
Comment,
}

View File

@@ -13,14 +13,13 @@ import {Line} from './line';
export class TextRenderingService {
private regexSection = /(Strophe|Refrain|Bridge)/;
public constructor(private transposeService: TransposeService) {
}
public constructor(private transposeService: TransposeService) {}
public parse(text: string, transpose: TransposeMode | null): Section[] {
public parse(text: string, transpose: TransposeMode | null, withComments = true): Section[] {
if (!text) {
return [];
}
const arrayOfLines = text.split(/\r?\n/).filter(_ => _);
const arrayOfLines = text.split(/\r?\n/).filter(_ => _ && (!_.startsWith('#') || withComments));
const indices = {
[SectionType.Bridge]: 0,
[SectionType.Chorus]: 0,