diff --git a/packages/pug-lexer/test/__snapshots__/index.test.js.snap b/packages/pug-lexer/test/__snapshots__/index.test.js.snap index 962d17d9a..0057877bb 100644 --- a/packages/pug-lexer/test/__snapshots__/index.test.js.snap +++ b/packages/pug-lexer/test/__snapshots__/index.test.js.snap @@ -34270,6 +34270,277 @@ Array [ ] `; +exports[`mixin-block-interpolation.pug 1`] = ` +Array [ + Object { + "args": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, + "type": "mixin", + "val": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, + "type": "indent", + "val": 4, + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 5, + "line": 2, + }, + }, + "type": "tag", + "val": "span", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 10, + "line": 2, + }, + }, + "type": "text", + "val": "This should ", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 22, + "line": 2, + }, + }, + "type": "start-pug-interpolation", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 24, + "line": 2, + }, + }, + "type": "tag", + "val": "block", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 29, + "line": 2, + }, + }, + "type": "end-pug-interpolation", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 30, + "line": 2, + }, + }, + "type": "text", + "val": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, + "type": "tag", + "val": "p", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 7, + "line": 3, + }, + }, + "type": "text", + "val": "Next line", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "outdent", + }, + Object { + "args": "", + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "call", + "val": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, + "type": "indent", + "val": 4, + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 5, + "line": 6, + }, + }, + "type": "tag", + "val": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 7, + "line": 6, + }, + }, + "type": "text", + "val": "work", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 11, + "line": 6, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/mixin-block-interpolation.pug", + "start": Object { + "column": 11, + "line": 6, + }, + }, + "type": "eos", + }, +] +`; + exports[`mixin-block-with-space.pug 1`] = ` Array [ Object { diff --git a/packages/pug-lexer/test/cases/mixin-block-interpolation.pug b/packages/pug-lexer/test/cases/mixin-block-interpolation.pug new file mode 100644 index 000000000..1043d389b --- /dev/null +++ b/packages/pug-lexer/test/cases/mixin-block-interpolation.pug @@ -0,0 +1,6 @@ +mixin a() + span This should #[block] + p Next line + ++a() + b work \ No newline at end of file diff --git a/packages/pug/test/mixin-block-interpolation/__snapshots__/index.test.js.snap b/packages/pug/test/mixin-block-interpolation/__snapshots__/index.test.js.snap new file mode 100644 index 000000000..8a89bc0ff --- /dev/null +++ b/packages/pug/test/mixin-block-interpolation/__snapshots__/index.test.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`mixin block tag interpolation 1`] = ` +"proof that + +

another paragraph

" +`; diff --git a/packages/pug/test/mixin-block-interpolation/index.pug b/packages/pug/test/mixin-block-interpolation/index.pug new file mode 100644 index 000000000..0aa06e9f9 --- /dev/null +++ b/packages/pug/test/mixin-block-interpolation/index.pug @@ -0,0 +1,6 @@ +mixin a() + span proof that #[block] + p another paragraph + ++a() + b this prints \ No newline at end of file diff --git a/packages/pug/test/mixin-block-interpolation/index.test.js b/packages/pug/test/mixin-block-interpolation/index.test.js new file mode 100644 index 000000000..2a3725efe --- /dev/null +++ b/packages/pug/test/mixin-block-interpolation/index.test.js @@ -0,0 +1,9 @@ +const pug = require('../../'); + +test('mixin block tag interpolation', () => { + const output = pug.renderFile( + __dirname + '/index.pug', + {pretty: true} + ); + expect(output).toMatchSnapshot(); +}); \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 01a516311..b6563fed8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5468,7 +5468,7 @@ token-stream@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a" -tough-cookie@>=2.3.4: +tough-cookie@>=2.3.3: version "3.0.1" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" integrity sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==