diff --git a/process/Importer_lib/process.js b/process/Importer_lib/process.js index ab241b91420723ab309c943e79039116de38b806..91198fba0e6c755a646f4bf8f4418e534ae0f75e 100644 --- a/process/Importer_lib/process.js +++ b/process/Importer_lib/process.js @@ -10,15 +10,30 @@ import("system.text"); import("ImporterCustomMappingFunctions_lib"); import("ImporterMappingFunctions_lib"); -///////////////////////////////////////////////////////////////////// -/// importer module constructor function /// -/// DO NOT TOUCH - use lib_importerCustomMappingFunctions /// -/////////////////////////////////////////////////////////////////// +/* +┌─────────────────────────────────────────────────────────────┠+│ importer module constructor function │ +│ DO NOT TOUCH - use lib_importerCustomMappingFunctions │ +└─────────────────────────────────────────────────────────────┘ + + + Frequently asked questions: +────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── +Q: Why does the importer have a own versionsystem, if there exists git? +A: Because its a standalone module and there is no modularisation-system right now. + So you may want to update the IMPORTER-module and have to keep an eye on the verison. + +Q: Where can I see the version of the importer? +A: There is a @version-tag in the documentation of the Importer-function (constructor-function for the object) + */ + + /* * the importer class, main object * @param {String []} pConfig req ( Name, FunktionsArt, Details ) * -* @version 2.0 +* @version 2.1 +* * * @return {void} */ @@ -1280,8 +1295,13 @@ function Importer(pConfig) //transform ' to \\u0027 which is in eval a \u0027; transform " to \\u0022 which is in eval a \u0022 //needed for eval like: "'3'2' != ''" + //also escape LF and CR to prevent unterminated string errors + //if the transform of LF and CR cause problems: + //- remove the 2 replaces + //- document in the comment why it should not be used and when it will cause other problems + //- find another solution to prevent the unterminated string errors if(pEvalScript) - return res.replace("'", "\\\\u0027", "g").replace("\"", "\\\\u0022", "g"); + return res.replace("'", "\\\\u0027", "g").replace("\"", "\\\\u0022", "g").replace("\r", "\\\\u000D", "g").replace("\n", "\\\\u000A", "g"); else return res; } @@ -1289,8 +1309,13 @@ function Importer(pConfig) { //transform ' to \\u0027 which is in eval a \u0027; transform " to \\u0022 which is in eval a \u0022 //needed for eval like: "'3'2' != ''" + //also escape LF and CR to prevent unterminated string errors + //if the transform of LF and CR cause problems: + //- remove the 2 replaces + //- document in the comment why it should not be used and when it will cause other problems + //- find another solution to prevent the unterminated string errors if(pEvalScript) - return inp[Number(pNumber)].replace("'", "\\\\u0027", "g").replace("\"", "\\\\u0022", "g"); + return inp[Number(pNumber)].replace("'", "\\\\u0027", "g").replace("\"", "\\\\u0022", "g").replace("\r", "\\\\u000D", "g").replace("\n", "\\\\u000A", "g"); else return inp[Number(pNumber)]; }