diff --git a/src/Parser.js b/src/Parser.js index b193718..6c8aeb6 100644 --- a/src/Parser.js +++ b/src/Parser.js @@ -20,7 +20,7 @@ module.exports = class Parser { get tagRegex() { const open = this._config.tag.open , close = this._config.tag.close - , regexMatch = `${open}(.*)${close}(?:\\s)+(.*)` + , regexMatch = `${open}(.*?)${close}(?:\\s)+(.*)` ; const tagRegex = new RegExp(regexMatch, 'sm'); diff --git a/src/Parser.test.js b/src/Parser.test.js index 7faa035..bce51f4 100644 --- a/src/Parser.test.js +++ b/src/Parser.test.js @@ -112,6 +112,16 @@ describe('Parser', () => { expect(results).to.have.property('template-owner').to.equal('octodemo-resources'); expect(results).to.have.property('template-repo').to.equal('tmpl_bookstore_v3'); }); + + it('should parse inputs with markers in the data', () => { + const parser = new Parser('###', '>>', '<<'); + const results = parser.parse(loadFileData('example_with_markers.txt')); + + expect(results).to.have.property('demo-repository-owner').to.equal('octodemo'); + expect(results).to.have.property('template-type').to.equal('repository'); + expect(results).to.have.property('template-owner').to.equal('octodemo-resources'); + expect(results).to.have.property('template-repo').to.equal('Markes: >> is start and is << end'); + }); }); }); diff --git a/src/test_data/example_with_markers.txt b/src/test_data/example_with_markers.txt new file mode 100644 index 0000000..c9e8c61 --- /dev/null +++ b/src/test_data/example_with_markers.txt @@ -0,0 +1,15 @@ +### >>demo-repository-owner<< + +octodemo + +### >>template-type<< + +repository + +### >>template-owner<< + +octodemo-resources + +### >>template-repo<< + +Markes: >> is start and is << end \ No newline at end of file