|
@@ -121,10 +121,10 @@ export class RepetitionInstructionReader {
|
|
|
public handleRepetitionInstructionsFromWordsOrSymbols(directionTypeNode: IXmlElement, relativeMeasurePosition: number): boolean {
|
|
|
const wordsNode: IXmlElement = directionTypeNode.element("words");
|
|
|
if (wordsNode !== undefined) {
|
|
|
+ const dsRegEx: string = "d\\s?\\.s\\."; // Input for new RegExp(). TS eliminates the first \
|
|
|
// must Trim string and ToLower before compare
|
|
|
const innerText: string = wordsNode.value.trim().toLowerCase();
|
|
|
- if (StringUtil.StringContainsSeparatedWord(innerText, "d.s. al fine") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "d. s. al fine")) {
|
|
|
+ if (StringUtil.StringContainsSeparatedWord(innerText, dsRegEx + " al fine")) {
|
|
|
let measureIndex: number = this.currentMeasureIndex;
|
|
|
if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
measureIndex--;
|
|
@@ -133,8 +133,8 @@ export class RepetitionInstructionReader {
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
- if (StringUtil.StringContainsSeparatedWord(innerText, "d.s. al coda") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "d. s. al coda")) {
|
|
|
+ const dcRegEx: string = "d\\.\\s?c\\.";
|
|
|
+ if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx + " al coda")) {
|
|
|
let measureIndex: number = this.currentMeasureIndex;
|
|
|
if (relativeMeasurePosition < 0.5) {
|
|
|
measureIndex--;
|
|
@@ -143,8 +143,7 @@ export class RepetitionInstructionReader {
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
- if (StringUtil.StringContainsSeparatedWord(innerText, "d.c. al fine") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "d. c. al fine")) {
|
|
|
+ if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx + " al fine")) {
|
|
|
let measureIndex: number = this.currentMeasureIndex;
|
|
|
if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
measureIndex--;
|
|
@@ -153,8 +152,7 @@ export class RepetitionInstructionReader {
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
- if (StringUtil.StringContainsSeparatedWord(innerText, "d.c. al coda") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "d. c. al coda")) {
|
|
|
+ if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx + " al coda")) {
|
|
|
let measureIndex: number = this.currentMeasureIndex;
|
|
|
if (relativeMeasurePosition < 0.5) {
|
|
|
measureIndex--;
|
|
@@ -163,10 +161,8 @@ export class RepetitionInstructionReader {
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
- if (StringUtil.StringContainsSeparatedWord(innerText, "d.c.") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "d. c.") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "dacapo") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "da capo")) {
|
|
|
+ if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx) ||
|
|
|
+ StringUtil.StringContainsSeparatedWord(innerText, "da\\s?capo")) {
|
|
|
let measureIndex: number = this.currentMeasureIndex;
|
|
|
if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
measureIndex--;
|
|
@@ -175,10 +171,8 @@ export class RepetitionInstructionReader {
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
- if (StringUtil.StringContainsSeparatedWord(innerText, "d.s.") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "d. s.") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "dalsegno") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "dal segno")) {
|
|
|
+ if (StringUtil.StringContainsSeparatedWord(innerText, dsRegEx) ||
|
|
|
+ StringUtil.StringContainsSeparatedWord(innerText, "dal\\s?segno")) {
|
|
|
let measureIndex: number = this.currentMeasureIndex;
|
|
|
if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
measureIndex--;
|
|
@@ -187,10 +181,8 @@ export class RepetitionInstructionReader {
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
- if (StringUtil.StringContainsSeparatedWord(innerText, "tocoda") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "to coda") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "a coda") ||
|
|
|
- StringUtil.StringContainsSeparatedWord(innerText, "a la coda")) {
|
|
|
+ if (StringUtil.StringContainsSeparatedWord(innerText, "to\\s?coda") ||
|
|
|
+ StringUtil.StringContainsSeparatedWord(innerText, "a (la )?coda")) {
|
|
|
let measureIndex: number = this.currentMeasureIndex;
|
|
|
if (relativeMeasurePosition < 0.5) {
|
|
|
measureIndex--;
|