From 6ff96ab57b10c71bd87f11184e2b7139d5145968 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Am=C3=A9lia=20P=2E=20H=2E=20Coutard?= Date: Sun, 16 Jun 2024 02:41:00 +0200 Subject: [PATCH] Simplification de l'usage de lilypond, via hakyll-process --- docs/Ma'oz Tzur.ly | 6 ------ docs/Ma'oz Tzur.ly.metadata | 4 ++++ lilypond-unix.sh | 5 ----- main.hs | 12 +++++++++++- 4 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 docs/Ma'oz Tzur.ly.metadata delete mode 100755 lilypond-unix.sh diff --git a/docs/Ma'oz Tzur.ly b/docs/Ma'oz Tzur.ly index d5ac0fb..b7f69be 100644 --- a/docs/Ma'oz Tzur.ly +++ b/docs/Ma'oz Tzur.ly @@ -1,9 +1,3 @@ ---- -title: Ma'oz Tzur -tags: musique, partition, Judaïsme -date: 2024-06-16 -description: Une partition pour accordéon de mon arrangement de Ma'oz Tzur. ---- \version "2.24.1" \header { title = "Ma'oz Tzur" diff --git a/docs/Ma'oz Tzur.ly.metadata b/docs/Ma'oz Tzur.ly.metadata new file mode 100644 index 0000000..a028037 --- /dev/null +++ b/docs/Ma'oz Tzur.ly.metadata @@ -0,0 +1,4 @@ +title: Ma'oz Tzur +tags: musique, partition, Judaïsme +date: 2024-06-16 +description: Une partition pour accordéon de mon arrangement de Ma'oz Tzur. diff --git a/lilypond-unix.sh b/lilypond-unix.sh deleted file mode 100755 index 2a2c609..0000000 --- a/lilypond-unix.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -F=$(mktemp 'tmp.XXXXXXXXXX') -lilypond -o "$F" - -cat "$F".pdf -rm "$F" "$F".pdf diff --git a/main.hs b/main.hs index 9d7bc8e..db04329 100644 --- a/main.hs +++ b/main.hs @@ -16,6 +16,16 @@ import Data.ByteString.Lazy.UTF8 (ByteString, fromString) import Data.Monoid ((<>)) import Data.Time.Format (formatTime, defaultTimeLocale) import Hakyll +import Hakyll.Process + +mapHead :: (a -> a) -> [a] -> [a] +mapHead _ [] = [] +mapHead f (h:t) = f h:t + +split :: Eq a => a -> [a] -> [[a]] +split _ [] = [[]] +split v (h:t) | v == h = []:split v t +split v (h:t) = mapHead (h:) (split v t) main :: IO () main = hakyll $ do @@ -32,7 +42,7 @@ main = hakyll $ do match "docs/*.ly" $ do route $ setExtension "pdf" - compile $ getResourceBody >>= withItemBody (unixFilterLBS "./lilypond-unix.sh" [] . fromString) + compile $ execCompilerWith (execName "lilypond") [HakFilePath] (COutFile (RelativePath (newExtension "pdf" . last . split '/'))) match "html/atom.xml" $ do route $ gsubRoute "html/" (const "") -- 2.45.2