From 97480dedb0f4ded491fdb6cb323eb62a4577b2ca Mon Sep 17 00:00:00 2001 From: Maxime REIS Date: Thu, 4 Dec 2025 17:55:38 +0100 Subject: [PATCH] Update templates and the template-generator script. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add linear-gradient in the chocolate template - Add "Tisane de Noël" template - Add the logic to populate the gradient colors in the script - Add template definition in the products definitions csv --- product_definitions.csv | 2 + scripts/renew_lineup.py | 11 + templates/Chocolat.svg | 137 ++-- templates/Tisane Noël.svg | 1507 +++++++++++++++++++++++++++++++++++++ 4 files changed, 1604 insertions(+), 53 deletions(-) create mode 100644 templates/Tisane Noël.svg diff --git a/product_definitions.csv b/product_definitions.csv index 7e03359..709de38 100644 --- a/product_definitions.csv +++ b/product_definitions.csv @@ -31,3 +31,5 @@ sel;Grillades - Viande et Légumes;Sel de Camargue, Thym*, Origan*, Sarriette*, sel;Herbes de Provence;Sel de Camargue, Thym*, Origan*, Sarriette*, Romarin*;;6307a6;Sel - Herbes de Provence.svg;True sel;Poisson et Viande Blanche;Sel de Camargue, Thym*, Sauge*, Agastache*, Bleuet*;;5b7aff;Sel - Poisson et Viande Blanche.svg;True chocolat;Menthe Poivrée;"Chocolat de couverture noir* (pâte de cacao*, sucre de canne*, beurre de cacao*; peut contenir : *lait), *crème entière* (crème de lait à 30% de matière grasse*, stabilisants : carraghénanes), menthe poivrée*";;007e49;Chocolat - Menthe Poivrée.svg;True +chocolat;Lavande et Fleurs;"Chocolat de couverture noir* (pâte de cacao*, sucre de canne*, beurre de cacao*; peut contenir : *lait), *crème entière* (crème de lait à 30% de matière grasse*, stabilisants : carraghénanes), Lavande*, Monarde*, Souci*, Bleuet*";;6307a6;Chocolat - Lavande et Fleurs - Monarde Souci Bleuet.svg;True;0723a6;6307a6;ff0019;ff8b00; +tisanenoel;Tisane de Noël;Basilic cannelle*, Basilic thaï*, Thym*, Menthe verte*, Mélisse*, Écorce d'orange*, Écorce de cannelle*;;ff0000;Tisane - Tisane de Noël - Basilic cannelle Basilic thaï Thym Menthe verte Mélisse Écorce d'orange Écorce de cannelle.svg;True diff --git a/scripts/renew_lineup.py b/scripts/renew_lineup.py index 249c209..dd23beb 100755 --- a/scripts/renew_lineup.py +++ b/scripts/renew_lineup.py @@ -22,6 +22,7 @@ templates = { 'pesto': f"{TEMPLATES_DIR}/Pesto.svg", 'sirop': f"{TEMPLATES_DIR}/Sirop.svg", 'tisane': f"{TEMPLATES_DIR}/Tisane.svg", + 'tisanenoel': f"{TEMPLATES_DIR}/Tisane Noël.svg", 'sel': f"{TEMPLATES_DIR}/Sel.svg", } @@ -50,11 +51,21 @@ def main(): ingredients = [e if not e.startswith('*') else ALLERGEN_BEGIN_STYLE + e[1:] + ALLERGEN_END_STYLE for e in ingredients] ingredients_sub = ", ".join(ingredients) AB_logo_visibility = 'inline' if row[6] == 'True' else 'none' + # Set the 4 linear-gradient stop colors if they are set in the csv, otherwise default to the template's background color + if 7+4 <= len(row): + gradient_color0, gradient_color1, gradient_color2, gradient_color3 = row[7:7+4] + else: + gradient_color0 = gradient_color1 = gradient_color2 = gradient_color3 = row[4] + subs = { 'designation': row[1].strip(), 'ingredients': ingredients_sub, 'description': row[3].strip(), 'color': row[4], + 'gradient_color0': gradient_color0, + 'gradient_color1': gradient_color1, + 'gradient_color2': gradient_color2, + 'gradient_color3': gradient_color3, 'AB': AB_logo_visibility, 'designation_fontsize': JAM_DESIGNATION_FONTSIZE_DEFAULT, } diff --git a/templates/Chocolat.svg b/templates/Chocolat.svg index c5143b9..df60bf8 100644 --- a/templates/Chocolat.svg +++ b/templates/Chocolat.svg @@ -20,6 +20,26 @@ xmlns:dc="http://purl.org/dc/elements/1.1/"> + + + + + + + + + + + À conserver dans un endroit sec, à l'abri de + id="tspan22521">À conserver dans un endroit sec, à l'abri de la lumière. + id="tspan22525">la lumière. À consommer de préférence avant : À consommer de préférence avant : ${dluo}${dluo} + id="tspan22533"> *Produits issus de l'agriculture biologique. + id="tspan22537">*Produits issus de l'agriculture biologique. - - ${ingredients} - - ${designation} + id="tspan22541">${designation} diff --git a/templates/Tisane Noël.svg b/templates/Tisane Noël.svg new file mode 100644 index 0000000..1ae4db3 --- /dev/null +++ b/templates/Tisane Noël.svg @@ -0,0 +1,1507 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + POIDS NET :${q}gLOT $lot + + + 1 c. à c./tasse + + + + PRÉPARATION + + + + + COMPOSITION + + + + Culture et cueillette à la maindans les Alpes de Haute-Provence + Infusion Biologique des Monges + + www.unbrindefolie.net + + 06 95 96 61 08 + + Lieu-dit Lèbre, 04200, Authon + Anne Brogi - "Un Brin de Folie" + + + À conserver dans un endroit sec, à l'abri de +la lumière. +À consommer de préférence avant : ${dluo} +*Produits issus de l'agriculture biologique. + + Infusion : 5mn + + + + + Décoction : 5mn + + + + ${ingredients} + ${designation} + ${designation} + + + + + + + + + + + + + + + + + + +