From 31d3801b52d66a204c4d44e3754a65eb6bff2347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Brunet?= Date: Thu, 20 May 2021 00:42:14 +0200 Subject: [PATCH] Workaround to allow commas inside ingredients --- .eleventy.js | 5 +++-- src/_includes/layouts/recipe.njk | 2 +- src/recipes/courgette-lemon-risotto.md | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index bfff20a..9ac9fd8 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -61,8 +61,9 @@ module.exports = config => { return value.toLowerCase(); }); - config.addFilter('asArray', function(value) { - return value ? [...value] : [] + // This workaround is needed so we can transform it back into an array with Alpine (we can't split on "," as it can be included within the items) + config.addFilter('arrayToString', function(value) { + return value.join('£'); }); /* Shortcodes */ diff --git a/src/_includes/layouts/recipe.njk b/src/_includes/layouts/recipe.njk index 42c6818..1230351 100644 --- a/src/_includes/layouts/recipe.njk +++ b/src/_includes/layouts/recipe.njk @@ -11,7 +11,7 @@ {{ tag }} {% endfor %} -
+
{% if time or servings %}
{% if time %} diff --git a/src/recipes/courgette-lemon-risotto.md b/src/recipes/courgette-lemon-risotto.md index d68fad8..d0f6cdf 100644 --- a/src/recipes/courgette-lemon-risotto.md +++ b/src/recipes/courgette-lemon-risotto.md @@ -11,7 +11,7 @@ sourceLabel: BBC good food sourceURL: https://www.bbcgoodfood.com/recipes/courgette-lemon-risotto/ ingredients: - 50g butter - - 1 onion finely chopped + - 1 onion, finely chopped - 1 large garlic clove crushed - 180g risotto rice - 1 vegetable stock cube