Rendering code refactor
This commit is contained in:
18
folkugat_web/services/lilypond/source.py
Normal file
18
folkugat_web/services/lilypond/source.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from folkugat_web.model.lilypond.score import LilypondSet, LilypondTune
|
||||
from folkugat_web.templates import templates
|
||||
|
||||
SCORE_BEGINNING = "% --- SCORE BEGINNING --- %"
|
||||
|
||||
|
||||
def tune_source(tune: LilypondTune) -> str:
|
||||
return templates.get_template("lilypond/single_tune.ly").render(
|
||||
score_beginning=SCORE_BEGINNING,
|
||||
tune=tune,
|
||||
)
|
||||
|
||||
|
||||
def set_source(tune_set: LilypondSet) -> str:
|
||||
return templates.get_template("lilypond/tune_set.ly").render(
|
||||
score_beginning=SCORE_BEGINNING,
|
||||
tune_set=tune_set,
|
||||
)
|
||||
Reference in New Issue
Block a user