From a357d2a1bee46300d16ae172d08c3ccb65a1524b Mon Sep 17 00:00:00 2001 From: mt3571 Date: Fri, 27 Nov 2020 12:09:08 +0000 Subject: [PATCH] Fixed the bug where the comments were preventing the rendering of the HTML --- src/core/Recipe.mjs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/Recipe.mjs b/src/core/Recipe.mjs index 14cb39b7..cd043ad3 100755 --- a/src/core/Recipe.mjs +++ b/src/core/Recipe.mjs @@ -190,6 +190,7 @@ class Recipe { for (let i = startFrom; i < this.opList.length; i++) { op = this.opList[i]; log.debug(`[${i}] ${op.name} ${JSON.stringify(op.ingValues)}`); + if (op.disabled) { log.debug("Operation is disabled, skipping"); continue; @@ -200,7 +201,13 @@ class Recipe { } try { - input = await dish.get(op.inputType); + + if (op.name != "Comment") { + input = await dish.get(op.inputType); + } + else { + input = dish.value ; + } log.debug(`Executing operation '${op.name}'`); if (isWorkerEnvironment()) { @@ -227,7 +234,12 @@ class Recipe { output = await op.run(input, op.ingValues); dish.set(output, op.outputType); } - this.lastRunOp = op; + + // if comment is the lastRunOp, the output we want is the previous command, not necessarily a String + if (op.name != "Comment"){ + this.lastRunOp = op; + } + } catch (err) { // Return expected errors as output if (err instanceof OperationError || @@ -273,6 +285,7 @@ class Recipe { await dish.get(this.lastRunOp.outputType), this.lastRunOp.ingValues ); + dish.set(output, this.lastRunOp.presentType); }