diff --git a/lib/inky.js b/lib/inky.js index ecdf227..2114c4e 100644 --- a/lib/inky.js +++ b/lib/inky.js @@ -86,7 +86,7 @@ Inky.extractRaws = function(string) { var i = 0; var raw; var str = string - var regex = /\< *raw *\>(.*?)\<\/ *raw *\>/i; + var regex = /(?:\n *)?< *raw *>([\s\S]*?)<\/ *raw *>(?: *\n)?/i; while(raw = str.match(regex)) { raws[i] = raw[1]; str = str.replace(regex, '###RAW' + i + '###'); diff --git a/package.json b/package.json index 8e57e50..d6da538 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "babel-register": "^6.4.3", "browserify": "^13.1.0", "chalk": "^1.1.1", - "gulp": "git+https://github.com/gulpjs/gulp.git#4.0", + "gulp": "4.0", "gulp-uglify": "^2.0.0", "mocha": "^2.4.5", "rimraf": "^2.5.1", diff --git a/test/components.js b/test/components.js index b653850..7d4f5d2 100644 --- a/test/components.js +++ b/test/components.js @@ -52,9 +52,7 @@ describe('Center', () => { - +
- -
@@ -442,7 +440,7 @@ describe('h-line', () => { compare(input, expected); }); }); - + describe('raw', () => { it('creates a wrapper that ignores anything inside', () => { var input = `<>`; @@ -450,4 +448,98 @@ describe('raw', () => { compare(input, expected); }); + + + it('works across multiple lines', () => { + var input = ` + + + <> + + + + `; + var expected = ` + + <> + + + `; + + compare(input, expected); + }); + + it('stops at the first tag', () => { + var input = ` + + + <> + + + + + `; + var expected = ` + + <> + + + + + + +
+ + + + + + +
Test
+
+ + + `; + + compare(input, expected); + }); + + it('matches all raw tags', () => { + var first = "<>"; + var second = "more raw content"; + var input = ` + + + ${first} + + + + ${second} + + + ` + var expected = ` + + ${first} + + + + + + +
+ + + + + + +
Test
+
+ ${second} + + ` + + compare(input, expected); + }); }); diff --git a/test/inky.js b/test/inky.js index 05aaa13..322bf3a 100644 --- a/test/inky.js +++ b/test/inky.js @@ -23,7 +23,7 @@ describe('Inky', () => { it('should have an array of component tags', () => { var inky = new Inky(); - assert(Array.isArray(inky.componentTags), 'Inky.zftags is an array'); + assert(Array.isArray(inky.componentTags), 'Inky.componentTags is an array'); }); it(`doesn't choke on inline elements`, () => {