update initialize & finalize processing of function node

This commit is contained in:
Hiroyasu Nishiyama
2020-04-06 16:34:41 +09:00
parent 84d2b8ad6d
commit 161f6090c1
4 changed files with 248 additions and 157 deletions

View File

@@ -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) {