diff --git a/packages/core/src/meta.js b/packages/core/src/meta.js index 5a05dfe2..79ba8a86 100644 --- a/packages/core/src/meta.js +++ b/packages/core/src/meta.js @@ -5,7 +5,7 @@ const regex = { }; export default function Meta(ezs, commands) { - const lines = commands.split(/\r\n|\r|\n/); + const lines = commands.split('\\\n').join('').split(/\r\n|\r|\n/); const result = {}; let meta = true; lines.forEach((line) => { @@ -13,7 +13,7 @@ export default function Meta(ezs, commands) { if (regex.param.test(line) && meta) { const match = line.match(regex.param); const paramName = match[1]; - const paramValue = match[2]; + const paramValue = match[2].replace(/\^M/g, '\n'); result[paramName] = paramValue; } else if (regex.section.test(line)) { meta = false; diff --git a/packages/core/test/ezs.js b/packages/core/test/ezs.js index eb4ac226..dff5199c 100644 --- a/packages/core/test/ezs.js +++ b/packages/core/test/ezs.js @@ -852,11 +852,13 @@ describe('Build a pipeline', () => { done(); }); }); - it('Catch meta from script', (done) => { + it('Catch meta from script #1', (done) => { const commands = ` title = Le titre - description = La description + description = \ +La description + summary = Line1 ^M Line2 ^M Line3 [replace] path = a @@ -870,6 +872,7 @@ describe('Build a pipeline', () => { const meta = ezs.metaString(commands); assert.strictEqual(meta.title, 'Le titre'); assert.strictEqual(meta.description, 'La description'); + assert.strictEqual(meta.summary, 'Line1 \n Line2 \n Line3'); done(); });