diff --git a/nodes/core/core/80-template.html b/nodes/core/core/80-template.html index 94fcd453f..56c68f3e8 100644 --- a/nodes/core/core/80-template.html +++ b/nodes/core/core/80-template.html @@ -42,6 +42,7 @@ diff --git a/nodes/core/core/80-template.js b/nodes/core/core/80-template.js index 85efaccbe..d39c76713 100644 --- a/nodes/core/core/80-template.js +++ b/nodes/core/core/80-template.js @@ -17,6 +17,8 @@ module.exports = function(RED) { "use strict"; var mustache = require("mustache"); + var yaml = require("js-yaml"); + /** * Custom Mustache Context capable to resolve message property and node @@ -80,6 +82,9 @@ module.exports = function(RED) { if (node.outputFormat === "json") { value = JSON.parse(value); } + if (node.outputFormat === "yaml") { + value = yaml.load(value); + } if (node.fieldType === 'msg') { RED.util.setMessageProperty(msg,node.field,value); diff --git a/nodes/core/locales/en-US/messages.json b/nodes/core/locales/en-US/messages.json index 6728db7c1..a4a9cc308 100644 --- a/nodes/core/locales/en-US/messages.json +++ b/nodes/core/locales/en-US/messages.json @@ -195,6 +195,7 @@ "mustache": "Mustache template", "plain": "Plain text", "json": "Parsed JSON", + "yaml": "Parsed YAML", "none": "none" }, "templatevalue": "This is the payload: {{payload}} !"