mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
update initialize & finalize processing of function node
This commit is contained in:
@@ -25,6 +25,17 @@ var settings;
|
||||
var libDir;
|
||||
var libFlowsDir;
|
||||
|
||||
function toSingleLine(text) {
|
||||
var result = text.replace(/\\/g, "\\\\").replace(/\n/g, "\\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
function fromSingleLine(text) {
|
||||
var result = text.replace(/\\[\\n]/g, function(s) {
|
||||
return ((s === "\\\\") ? "\\" : "\n");
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function getFileMeta(root,path) {
|
||||
var fn = fspath.join(root,path);
|
||||
@@ -43,7 +54,7 @@ function getFileMeta(root,path) {
|
||||
for (var i=0;i<parts.length;i+=1) {
|
||||
var match = /^\/\/ (\w+): (.*)/.exec(parts[i]);
|
||||
if (match) {
|
||||
meta[match[1]] = match[2];
|
||||
meta[match[1]] = fromSingleLine(match[2]);
|
||||
} else {
|
||||
read = size;
|
||||
break;
|
||||
@@ -172,7 +183,7 @@ module.exports = {
|
||||
var headers = "";
|
||||
for (var i in meta) {
|
||||
if (meta.hasOwnProperty(i)) {
|
||||
headers += "// "+i+": "+meta[i]+"\n";
|
||||
headers += "// "+i+": "+toSingleLine(meta[i])+"\n";
|
||||
}
|
||||
}
|
||||
if (type === "flows" && settings.flowFilePretty) {
|
||||
|
Reference in New Issue
Block a user