From 24270026729d9998608ec3fd4f8d8e2d357dad90 Mon Sep 17 00:00:00 2001 From: "Francisco J. Sanchez" Date: Sun, 19 Jan 2025 18:00:53 +0100 Subject: [PATCH] fix playground _complex_ keys --- playground/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playground/src/lib.rs b/playground/src/lib.rs index e2001aa..fc1fb15 100644 --- a/playground/src/lib.rs +++ b/playground/src/lib.rs @@ -1,6 +1,6 @@ use cooklang::ast::build_ast; use cooklang::error::SourceReport; -use cooklang::metadata::{NameAndUrl, RecipeTime}; +use cooklang::metadata::{CooklangValueExt, NameAndUrl, RecipeTime}; use cooklang::{parser::PullParser, Extensions}; use cooklang::{Converter, CooklangParser, IngredientReferenceTarget, Item}; use std::fmt::Write; @@ -174,7 +174,7 @@ fn render(r: cooklang::ScaledRecipe, converter: &Converter) -> String { ul { @for (key, value) in &r.metadata.map { li.metadata { - span.key { (key.as_str().unwrap_or("")) } ":" (value.as_str().unwrap_or("")) // TODO + span.key { (key.as_str_like().unwrap_or_else(|| format!("{key:?}").into())) } ":" (value.as_str_like().unwrap_or_else(|| format!("{value:?}").into())) } } }