From f4eeb66e7c874a64ec0f0c6a97d967a034decb30 Mon Sep 17 00:00:00 2001 From: Cerys Lewis Date: Sun, 9 Feb 2025 10:57:30 +0000 Subject: [PATCH] made the simple abc render more compact --- App/Dataclasses/DatabaseFolkTuneDetails.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/App/Dataclasses/DatabaseFolkTuneDetails.php b/App/Dataclasses/DatabaseFolkTuneDetails.php index c305afe..0559a0e 100644 --- a/App/Dataclasses/DatabaseFolkTuneDetails.php +++ b/App/Dataclasses/DatabaseFolkTuneDetails.php @@ -65,15 +65,18 @@ K: {$this->Parts[$counter]->KeySignature}"; public function BuildSimple(): string { - $builder = "X: {$this->ID} -L: 1/4"; - - $builder .= " + $notation = $this->Parts[0]->ABCNotation; + $notation = preg_replace( + pattern: "/\r|\n/", + replacement: "", + subject: $notation + ); + + return " +X: {$this->ID} +L: 1/4 K: {$this->Parts[0]->KeySignature} -M: {$this->Parts[0]->TimeSignature}"; - - $builder .= " -{$this->Parts[0]->ABCNotation}"; - return $builder; +M: {$this->Parts[0]->TimeSignature} +{$notation}"; } } \ No newline at end of file