From f4380758ee94fc137073471f52bf8a20fda34f1b Mon Sep 17 00:00:00 2001 From: jacksonfu14 Date: Tue, 18 Nov 2025 21:47:55 +0100 Subject: calculate ledger lines correctly --- morphology-img/src/template.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'morphology-img/src/template.rs') diff --git a/morphology-img/src/template.rs b/morphology-img/src/template.rs index e552843..9a66000 100644 --- a/morphology-img/src/template.rs +++ b/morphology-img/src/template.rs @@ -10,6 +10,7 @@ const ELEMENTS_ILY: &str = include_str!("../static/elements.ily"); const MORPHEME_PLACEHOLDER: &str = "%MORPHEME%"; const RUNGS_PLACEHOLDER: &str = "%RUNGS%"; +const LEDGERS_PLACEHOLDER: &str = "%LEDGERS%"; /// Returns the template .ly content pub fn get_template() -> &'static str { @@ -36,13 +37,14 @@ pub fn get_elements_ily() -> &'static str { /// # Arguments /// - `morpheme`: The LilyPond morpheme markup to substitute /// - `rungs`: The Scheme list string for staff line positions +/// - `ledgers`: The Scheme list string for ledger line positions /// /// # Returns /// The complete .ly file content with substitutions applied /// /// # Errors /// Returns `RenderError::Template` if placeholders are not found -pub fn substitute_template(morpheme: &str, rungs: &str) -> Result { +pub fn substitute_template(morpheme: &str, rungs: &str, ledgers: &str) -> Result { let template = get_template(); if !template.contains(MORPHEME_PLACEHOLDER) { @@ -57,9 +59,16 @@ pub fn substitute_template(morpheme: &str, rungs: &str) -> Result