From cbc981482c23395d5d0485a3842968ec2f888b57 Mon Sep 17 00:00:00 2001 From: Craig Stuart Sapp Date: Tue, 3 Sep 2024 12:31:53 -0700 Subject: [PATCH] Allow filtering of EsAC conversions. --- _includes/vhv-scripts/misc.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/_includes/vhv-scripts/misc.js b/_includes/vhv-scripts/misc.js index f9a1ff9..6541473 100644 --- a/_includes/vhv-scripts/misc.js +++ b/_includes/vhv-scripts/misc.js @@ -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 ""; @@ -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\n"; } - // also consider other data formats such as EsAC } // Also add global verovio options: @@ -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\n"; } - // also consider other data formats such as EsAC } return data;