From 69390b2411d618a8fc11a5f8abc9c9025c1f4300 Mon Sep 17 00:00:00 2001 From: Nicholas Jitkoff Date: Thu, 28 Jul 2022 23:00:18 -0400 Subject: [PATCH] Updated Recipe --- docs/render/recipe.css | 4 ++++ docs/render/recipe.js | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/render/recipe.css b/docs/render/recipe.css index 5e14ce9..ab4c174 100644 --- a/docs/render/recipe.css +++ b/docs/render/recipe.css @@ -31,6 +31,10 @@ body { /* margin: 0 -2em; */ } + .description { + white-space:pre-wrap; + + } .ingredients:hover .noun { /* text-decoration:underline; */ } diff --git a/docs/render/recipe.js b/docs/render/recipe.js index 6e3d067..aa1cf13 100644 --- a/docs/render/recipe.js +++ b/docs/render/recipe.js @@ -24,7 +24,7 @@ let FRACTION_MAP = { } let ignoredTerms = [ - "note", "teaspoon", "teaspoons", "tablespoon", "tablespoons", "cup", "cups", "taste", "more", "melted", "into", "wide", "pound", "pounds", "gram", "grams", "you", "ounce", "ounces", "thinly", "sliced", + "with", "crust", "very", "cold", "hot", "top", "warm", "one", "note", "teaspoon", "teaspoons", "tablespoon", "tablespoons", "cup", "cups", "taste", "more", "melted", "into", "wide", "pound", "pounds", "gram", "grams", "you", "ounce", "ounces", "thinly", "sliced", "pan", "cube", "cubes", "finely", "ground", "garnish", "about", "cut", "and", "smashed", "each", "the", "medium", "large", "small", "for", "chopped", "minced", "grated", "box", "softened", "directed", "shredded", "cooked", "from", "frozen", "thawed" ] @@ -192,9 +192,10 @@ function render() { image = image?.url || image; let instructions = json.recipeInstructions; let title = clean(json.name); - let description = clean(json.description); + let description = clean(json.description.replace(/\\n/g, "
")) parent.postMessage({title:title, favicon:"🍴", image:image, description:description, wakeLock:true, updateURL:true}, "*"); - + description = description.split("\n").join("

") + console.log(description) // let text = instructions.join(" "); let ingredients = json.recipeIngredient; @@ -250,7 +251,6 @@ function render() { let text = (instruction.text || instruction); - if (reformat) { text = text.match( /[0-9\. ]{0,6}[^\.!\?]+[\.!\?]+/g ); } else { @@ -334,8 +334,7 @@ function render() { m("a.action", { title:"Print", onclick: () => {window.print(); return false;} }, m(".icon.material-icons-outlined", "print")), ) ), - json.description ? m(".description", - clean(json.description), + description ? m(".description", {innerHTML:description}, json.author?.name ? m("span.author", (" —⁠" + json.author?.name)) : null, m("p"), ) : null,