Skip to content

Commit

Permalink
Allow filtering of EsAC conversions.
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsapp committed Sep 3, 2024
1 parent f56e745 commit cbc9814
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions _includes/vhv-scripts/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,24 @@ function getCurrentEsacMelody() {
// Extract the lines if a valid range is found
let extractedText = EDITOR.session.getLines(range.start, range.end).join("\n");
displayFileTitleFromEsac(extractedText);

// If there is contents in the GLOBALFILTER (handled by the
// filter toolbar), then include it as the last filter in the file:
if (GLOBALFILTER) {
let mode = getMode(extractedText);
if (mode === "esac") {
extractedText += "\n###filter: " + GLOBALFILTER + "\n";
}
}

// Also add global verovio options:
if (GLOBAL_VEROVIO_OPTIONS) {
let mode = getMode(extractedText);
if (mode === "esac") {
extractedText += "\n###verovio: " + GLOBAL_VEROVIO_OPTIONS + "\n";
}
}

return extractedText;
} else {
return "";
Expand Down Expand Up @@ -1304,13 +1322,14 @@ function getTextFromEditorWithGlobalFilter(data) {
data += "\n@@@filter: " + GLOBALFILTER + "\n";
} else if (mode === "humdrum") {
data += "\n!!!filter: " + GLOBALFILTER + "\n";
} else if (mode === "esac") {
data += "\n###filter: " + GLOBALFILTER + "\n";
} else {
// This will not really be useful, however, since
// MusicXML data get converted directly to MEI
// when it is in the text editor.
data += "\n<!-- !!!filter: " + GLOBALFILTER + " -->\n";
}
// also consider other data formats such as EsAC
}

// Also add global verovio options:
Expand All @@ -1320,13 +1339,14 @@ function getTextFromEditorWithGlobalFilter(data) {
data += "\n@@@verovio: " + GLOBAL_VEROVIO_OPTIONS + "\n";
} else if (mode === "humdrum") {
data += "\n!!!verovio: " + GLOBAL_VEROVIO_OPTIONS + "\n";
} else if (mode === "esac") {
data += "\n###verovio: " + GLOBAL_VEROVIO_OPTIONS + "\n";
} else {
// This will not really be useful, however, since
// MusicXML data get converted directly to MEI
// when it is in the text editor.
data += "\n<!-- !!!verovio: " + GLOBALFILTER + " -->\n";
}
// also consider other data formats such as EsAC
}

return data;
Expand Down

0 comments on commit cbc9814

Please sign in to comment.