From 23897f32731ffebae2a7646ed8b50e39020da453 Mon Sep 17 00:00:00 2001
From: Yakima Teng
Date: Sun, 15 Apr 2018 14:20:36 +0800
Subject: [PATCH 01/48] fix typo (#2999)
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2e857c614..404a53a1d 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ Full documentation is at [pugjs.org](https://pugjs.org/)
## Rename from "Jade"
-This project was formerly known as "Jade." However, it has been revealed to us that "Jade" is a registered trademark, and as a result, a rename is needed. After some discussion among the maintainers, **"Pug"** has been chosen as the new name for this project. The next major version will carry "pug" as the package name.
+This project was formerly known as "Jade". However, it has been revealed to us that "Jade" is a registered trademark, and as a result, a rename is needed. After some discussion among the maintainers, **"Pug"** has been chosen as the new name for this project. The next major version will carry "pug" as the package name.
If your package or app currently uses `jade`, don't worry: we have secured permissions to continue to occupy that package name, although all new versions will be released under `pug`.
From 4b50db0365c79a8400a9d48b4ef105ba84c75f2f Mon Sep 17 00:00:00 2001
From: Christopher Pappas
Date: Wed, 2 May 2018 07:58:01 -0700
Subject: [PATCH 02/48] [pug-filters] do not silence errors when attempting to
require filters (#3002)
---
packages/pug-filters/lib/run-filter.js | 46 ++++++++++++--------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/packages/pug-filters/lib/run-filter.js b/packages/pug-filters/lib/run-filter.js
index fdffad338..a0cec0457 100644
--- a/packages/pug-filters/lib/run-filter.js
+++ b/packages/pug-filters/lib/run-filter.js
@@ -8,36 +8,34 @@ var resolve = require('resolve');
module.exports = filter;
function filter(name, str, options, currentDirectory, funcName) {
funcName = funcName || 'render';
- var tr;
+ var trPath;
try {
try {
- tr = require(resolve.sync('jstransformer-' + name, {basedir: currentDirectory || process.cwd()}));
+ trPath = resolve.sync('jstransformer-' + name, {basedir: currentDirectory || process.cwd()});
} catch (ex) {
- tr = require('jstransformer-' + name);
+ trPath = require.resolve('jstransformer-' + name);
}
- tr = jstransformer(tr);
- } catch (ex) {}
- if (tr) {
- // TODO: we may want to add a way for people to separately specify "locals"
- var result = tr[funcName](str, options, options).body;
- if (options && options.minify) {
- try {
- switch (tr.outputFormat) {
- case 'js':
- result = uglify.minify(result, {fromString: true}).code;
- break;
- case 'css':
- result = new CleanCSS().minify(result).styles;
- break;
- }
- } catch (ex) {
- // better to fail to minify than output nothing
- }
- }
- return result;
- } else {
+ } catch (ex) {
var err = new Error('unknown filter ":' + name + '"');
err.code = 'UNKNOWN_FILTER';
throw err;
}
+ var tr = jstransformer(require(trPath));
+ // TODO: we may want to add a way for people to separately specify "locals"
+ var result = tr[funcName](str, options, options).body;
+ if (options && options.minify) {
+ try {
+ switch (tr.outputFormat) {
+ case 'js':
+ result = uglify.minify(result, {fromString: true}).code;
+ break;
+ case 'css':
+ result = new CleanCSS().minify(result).styles;
+ break;
+ }
+ } catch (ex) {
+ // better to fail to minify than output nothing
+ }
+ }
+ return result;
}
From d69c479a11de1a0d9f4c3fc513ec79733c086040 Mon Sep 17 00:00:00 2001
From: Mike Sidorov
Date: Mon, 14 May 2018 13:16:17 +0500
Subject: [PATCH 03/48] toJSON method should be called on object-like values
only (#3006)
---
packages/pug-runtime/index.js | 3 ++-
packages/pug-runtime/test/index.test.js | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/packages/pug-runtime/index.js b/packages/pug-runtime/index.js
index d506ddb28..a156db358 100644
--- a/packages/pug-runtime/index.js
+++ b/packages/pug-runtime/index.js
@@ -132,7 +132,8 @@ function pug_attr(key, val, escaped, terse) {
if (val === true) {
return ' ' + (terse ? key : key + '="' + key + '"');
}
- if (typeof val.toJSON === 'function') {
+ var type = typeof val;
+ if ((type === 'object' || type === 'function') && typeof val.toJSON === 'function') {
val = val.toJSON();
}
if (typeof val !== 'string') {
diff --git a/packages/pug-runtime/test/index.test.js b/packages/pug-runtime/test/index.test.js
index c729b0c82..416489f01 100644
--- a/packages/pug-runtime/test/index.test.js
+++ b/packages/pug-runtime/test/index.test.js
@@ -14,6 +14,12 @@ function addTest(name, fn) {
}
addTest('attr', function (attr) { // (key, val, escaped, terse)
+ var stringToJSON = String.prototype.toJSON;
+
+ String.prototype.toJSON = function() {
+ return JSON.stringify(this);
+ };
+
// Boolean Attributes
expect(attr('key', true, true, true)).toBe(' key');
expect(attr('key', true, false, true)).toBe(' key');
@@ -63,6 +69,8 @@ addTest('attr', function (attr) { // (key, val, escaped, terse)
expect(attr('key', 'foo>bar', false, true)).toBe(' key="foo>bar"');
expect(attr('key', 'foo>bar', true, false)).toBe(' key="foo>bar"');
expect(attr('key', 'foo>bar', false, false)).toBe(' key="foo>bar"');
+
+ String.prototype.toJSON = stringToJSON;
});
addTest('attrs', function (attrs) { // (obj, terse)
From a01694b391a0d95af75aee2a3178aafba60f0826 Mon Sep 17 00:00:00 2001
From: Zearin
Date: Fri, 15 Jun 2018 07:46:00 -0400
Subject: [PATCH 04/48] Update README.md (#3022)
Lots of minor edits for phrasing, grammar, formatting, and clarity.
---
README.md | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index 404a53a1d..338f4f922 100644
--- a/README.md
+++ b/README.md
@@ -21,27 +21,30 @@ Full documentation is at [pugjs.org](https://pugjs.org/)
## Rename from "Jade"
-This project was formerly known as "Jade". However, it has been revealed to us that "Jade" is a registered trademark, and as a result, a rename is needed. After some discussion among the maintainers, **"Pug"** has been chosen as the new name for this project. The next major version will carry "pug" as the package name.
+This project was formerly known as "Jade". However, it was revealed to us that "Jade" is a registered trademark; as a result, a rename was needed. After some discussion among the maintainers, **"Pug"** was chosen as the new name for this project. As of version 2, "pug" is the official package name.
If your package or app currently uses `jade`, don't worry: we have secured permissions to continue to occupy that package name, although all new versions will be released under `pug`.
-Before the renaming, we had already begun working on an incompatible Jade 2.0.0. We have then made it so that this new major version bump will coincide with the rename to Pug. Therefore, upgrading from Jade to Pug will be the same process as upgrading any other package with a major version bump. Currently, Pug 2.0.0 is still in beta stage, and there are several syntactic differences we have deprecated and removed. Such differences are documented at [#2305](https://github.com/pugjs/pug/issues/2305).
+Before the renaming, work had already begun on “Jade 2.0.0”. Therefore, the rename to Pug coincided with the major version bump. As a result, upgrading from Jade to Pug will be the same process as upgrading any other package with a major version bump.
-The website and documentation for Pug are still being updated, but if you are new to Pug, you should get started with the new syntax and install the Pug package on npm.
+The syntax of Pug has several differences, deprecations, and removals compared to its predecessor. These differences are documented in [#2305](https://github.com/pugjs/pug/issues/2305).
+
+The website and documentation for Pug are still being updated. But if you are new to Pug, you should get started with the new syntax and install the Pug package from npm.
## Installation
### Package
-via npm:
+To use Pug in your own JavaScript projects:
```bash
$ npm install pug
```
+
### Command Line
-After installing the latest version of [Node.js](http://nodejs.org/), install with:
+After installing the latest version of [Node.js](http://nodejs.org), install with:
```bash
$ npm install pug-cli -g
@@ -55,7 +58,7 @@ $ pug --help
## Syntax
-Pug is a clean, whitespace sensitive syntax for writing html. Here is a simple example:
+Pug is a clean, whitespace sensitive syntax for writing HTML. Here is a simple example:
```pug
doctype html
@@ -76,7 +79,7 @@ html(lang="en")
strong focus on performance and powerful features.
```
-becomes
+Pug transforms the above to:
```html
@@ -120,11 +123,11 @@ var html = pug.renderFile('filename.pug', merge(options, locals));
- `filename` Used in exceptions, and required when using includes
- `compileDebug` When `false` no debug instrumentation is compiled
- - `pretty` Add pretty-indentation whitespace to output _(false by default)_
+ - `pretty` Add pretty-indentation whitespace to output _(`false` by default)_
## Browser Support
- The latest version of pug can be download for the browser in standalone form from [here](https://pugjs.org/js/pug.js). It only supports the very latest browsers though, and is a large file. It is recommended that you pre-compile your pug templates to JavaScript.
+The latest version of pug can be [downloaded for the browser in standalone form](https://pugjs.org/js/pug.js). It only supports the very latest browsers, though, and is a large file. It is recommended that you pre-compile your pug templates to JavaScript.
To compile a template for use on the client using the command line, do:
@@ -144,7 +147,7 @@ which will produce `filename.js` containing the compiled template.
### Ports in other languages
-Ports with very close syntax, adapted to other languages:
+Ports to other languages, with very close syntax:
- [PHP](https://github.com/pug-php/pug)
- [Java](https://github.com/neuland/jade4j)
@@ -154,12 +157,11 @@ Ports with very close syntax, adapted to other languages:
### Equivalents in other languages
-
-Templates engines available in other languages with a different syntax but a similar philosophy:
+Templates engines for other languages with a different syntax, but a similar philosophy:
- [Scaml for Scala](https://scalate.github.io/scalate/documentation/scaml-reference.html)
- [Slim for Ruby](https://github.com/slim-template/slim) (should not be confused with Slim PHP framework)
- - [HAML for Ruby](http://haml.info/)
+ - [HAML for Ruby](http://haml.info)
### Framework implementations/adapters
@@ -188,7 +190,7 @@ Embedded view engines for frameworks:
- [html2pug](https://github.com/donpark/html2jade) converter
- [pug2php](https://github.com/SE7ENSKY/jade2php) converter
- [Pug Server](https://github.com/ctrlaltdev/pug-server) Ideal for building local prototypes apart from any application
- - [cache-pug-templates](https://github.com/ladjs/cache-pug-templates) Cache Pug templates for [Lad](https://github.com/ladjs/lad)/[Koa](https://github.com/koajs/koa)/[Express](https://github.com/expressjs/express)/[Connect](https://github.com/senchalabs/connect) with [Redis](https://redis.io/)
+ - [cache-pug-templates](https://github.com/ladjs/cache-pug-templates) Cache Pug templates for [Lad](https://github.com/ladjs/lad)/[Koa](https://github.com/koajs/koa)/[Express](https://github.com/expressjs/express)/[Connect](https://github.com/senchalabs/connect) with [Redis](https://redis.io)
## Backers
From 3d8dc15d5898f08303f04bba0fd4d243acc70a88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C5=9Awierk?=
Date: Fri, 27 Jul 2018 09:30:37 +0200
Subject: [PATCH 05/48] Added "files" property to remove redundant files from
packages. (#3038)
---
.npmignore | 15 ---------------
packages/pug-attrs/package.json | 3 +++
packages/pug-code-gen/package.json | 3 +++
packages/pug-filters/package.json | 5 +++++
packages/pug-lexer/package.json | 3 +++
packages/pug-linker/package.json | 3 +++
packages/pug-load/package.json | 3 +++
packages/pug-parser/package.json | 4 ++++
packages/pug-strip-comments/package.json | 3 +++
packages/pug/package.json | 4 ++++
10 files changed, 31 insertions(+), 15 deletions(-)
delete mode 100644 .npmignore
diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index f53cdc557..000000000
--- a/.npmignore
+++ /dev/null
@@ -1,15 +0,0 @@
-test
-support
-benchmarks
-examples
-lib-cov
-coverage
-.gitmodules
-.travis.yml
-History.md
-Makefile
-test/
-support/
-benchmarks/
-examples/
-docs/
diff --git a/packages/pug-attrs/package.json b/packages/pug-attrs/package.json
index 1ec46abb3..430746789 100644
--- a/packages/pug-attrs/package.json
+++ b/packages/pug-attrs/package.json
@@ -10,6 +10,9 @@
"js-stringify": "^1.0.1",
"pug-runtime": "^2.0.4"
},
+ "files": [
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-attrs.git"
diff --git a/packages/pug-code-gen/package.json b/packages/pug-code-gen/package.json
index a1d1644a0..2131ec12c 100644
--- a/packages/pug-code-gen/package.json
+++ b/packages/pug-code-gen/package.json
@@ -15,6 +15,9 @@
"void-elements": "^2.0.1",
"with": "^5.0.0"
},
+ "files": [
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-code-gen.git"
diff --git a/packages/pug-filters/package.json b/packages/pug-filters/package.json
index f4a835966..ab640c0ff 100644
--- a/packages/pug-filters/package.json
+++ b/packages/pug-filters/package.json
@@ -26,6 +26,11 @@
"pug-load": "^2.0.11",
"pug-parser": "^5.0.0"
},
+ "files": [
+ "lib/handle-filters.js",
+ "lib/run-filter.js",
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-filters.git"
diff --git a/packages/pug-lexer/package.json b/packages/pug-lexer/package.json
index 86dde2367..838cc46ed 100644
--- a/packages/pug-lexer/package.json
+++ b/packages/pug-lexer/package.json
@@ -13,6 +13,9 @@
"devDependencies": {
"acorn": "^3.0.4"
},
+ "files": [
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-lexer.git"
diff --git a/packages/pug-linker/package.json b/packages/pug-linker/package.json
index 259825ae4..8a13f270d 100644
--- a/packages/pug-linker/package.json
+++ b/packages/pug-linker/package.json
@@ -14,6 +14,9 @@
"pug-load": "^2.0.11",
"pug-parser": "^5.0.0"
},
+ "files": [
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-linker.git"
diff --git a/packages/pug-load/package.json b/packages/pug-load/package.json
index be30b165b..2f3743890 100644
--- a/packages/pug-load/package.json
+++ b/packages/pug-load/package.json
@@ -13,6 +13,9 @@
"pug-lexer": "^4.0.0",
"pug-parser": "^5.0.0"
},
+ "files": [
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-load.git"
diff --git a/packages/pug-parser/package.json b/packages/pug-parser/package.json
index 9a4a7a9bb..16fc3dc42 100644
--- a/packages/pug-parser/package.json
+++ b/packages/pug-parser/package.json
@@ -12,6 +12,10 @@
"devDependencies": {
"get-repo": "^1.0.0"
},
+ "files": [
+ "lib/inline-tags.js",
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-parser.git"
diff --git a/packages/pug-strip-comments/package.json b/packages/pug-strip-comments/package.json
index 17c7afee7..49d6b7423 100644
--- a/packages/pug-strip-comments/package.json
+++ b/packages/pug-strip-comments/package.json
@@ -11,6 +11,9 @@
"devDependencies": {
"line-json": "^1.0.0"
},
+ "files": [
+ "index.js"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug-strip-comments.git"
diff --git a/packages/pug/package.json b/packages/pug/package.json
index ea0aa4331..e84a4ece3 100644
--- a/packages/pug/package.json
+++ b/packages/pug/package.json
@@ -41,6 +41,10 @@
"rimraf": "^2.2.8",
"uglify-js": "github:mishoo/UglifyJS2#1c15d0db456ce32f1b9b507aad97e5ee5c8285f7"
},
+ "files": [
+ "lib/index.js",
+ "register.js"
+ ],
"browser": {
"fs": false
},
From 2ead38c995a896fe0ff11c9c12f1c1fc25586bcf Mon Sep 17 00:00:00 2001
From: Serge Shkurko
Date: Fri, 3 Aug 2018 12:35:38 +0500
Subject: [PATCH 06/48] #3040 Fix preLex fire support for plugins (#3041)
---
packages/pug/lib/index.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/packages/pug/lib/index.js b/packages/pug/lib/index.js
index 36b40f64d..e76487d2c 100644
--- a/packages/pug/lib/index.js
+++ b/packages/pug/lib/index.js
@@ -96,7 +96,8 @@ function compileBody(str, options){
}).map(function (plugin) {
return plugin.lex;
});
- return applyPlugins(lex(str, lexOptions), options, plugins, 'postLex');
+ var contents = applyPlugins(str, {filename: options.filename}, plugins, 'preLex');
+ return applyPlugins(lex(contents, lexOptions), options, plugins, 'postLex');
},
parse: function (tokens, options) {
tokens = tokens.map(function (token) {
@@ -146,9 +147,8 @@ function compileBody(str, options){
contents = load.read(filename, loadOptions);
}
- var str = applyPlugins(contents, {filename: filename}, plugins, 'preLex');
- debug_sources[filename] = str;
- return str;
+ debug_sources[filename] = contents;
+ return contents;
}
});
ast = applyPlugins(ast, options, plugins, 'postLoad');
From f7df3097cb44ca45297f177d4792a2cad148f1f4 Mon Sep 17 00:00:00 2001
From: Kyle
Date: Wed, 8 Aug 2018 11:10:49 +0200
Subject: [PATCH 07/48] Add missing semicolon (#2919)
---
packages/pug-load/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/pug-load/index.js b/packages/pug-load/index.js
index 9cc5f0cea..9b12d3472 100644
--- a/packages/pug-load/index.js
+++ b/packages/pug-load/index.js
@@ -51,7 +51,7 @@ load.file = function loadFile(filename, options) {
});
var str = options.read(filename);
return load.string(str, options);
-}
+};
load.resolve = function resolve(filename, source, options) {
filename = filename.trim();
From d4f605f14365347a0373ecf72b593ec46e5e7dc7 Mon Sep 17 00:00:00 2001
From: Liam Barry
Date: Fri, 21 Sep 2018 13:49:40 +0100
Subject: [PATCH 08/48] Include apug version in ports (#3053)
Hi!
I have started creating (and progressed quite well) a version of pug for a language called RPG (which runs on an IBM i & also works in C and COBOL) and was wondering if is allowed in the ports section?
Thanks for a great project!
Liam Barry
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 338f4f922..f29d1cbe9 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,7 @@ Ports to other languages, with very close syntax:
- [Python](https://github.com/kakulukia/pypugjs)
- [Ruby](https://github.com/yivo/pug-ruby)
- [C# (ASP.NET Core)](https://github.com/AspNetMonsters/pugzor)
+ - [RPG/ILE](https://github.com/WorksOfLiam/apug)
### Equivalents in other languages
From a1b046321416fc4ab297b43083ccda25ec8959e5 Mon Sep 17 00:00:00 2001
From: Forbes Lindesay
Date: Sat, 22 Sep 2018 10:41:30 +0100
Subject: [PATCH 09/48] Add note about tidelift
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index f29d1cbe9..d471f8d35 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,8 @@ Full documentation is at [pugjs.org](https://pugjs.org/)
For discussion join the [chat room](https://gitter.im/pugjs/pug).
You can test drive Pug online [here](https://pugjs.org/).
+
+ [https://tidelift.com/subscription/pkg/npm-pug?utm_source=npm-pug&utm_medium=referral&utm_campaign=readme](Professionally supported pug is now available)
[](https://travis-ci.org/pugjs/pug)
[](https://coveralls.io/r/pugjs/pug?branch=master)
From 74d26d6c4a5f6002e6d01c10b80248d6c949c1b5 Mon Sep 17 00:00:00 2001
From: Forbes Lindesay
Date: Wed, 24 Oct 2018 19:23:06 +0100
Subject: [PATCH 10/48] Fix tidelift link
I must have been tired
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d471f8d35..cd8fde1ff 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Full documentation is at [pugjs.org](https://pugjs.org/)
You can test drive Pug online [here](https://pugjs.org/).
- [https://tidelift.com/subscription/pkg/npm-pug?utm_source=npm-pug&utm_medium=referral&utm_campaign=readme](Professionally supported pug is now available)
+ [Professionally supported pug is now available](https://tidelift.com/subscription/pkg/npm-pug?utm_source=npm-pug&utm_medium=referral&utm_campaign=readme)
[](https://travis-ci.org/pugjs/pug)
[](https://coveralls.io/r/pugjs/pug?branch=master)
From 6a634943287e0c2385f9b76d81dba97c13a44f03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Denis=20F=C3=A4cke?=
Date: Mon, 11 Feb 2019 12:46:49 +0100
Subject: [PATCH 11/48] chore: update dev dependencies (#3108)
* update lerna
* update jest
* update coveralls
* add node 10 & 11 to travis ci
* removed node 4 from travis ci
---
.travis.yml | 3 +-
lerna.json | 2 +-
package.json | 12 +-
.../__snapshots__/filter-aliases.test.js.snap | 25 +-
.../test/__snapshots__/index.test.js.snap | 1472 ++---
...ons-applied-to-nested-filters.test.js.snap | 9 +-
.../test/__snapshots__/index.test.js.snap | 803 +--
.../test/__snapshots__/index.test.js.snap | 220 +-
.../test/__snapshots__/index.test.js.snap | 8 +-
.../test/__snapshots__/index.test.js.snap | 891 +--
.../no-unnecessary-blocks.test.js.snap | 4 +-
.../test/__snapshots__/index.test.js.snap | 58 +-
.../pug/test/__snapshots__/pug.test.js.snap | 48 +-
.../__snapshots__/index.test.js.snap | 6 +-
.../__snapshots__/index.test.js.snap | 6 +-
.../__snapshots__/index.test.js.snap | 6 +-
yarn.lock | 4945 ++++++++++++-----
17 files changed, 5269 insertions(+), 3249 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c6ddd8e14..39f094817 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,9 @@
language: node_js
node_js:
- - "4"
- "6"
- "8"
+ - "10"
+ - "11"
# Use faster Docker architecture on Travis.
sudo: false
diff --git a/lerna.json b/lerna.json
index 7f5b1c80c..3059f1f32 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "lerna": "2.9.0",
+ "lerna": "3.10.8",
"packages": ["packages/*"],
"npmClient": "yarn",
"useWorkspaces": true,
diff --git a/package.json b/package.json
index f31a0f7b3..4b0777a91 100644
--- a/package.json
+++ b/package.json
@@ -2,9 +2,9 @@
"name": "pug-monorepo",
"private": true,
"devDependencies": {
- "coveralls": "^2.11.2",
- "jest": "^18.1.0",
- "lerna": "2.9.0",
+ "coveralls": "3.0.2",
+ "jest": "24.0.0",
+ "lerna": "3.10.8",
"prettier": "^1.3.1"
},
"repository": {
@@ -18,7 +18,7 @@
"pretest": "lerna run pretest",
"test": "jest",
"coverage": "jest --coverage",
- "coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
+ "coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
"watch": "jest --watch"
},
"jest": {
@@ -29,5 +29,7 @@
]
},
"license": "MIT",
- "workspaces": ["packages/*"]
+ "workspaces": [
+ "packages/*"
+ ]
}
diff --git a/packages/pug-filters/test/__snapshots__/filter-aliases.test.js.snap b/packages/pug-filters/test/__snapshots__/filter-aliases.test.js.snap
index 2130c6572..a4c74bc87 100644
--- a/packages/pug-filters/test/__snapshots__/filter-aliases.test.js.snap
+++ b/packages/pug-filters/test/__snapshots__/filter-aliases.test.js.snap
@@ -1,4 +1,6 @@
-exports[`test filters can be aliased 1`] = `
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`filters can be aliased 1`] = `
Object {
"filename": "/packages/pug-filters/test/filter-aliases.test.js",
"line": 0,
@@ -67,7 +69,10 @@ Object {
"line": 3,
"name": "minify",
"type": "Text",
- "val": "function myFunc(n){return n}",
+ "val": "function myFunc(n) {
+ return n;
+}
+",
},
],
"type": "Block",
@@ -95,7 +100,7 @@ Object {
}
`;
-exports[`test options are applied before aliases 1`] = `
+exports[`options are applied before aliases 1`] = `
Object {
"filename": "/packages/pug-filters/test/filter-aliases.test.js",
"line": 0,
@@ -165,8 +170,9 @@ Object {
"name": "minify",
"type": "Text",
"val": "function myFunc(n) {
- return n;
-}",
+ return n;
+}
+",
},
],
"type": "Block",
@@ -237,7 +243,10 @@ Object {
"line": 7,
"name": "uglify-js",
"type": "Text",
- "val": "function myFunc(n){return n}",
+ "val": "function myFunc(n) {
+ return n;
+}
+",
},
],
"type": "Block",
@@ -265,11 +274,11 @@ Object {
}
`;
-exports[`test we do not support chains of aliases 1`] = `
+exports[`we do not support chains of aliases 1`] = `
Object {
"code": "PUG:FILTER_ALISE_CHAIN",
"message": "/packages/pug-filters/test/filter-aliases.test.js:3:9
-The filter \"minify-js\" is an alias for \"minify\", which is an alias for \"uglify-js\". Pug does not support chains of filter aliases.",
+The filter \\"minify-js\\" is an alias for \\"minify\\", which is an alias for \\"uglify-js\\". Pug does not support chains of filter aliases.",
}
`;
diff --git a/packages/pug-filters/test/__snapshots__/index.test.js.snap b/packages/pug-filters/test/__snapshots__/index.test.js.snap
index 720fd8014..74a2f4559 100644
--- a/packages/pug-filters/test/__snapshots__/index.test.js.snap
+++ b/packages/pug-filters/test/__snapshots__/index.test.js.snap
@@ -1,1072 +1,1074 @@
-exports[`test cases/filters.cdata.input.json 1`] = `
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`cases/filters.cdata.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Code\",
- \"val\": \"users = [{ name: \'tobi\', age: 2 }]\",
- \"buffer\": false,
- \"mustEscape\": false,
- \"isInline\": false,
- \"line\": 2,
- \"filename\": \"filters.cdata.tokens.json\"
+ \\"type\\": \\"Code\\",
+ \\"val\\": \\"users = [{ name: 'tobi', age: 2 }]\\",
+ \\"buffer\\": false,
+ \\"mustEscape\\": false,
+ \\"isInline\\": false,
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.cdata.tokens.json\\"
},
{
- \"type\": \"Tag\",
- \"name\": \"fb:users\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"fb:users\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Each\",
- \"obj\": \"users\",
- \"val\": \"user\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Each\\",
+ \\"obj\\": \\"users\\",
+ \\"val\\": \\"user\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"fb:user\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"fb:user\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"cdata\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"cdata\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"#{user.name}\",
- \"line\": 8
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"#{user.name}\\",
+ \\"line\\": 8
}
]
},
- \"attrs\": [],
- \"line\": 7,
- \"filename\": \"filters.cdata.tokens.json\",
- \"val\": \"\"
+ \\"attrs\\": [],
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.cdata.tokens.json\\",
+ \\"val\\": \\"\\"
}
]
},
- \"attrs\": [
+ \\"attrs\\": [
{
- \"name\": \"age\",
- \"val\": \"user.age\",
- \"mustEscape\": true
+ \\"name\\": \\"age\\",
+ \\"val\\": \\"user.age\\",
+ \\"mustEscape\\": true
}
],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 6,
- \"filename\": \"filters.cdata.tokens.json\"
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 6,
+ \\"filename\\": \\"filters.cdata.tokens.json\\"
}
],
- \"line\": 6,
- \"filename\": \"filters.cdata.tokens.json\"
+ \\"line\\": 6,
+ \\"filename\\": \\"filters.cdata.tokens.json\\"
},
- \"line\": 5,
- \"filename\": \"filters.cdata.tokens.json\"
+ \\"line\\": 5,
+ \\"filename\\": \\"filters.cdata.tokens.json\\"
}
]
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 4,
- \"filename\": \"filters.cdata.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.cdata.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.cdata.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.cdata.tokens.json\\"
}"
`;
-exports[`test cases/filters.coffeescript.input.json 1`] = `
+exports[`cases/filters.coffeescript.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"script\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"script\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"coffee-script\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"coffee-script\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"regexp = /\\\\n/\",
- \"line\": 3
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"regexp = /\\\\\\\\n/\\",
+ \\"line\\": 3
}
],
- \"line\": 2,
- \"filename\": \"filters.coffeescript.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.coffeescript.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 2,
- \"filename\": \"filters.coffeescript.tokens.json\",
- \"val\": \"(function() {\\n var regexp;\\n\\n regexp = /\\\\n/;\\n\\n}).call(this);\\n\"
+ \\"attrs\\": [],
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.coffeescript.tokens.json\\",
+ \\"val\\": \\"(function() {\\\\n var regexp;\\\\n\\\\n regexp = /\\\\\\\\n/;\\\\n\\\\n}).call(this);\\\\n\\"
},
{
- \"type\": \"Text\",
- \"name\": \"coffee-script\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"coffee-script\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"math =\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"math =\\",
+ \\"line\\": 5
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 6
},
{
- \"type\": \"Text\",
- \"val\": \" square: (value) -> value * value\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\" square: (value) -> value * value\\",
+ \\"line\\": 6
}
],
- \"line\": 4,
- \"filename\": \"filters.coffeescript.tokens.json\"
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.coffeescript.tokens.json\\"
},
- \"attrs\": [
+ \\"attrs\\": [
{
- \"name\": \"minify\",
- \"val\": \"true\",
- \"mustEscape\": true
+ \\"name\\": \\"minify\\",
+ \\"val\\": \\"true\\",
+ \\"mustEscape\\": true
}
],
- \"line\": 4,
- \"filename\": \"filters.coffeescript.tokens.json\",
- \"val\": \"(function(){}).call(this);\"
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.coffeescript.tokens.json\\",
+ \\"val\\": \\"(function(){}).call(this);\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.coffeescript.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.coffeescript.tokens.json\\"
},
- \"attrs\": [
+ \\"attrs\\": [
{
- \"name\": \"type\",
- \"val\": \"\'text/javascript\'\",
- \"mustEscape\": true
+ \\"name\\": \\"type\\",
+ \\"val\\": \\"'text/javascript'\\",
+ \\"mustEscape\\": true
}
],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.coffeescript.tokens.json\"
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.coffeescript.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.coffeescript.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.coffeescript.tokens.json\\"
}"
`;
-exports[`test cases/filters.custom.input.json 1`] = `
+exports[`cases/filters.custom.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"html\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"html\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"body\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"body\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"custom\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"custom\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"Line 1\",
- \"line\": 4
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"Line 1\\",
+ \\"line\\": 4
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 5
},
{
- \"type\": \"Text\",
- \"val\": \"Line 2\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"Line 2\\",
+ \\"line\\": 5
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 6
},
{
- \"type\": \"Text\",
- \"val\": \"\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\",
+ \\"line\\": 6
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 7
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 7
},
{
- \"type\": \"Text\",
- \"val\": \"Line 4\",
- \"line\": 7
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"Line 4\\",
+ \\"line\\": 7
}
],
- \"line\": 3,
- \"filename\": \"filters.custom.tokens.json\"
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.custom.tokens.json\\"
},
- \"attrs\": [
+ \\"attrs\\": [
{
- \"name\": \"opt\",
- \"val\": \"\'val\'\",
- \"mustEscape\": true
+ \\"name\\": \\"opt\\",
+ \\"val\\": \\"'val'\\",
+ \\"mustEscape\\": true
},
{
- \"name\": \"num\",
- \"val\": \"2\",
- \"mustEscape\": true
+ \\"name\\": \\"num\\",
+ \\"val\\": \\"2\\",
+ \\"mustEscape\\": true
}
],
- \"line\": 3,
- \"filename\": \"filters.custom.tokens.json\",
- \"val\": \"BEGINLine 1\\nLine 2\\n\\nLine 4END\"
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.custom.tokens.json\\",
+ \\"val\\": \\"BEGINLine 1\\\\nLine 2\\\\n\\\\nLine 4END\\"
}
],
- \"line\": 2,
- \"filename\": \"filters.custom.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.custom.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 2,
- \"filename\": \"filters.custom.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.custom.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.custom.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.custom.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.custom.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.custom.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.custom.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.custom.tokens.json\\"
}"
`;
-exports[`test cases/filters.include.custom.input.json 1`] = `
+exports[`cases/filters.include.custom.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"html\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"html\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"body\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"body\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"pre\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"pre\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"line\": 4,
- \"filename\": \"filters.include.custom.tokens.json\",
- \"val\": \"BEGINhtml\\n body\\n pre\\n include:custom(opt=\'val\' num=2) filters.include.custom.pug\\nEND\"
+ \\"type\\": \\"Text\\",
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\",
+ \\"val\\": \\"BEGINhtml\\\\n body\\\\n pre\\\\n include:custom(opt='val' num=2) filters.include.custom.pug\\\\nEND\\"
}
],
- \"line\": 3,
- \"filename\": \"filters.include.custom.tokens.json\"
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 3,
- \"filename\": \"filters.include.custom.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\"
}
],
- \"line\": 2,
- \"filename\": \"filters.include.custom.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 2,
- \"filename\": \"filters.include.custom.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.include.custom.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.include.custom.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.include.custom.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.include.custom.tokens.json\\"
}"
`;
-exports[`test cases/filters.include.input.json 1`] = `
+exports[`cases/filters.include.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"html\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"html\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"body\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"body\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"line\": 3,
- \"filename\": \"filters.include.tokens.json\",
- \"val\": \"Just some markdown tests.
\\nWith new line.
\\n\"
+ \\"type\\": \\"Text\\",
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.include.tokens.json\\",
+ \\"val\\": \\"Just some markdown tests.
\\\\nWith new line.
\\\\n\\"
},
{
- \"type\": \"Tag\",
- \"name\": \"script\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"script\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"line\": 5,
- \"filename\": \"filters.include.tokens.json\",
- \"val\": \"(function(){}).call(this);\"
+ \\"type\\": \\"Text\\",
+ \\"line\\": 5,
+ \\"filename\\": \\"filters.include.tokens.json\\",
+ \\"val\\": \\"(function(){}).call(this);\\"
}
],
- \"line\": 4,
- \"filename\": \"filters.include.tokens.json\"
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.include.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 4,
- \"filename\": \"filters.include.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.include.tokens.json\\"
},
{
- \"type\": \"Tag\",
- \"name\": \"script\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"script\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"line\": 7,
- \"filename\": \"filters.include.tokens.json\",
- \"val\": \"\"
+ \\"type\\": \\"Text\\",
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.include.tokens.json\\",
+ \\"val\\": \\"\\"
}
],
- \"line\": 6,
- \"filename\": \"filters.include.tokens.json\"
+ \\"line\\": 6,
+ \\"filename\\": \\"filters.include.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 6,
- \"filename\": \"filters.include.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 6,
+ \\"filename\\": \\"filters.include.tokens.json\\"
}
],
- \"line\": 2,
- \"filename\": \"filters.include.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.include.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 2,
- \"filename\": \"filters.include.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.include.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.include.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.include.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.include.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.include.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.include.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.include.tokens.json\\"
}"
`;
-exports[`test cases/filters.inline.input.json 1`] = `
+exports[`cases/filters.inline.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"p\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"p\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"before \",
- \"line\": 1,
- \"filename\": \"filters.inline.tokens.json\"
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"before \\",
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.inline.tokens.json\\"
},
{
- \"type\": \"Text\",
- \"name\": \"cdata\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"cdata\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"inside\",
- \"line\": 1,
- \"filename\": \"filters.inline.tokens.json\"
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"inside\\",
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.inline.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.inline.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.inline.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 1,
- \"filename\": \"filters.inline.tokens.json\",
- \"val\": \"\"
+ \\"attrs\\": [],
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.inline.tokens.json\\",
+ \\"val\\": \\"\\"
},
{
- \"type\": \"Text\",
- \"val\": \" after\",
- \"line\": 1,
- \"filename\": \"filters.inline.tokens.json\"
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\" after\\",
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.inline.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.inline.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.inline.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.inline.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.inline.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.inline.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.inline.tokens.json\\"
}"
`;
-exports[`test cases/filters.less.input.json 1`] = `
+exports[`cases/filters.less.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"html\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"html\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"head\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"head\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"style\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"style\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"less\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"less\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"@pad: 15px;\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"@pad: 15px;\\",
+ \\"line\\": 5
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 6
},
{
- \"type\": \"Text\",
- \"val\": \"body {\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"body {\\",
+ \\"line\\": 6
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 7
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 7
},
{
- \"type\": \"Text\",
- \"val\": \" padding: @pad;\",
- \"line\": 7
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\" padding: @pad;\\",
+ \\"line\\": 7
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 8
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 8
},
{
- \"type\": \"Text\",
- \"val\": \"}\",
- \"line\": 8
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"}\\",
+ \\"line\\": 8
}
],
- \"line\": 4,
- \"filename\": \"filters.less.tokens.json\"
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.less.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 4,
- \"filename\": \"filters.less.tokens.json\",
- \"val\": \"body {\\n padding: 15px;\\n}\\n\"
+ \\"attrs\\": [],
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.less.tokens.json\\",
+ \\"val\\": \\"body {\\\\n padding: 15px;\\\\n}\\\\n\\"
}
],
- \"line\": 3,
- \"filename\": \"filters.less.tokens.json\"
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.less.tokens.json\\"
},
- \"attrs\": [
+ \\"attrs\\": [
{
- \"name\": \"type\",
- \"val\": \"\\\"text/css\\\"\",
- \"mustEscape\": true
+ \\"name\\": \\"type\\",
+ \\"val\\": \\"\\\\\\"text/css\\\\\\"\\",
+ \\"mustEscape\\": true
}
],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 3,
- \"filename\": \"filters.less.tokens.json\"
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.less.tokens.json\\"
}
],
- \"line\": 2,
- \"filename\": \"filters.less.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.less.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 2,
- \"filename\": \"filters.less.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.less.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.less.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.less.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.less.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.less.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.less.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.less.tokens.json\\"
}"
`;
-exports[`test cases/filters.markdown.input.json 1`] = `
+exports[`cases/filters.markdown.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"html\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"html\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"body\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"body\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"markdown-it\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"markdown-it\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"This is _some_ awesome **markdown**\",
- \"line\": 4
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"This is _some_ awesome **markdown**\\",
+ \\"line\\": 4
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 5
},
{
- \"type\": \"Text\",
- \"val\": \"whoop.\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"whoop.\\",
+ \\"line\\": 5
}
],
- \"line\": 3,
- \"filename\": \"filters.markdown.tokens.json\"
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.markdown.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 3,
- \"filename\": \"filters.markdown.tokens.json\",
- \"val\": \"This is some awesome markdown\\nwhoop.
\\n\"
+ \\"attrs\\": [],
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.markdown.tokens.json\\",
+ \\"val\\": \\"This is some awesome markdown\\\\nwhoop.
\\\\n\\"
}
],
- \"line\": 2,
- \"filename\": \"filters.markdown.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.markdown.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 2,
- \"filename\": \"filters.markdown.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.markdown.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.markdown.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.markdown.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.markdown.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.markdown.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.markdown.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.markdown.tokens.json\\"
}"
`;
-exports[`test cases/filters.nested.input.json 1`] = `
+exports[`cases/filters.nested.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"script\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"script\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"cdata\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"cdata\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"uglify-js\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"uglify-js\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"(function() {\",
- \"line\": 3
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"(function() {\\",
+ \\"line\\": 3
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 4
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 4
},
{
- \"type\": \"Text\",
- \"val\": \" console.log(\'test\')\",
- \"line\": 4
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\" console.log('test')\\",
+ \\"line\\": 4
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 5
},
{
- \"type\": \"Text\",
- \"val\": \"})()\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"})()\\",
+ \\"line\\": 5
}
],
- \"line\": 2,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 2,
- \"filename\": \"filters.nested.tokens.json\",
- \"val\": \"!function(){console.log(\\\"test\\\")}();\"
+ \\"attrs\\": [],
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.nested.tokens.json\\",
+ \\"val\\": \\"!function(){console.log(\\\\\\"test\\\\\\")}();\\"
}
],
- \"line\": 2,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 2,
- \"filename\": \"filters.nested.tokens.json\",
- \"val\": \"\"
+ \\"attrs\\": [],
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.nested.tokens.json\\",
+ \\"val\\": \\"\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
{
- \"type\": \"Tag\",
- \"name\": \"script\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"script\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"cdata\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"cdata\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"uglify-js\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"uglify-js\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"coffee-script\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"coffee-script\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"(->\",
- \"line\": 8
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"(->\\",
+ \\"line\\": 8
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 9
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 9
},
{
- \"type\": \"Text\",
- \"val\": \" console.log \'test\'\",
- \"line\": 9
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\" console.log 'test'\\",
+ \\"line\\": 9
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 10
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 10
},
{
- \"type\": \"Text\",
- \"val\": \")()\",
- \"line\": 10
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\")()\\",
+ \\"line\\": 10
}
],
- \"line\": 7,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 7,
- \"filename\": \"filters.nested.tokens.json\",
- \"val\": \"(function() {\\n (function() {\\n return console.log(\'test\');\\n })();\\n\\n}).call(this);\\n\"
+ \\"attrs\\": [],
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.nested.tokens.json\\",
+ \\"val\\": \\"(function() {\\\\n (function() {\\\\n return console.log('test');\\\\n })();\\\\n\\\\n}).call(this);\\\\n\\"
}
],
- \"line\": 7,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 7,
- \"filename\": \"filters.nested.tokens.json\",
- \"val\": \"(function(){!function(){console.log(\\\"test\\\")}()}).call(this);\"
+ \\"attrs\\": [],
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.nested.tokens.json\\",
+ \\"val\\": \\"(function(){!function(){console.log(\\\\\\"test\\\\\\")}()}).call(this);\\"
}
],
- \"line\": 7,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 7,
- \"filename\": \"filters.nested.tokens.json\",
- \"val\": \"\"
+ \\"attrs\\": [],
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.nested.tokens.json\\",
+ \\"val\\": \\"\\"
}
],
- \"line\": 6,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 6,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 6,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 6,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.nested.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.nested.tokens.json\\"
}"
`;
-exports[`test cases/filters.stylus.input.json 1`] = `
+exports[`cases/filters.stylus.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"html\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"html\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"head\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"head\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"style\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"style\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"stylus\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"stylus\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"val\": \"body\",
- \"line\": 5
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"body\\",
+ \\"line\\": 5
},
{
- \"type\": \"Text\",
- \"val\": \"\\n\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\"\\\\n\\",
+ \\"line\\": 6
},
{
- \"type\": \"Text\",
- \"val\": \" padding: 50px\",
- \"line\": 6
+ \\"type\\": \\"Text\\",
+ \\"val\\": \\" padding: 50px\\",
+ \\"line\\": 6
}
],
- \"line\": 4,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 4,
- \"filename\": \"filters.stylus.tokens.json\",
- \"val\": \"body {\\n padding: 50px;\\n}\\n\"
+ \\"attrs\\": [],
+ \\"line\\": 4,
+ \\"filename\\": \\"filters.stylus.tokens.json\\",
+ \\"val\\": \\"body {\\\\n padding: 50px;\\\\n}\\\\n\\"
}
],
- \"line\": 3,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
},
- \"attrs\": [
+ \\"attrs\\": [
{
- \"name\": \"type\",
- \"val\": \"\\\"text/css\\\"\",
- \"mustEscape\": true
+ \\"name\\": \\"type\\",
+ \\"val\\": \\"\\\\\\"text/css\\\\\\"\\",
+ \\"mustEscape\\": true
}
],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 3,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 3,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
}
],
- \"line\": 2,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 2,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 2,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
},
{
- \"type\": \"Tag\",
- \"name\": \"body\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [],
- \"line\": 7,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"body\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [],
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 7,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 7,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
}
],
- \"line\": 1,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters.stylus.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters.stylus.tokens.json\\"
}"
`;
-exports[`test cases/filters-empty.input.json 1`] = `
+exports[`cases/filters-empty.input.json 1`] = `
"{
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Code\",
- \"val\": \"var users = [{ name: \'tobi\', age: 2 }]\",
- \"buffer\": false,
- \"mustEscape\": false,
- \"isInline\": false,
- \"line\": 1,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"type\\": \\"Code\\",
+ \\"val\\": \\"var users = [{ name: 'tobi', age: 2 }]\\",
+ \\"buffer\\": false,
+ \\"mustEscape\\": false,
+ \\"isInline\\": false,
+ \\"line\\": 1,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
},
{
- \"type\": \"Tag\",
- \"name\": \"fb:users\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"fb:users\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Each\",
- \"obj\": \"users\",
- \"val\": \"user\",
- \"key\": null,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Each\\",
+ \\"obj\\": \\"users\\",
+ \\"val\\": \\"user\\",
+ \\"key\\": null,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Tag\",
- \"name\": \"fb:user\",
- \"selfClosing\": false,
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [
+ \\"type\\": \\"Tag\\",
+ \\"name\\": \\"fb:user\\",
+ \\"selfClosing\\": false,
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [
{
- \"type\": \"Text\",
- \"name\": \"cdata\",
- \"block\": {
- \"type\": \"Block\",
- \"nodes\": [],
- \"line\": 6,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"type\\": \\"Text\\",
+ \\"name\\": \\"cdata\\",
+ \\"block\\": {
+ \\"type\\": \\"Block\\",
+ \\"nodes\\": [],
+ \\"line\\": 6,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
},
- \"attrs\": [],
- \"line\": 6,
- \"filename\": \"filters-empty.tokens.json\",
- \"val\": \"\"
+ \\"attrs\\": [],
+ \\"line\\": 6,
+ \\"filename\\": \\"filters-empty.tokens.json\\",
+ \\"val\\": \\"\\"
}
],
- \"line\": 5,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"line\\": 5,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
},
- \"attrs\": [
+ \\"attrs\\": [
{
- \"name\": \"age\",
- \"val\": \"user.age\",
- \"mustEscape\": true
+ \\"name\\": \\"age\\",
+ \\"val\\": \\"user.age\\",
+ \\"mustEscape\\": true
}
],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 5,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 5,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
}
],
- \"line\": 5,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"line\\": 5,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
},
- \"line\": 4,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"line\\": 4,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
}
],
- \"line\": 3,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"line\\": 3,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
},
- \"attrs\": [],
- \"attributeBlocks\": [],
- \"isInline\": false,
- \"line\": 3,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"attrs\\": [],
+ \\"attributeBlocks\\": [],
+ \\"isInline\\": false,
+ \\"line\\": 3,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
}
],
- \"line\": 0,
- \"filename\": \"filters-empty.tokens.json\"
+ \\"line\\": 0,
+ \\"filename\\": \\"filters-empty.tokens.json\\"
}"
`;
-exports[`test errors/dynamic-option.input.json 1`] = `
+exports[`errors/dynamic-option.input.json 1`] = `
Object {
"code": "PUG:FILTER_OPTION_NOT_CONSTANT",
"line": 2,
- "msg": "\"opt\" is not constant. All filters are rendered compile-time so filter options must be constants.",
+ "msg": "\\"opt\\" is not constant. All filters are rendered compile-time so filter options must be constants.",
}
`;
diff --git a/packages/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap b/packages/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap
index c64988ced..b69c7cbba 100644
--- a/packages/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap
+++ b/packages/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap
@@ -1,4 +1,6 @@
-exports[`test per filter options are applied, even to nested filters 1`] = `
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`per filter options are applied, even to nested filters 1`] = `
Object {
"filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js",
"line": 0,
@@ -68,8 +70,9 @@ Object {
"name": "uglify-js",
"type": "Text",
"val": "function myFunc(n) {
- return n;
-}",
+ return n;
+}
+",
},
],
"type": "Block",
diff --git a/packages/pug-lexer/test/__snapshots__/index.test.js.snap b/packages/pug-lexer/test/__snapshots__/index.test.js.snap
index 0484b309b..962d17d9a 100644
--- a/packages/pug-lexer/test/__snapshots__/index.test.js.snap
+++ b/packages/pug-lexer/test/__snapshots__/index.test.js.snap
@@ -1,4 +1,6 @@
-exports[`test attr-es2015.pug 1`] = `
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`attr-es2015.pug 1`] = `
Array [
Object {
"buffer": false,
@@ -15,7 +17,7 @@ Array [
},
"mustEscape": false,
"type": "code",
- "val": "var avatar = \'219b77f9d21de75e81851b6b886057c7\'",
+ "val": "var avatar = '219b77f9d21de75e81851b6b886057c7'",
},
Object {
"loc": Object {
@@ -137,7 +139,7 @@ Array [
]
`;
-exports[`test attribute-invalid-expression.pug 1`] = `
+exports[`attribute-invalid-expression.pug 1`] = `
Object {
"code": "PUG:SYNTAX_ERROR",
"column": 5,
@@ -146,7 +148,7 @@ Object {
}
`;
-exports[`test attrs.js.pug 1`] = `
+exports[`attrs.js.pug 1`] = `
Array [
Object {
"buffer": false,
@@ -194,7 +196,10 @@ Array [
},
"mustEscape": false,
"type": "code",
- "val": "function answer() { return 42; }",
+ "val": "function answer() {
+ return 42;
+}
+",
},
Object {
"loc": Object {
@@ -254,7 +259,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"loc": Object {
@@ -271,7 +276,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "\'button\'",
+ "val": "'button'",
},
Object {
"loc": Object {
@@ -345,7 +350,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"loc": Object {
@@ -362,7 +367,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "\'button\'",
+ "val": "'button'",
},
Object {
"loc": Object {
@@ -436,7 +441,7 @@ Array [
"mustEscape": true,
"name": "key",
"type": "attribute",
- "val": "\'answer\'",
+ "val": "'answer'",
},
Object {
"loc": Object {
@@ -527,7 +532,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
Object {
"loc": Object {
@@ -616,7 +621,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
Object {
"loc": Object {
@@ -690,7 +695,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"loc": Object {
@@ -707,7 +712,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "\'button\'",
+ "val": "'button'",
},
Object {
"loc": Object {
@@ -781,7 +786,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"loc": Object {
@@ -798,7 +803,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "\'button\'",
+ "val": "'button'",
},
Object {
"loc": Object {
@@ -872,7 +877,7 @@ Array [
"mustEscape": true,
"name": "key",
"type": "attribute",
- "val": "\'answer\'",
+ "val": "'answer'",
},
Object {
"loc": Object {
@@ -963,7 +968,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
Object {
"loc": Object {
@@ -1052,7 +1057,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
Object {
"loc": Object {
@@ -1155,7 +1160,7 @@ Array [
},
},
"type": "&attributes",
- "val": "{foo: \'bar\'}",
+ "val": "{foo: 'bar'}",
},
Object {
"loc": Object {
@@ -1292,7 +1297,7 @@ Array [
},
},
"type": "&attributes",
- "val": "{baz: \'baz\'}",
+ "val": "{baz: 'baz'}",
},
Object {
"loc": Object {
@@ -1325,7 +1330,7 @@ Array [
]
`;
-exports[`test attrs.pug 1`] = `
+exports[`attrs.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -1371,7 +1376,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/contact\'",
+ "val": "'/contact'",
},
Object {
"loc": Object {
@@ -1460,7 +1465,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/save\'",
+ "val": "'/save'",
},
Object {
"loc": Object {
@@ -1672,7 +1677,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\'foo, bar, baz\'",
+ "val": "'foo, bar, baz'",
},
Object {
"loc": Object {
@@ -1763,7 +1768,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\'((foo))\'",
+ "val": "'((foo))'",
},
Object {
"loc": Object {
@@ -1884,7 +1889,7 @@ Array [
"mustEscape": true,
"name": "value",
"type": "attribute",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"loc": Object {
@@ -2007,7 +2012,7 @@ Array [
"mustEscape": true,
"name": "value",
"type": "attribute",
- "val": "\'bar\'",
+ "val": "'bar'",
},
Object {
"loc": Object {
@@ -2096,7 +2101,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\"class:\"",
+ "val": "\\"class:\\"",
},
Object {
"loc": Object {
@@ -2170,7 +2175,7 @@ Array [
"mustEscape": true,
"name": "pattern",
"type": "attribute",
- "val": "\'\\\\S+\'",
+ "val": "'\\\\\\\\S+'",
},
Object {
"loc": Object {
@@ -2244,7 +2249,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/contact\'",
+ "val": "'/contact'",
},
Object {
"loc": Object {
@@ -2333,7 +2338,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'/save\'",
+ "val": "'/save'",
},
Object {
"loc": Object {
@@ -2545,7 +2550,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\'foo, bar, baz\'",
+ "val": "'foo, bar, baz'",
},
Object {
"loc": Object {
@@ -2636,7 +2641,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\'((foo))\'",
+ "val": "'((foo))'",
},
Object {
"loc": Object {
@@ -2757,7 +2762,7 @@ Array [
"mustEscape": true,
"name": "value",
"type": "attribute",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"loc": Object {
@@ -2880,7 +2885,7 @@ Array [
"mustEscape": true,
"name": "value",
"type": "attribute",
- "val": "\'bar\'",
+ "val": "'bar'",
},
Object {
"loc": Object {
@@ -2969,7 +2974,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\"class:\"",
+ "val": "\\"class:\\"",
},
Object {
"loc": Object {
@@ -3043,7 +3048,7 @@ Array [
"mustEscape": true,
"name": "pattern",
"type": "attribute",
- "val": "\'\\\\S+\'",
+ "val": "'\\\\\\\\S+'",
},
Object {
"loc": Object {
@@ -3117,7 +3122,7 @@ Array [
"mustEscape": true,
"name": "terse",
"type": "attribute",
- "val": "\"true\"",
+ "val": "\\"true\\"",
},
Object {
"loc": Object {
@@ -3782,7 +3787,7 @@ Array [
},
"mustEscape": false,
"type": "code",
- "val": "var attrs = {foo: \'bar\', bar: \'\'}",
+ "val": "var attrs = {foo: 'bar', bar: ''}",
},
Object {
"loc": Object {
@@ -3886,7 +3891,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"loc": Object {
@@ -3903,7 +3908,7 @@ Array [
"mustEscape": true,
"name": "bar",
"type": "attribute",
- "val": "\"bar\"",
+ "val": "\\"bar\\"",
},
Object {
"loc": Object {
@@ -3977,7 +3982,7 @@ Array [
"mustEscape": true,
"name": "foo",
"type": "attribute",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"loc": Object {
@@ -3994,7 +3999,7 @@ Array [
"mustEscape": true,
"name": "bar",
"type": "attribute",
- "val": "\'bar\'",
+ "val": "'bar'",
},
Object {
"loc": Object {
@@ -4041,7 +4046,7 @@ Array [
]
`;
-exports[`test attrs.unescaped.pug 1`] = `
+exports[`attrs.unescaped.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -4087,7 +4092,7 @@ Array [
"mustEscape": true,
"name": "type",
"type": "attribute",
- "val": "\'text/x-template\'",
+ "val": "'text/x-template'",
},
Object {
"loc": Object {
@@ -4162,7 +4167,7 @@ Array [
"mustEscape": false,
"name": "id",
"type": "attribute",
- "val": "\'user-<%= user.id %>\'",
+ "val": "'user-<%= user.id %>'",
},
Object {
"loc": Object {
@@ -4268,7 +4273,7 @@ Array [
]
`;
-exports[`test attrs-data.pug 1`] = `
+exports[`attrs-data.pug 1`] = `
Array [
Object {
"buffer": false,
@@ -4285,7 +4290,7 @@ Array [
},
"mustEscape": false,
"type": "code",
- "val": "var user = { name: \'tobi\' }",
+ "val": "var user = { name: 'tobi' }",
},
Object {
"loc": Object {
@@ -4493,7 +4498,7 @@ Array [
"mustEscape": true,
"name": "data-username",
"type": "attribute",
- "val": "\'tobi\'",
+ "val": "'tobi'",
},
Object {
"loc": Object {
@@ -4567,7 +4572,7 @@ Array [
"mustEscape": true,
"name": "data-escaped",
"type": "attribute",
- "val": "{message: \"Let\'s rock!\"}",
+ "val": "{message: \\"Let's rock!\\"}",
},
Object {
"loc": Object {
@@ -4641,7 +4646,7 @@ Array [
"mustEscape": true,
"name": "data-ampersand",
"type": "attribute",
- "val": "{message: \"a quote: " this & that\"}",
+ "val": "{message: \\"a quote: " this & that\\"}",
},
Object {
"loc": Object {
@@ -4762,7 +4767,7 @@ Array [
]
`;
-exports[`test basic.pug 1`] = `
+exports[`basic.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -4899,7 +4904,7 @@ Array [
]
`;
-exports[`test blanks.pug 1`] = `
+exports[`blanks.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -5094,7 +5099,7 @@ Array [
]
`;
-exports[`test block-code.pug 1`] = `
+exports[`block-code.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -5137,7 +5142,7 @@ Array [
},
},
"type": "text",
- "val": "list = [\"uno\", \"dos\", \"tres\",",
+ "val": "list = [\\"uno\\", \\"dos\\", \\"tres\\",",
},
Object {
"loc": Object {
@@ -5166,7 +5171,7 @@ Array [
},
},
"type": "text",
- "val": " \"cuatro\", \"cinco\", \"seis\"];",
+ "val": " \\"cuatro\\", \\"cinco\\", \\"seis\\"];",
},
Object {
"loc": Object {
@@ -5507,7 +5512,7 @@ Array [
]
`;
-exports[`test block-expansion.pug 1`] = `
+exports[`block-expansion.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -5612,7 +5617,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'#\'",
+ "val": "'#'",
},
Object {
"loc": Object {
@@ -5730,7 +5735,7 @@ Array [
"mustEscape": true,
"name": "href",
"type": "attribute",
- "val": "\'#\'",
+ "val": "'#'",
},
Object {
"loc": Object {
@@ -5822,7 +5827,7 @@ Array [
]
`;
-exports[`test block-expansion.shorthands.pug 1`] = `
+exports[`block-expansion.shorthands.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -5988,7 +5993,7 @@ Array [
]
`;
-exports[`test blockquote.pug 1`] = `
+exports[`blockquote.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -6140,7 +6145,7 @@ Array [
]
`;
-exports[`test blocks-in-blocks.pug 1`] = `
+exports[`blocks-in-blocks.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -6277,7 +6282,7 @@ Array [
]
`;
-exports[`test blocks-in-if.pug 1`] = `
+exports[`blocks-in-if.pug 1`] = `
Array [
Object {
"buffer": false,
@@ -6686,7 +6691,7 @@ Array [
"mustEscape": true,
"name": "charset",
"type": "attribute",
- "val": "\'utf8\'",
+ "val": "'utf8'",
},
Object {
"loc": Object {
@@ -6938,7 +6943,7 @@ Array [
]
`;
-exports[`test case.pug 1`] = `
+exports[`case.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -7609,7 +7614,7 @@ Array [
},
"mustEscape": false,
"type": "code",
- "val": "var friend = \'Tim:G\'",
+ "val": "var friend = 'Tim:G'",
},
Object {
"loc": Object {
@@ -7668,7 +7673,7 @@ Array [
},
},
"type": "when",
- "val": "\'Tim:G\'",
+ "val": "'Tim:G'",
},
Object {
"loc": Object {
@@ -7741,7 +7746,7 @@ Array [
},
},
"type": "when",
- "val": "{tim: \'g\'}",
+ "val": "{tim: 'g'}",
},
Object {
"loc": Object {
@@ -7846,7 +7851,7 @@ Array [
]
`;
-exports[`test case-blocks.pug 1`] = `
+exports[`case-blocks.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -8281,7 +8286,7 @@ Array [
]
`;
-exports[`test case-with-invalid-expression.pug 1`] = `
+exports[`case-with-invalid-expression.pug 1`] = `
Object {
"code": "PUG:SYNTAX_ERROR",
"column": 22,
@@ -8290,7 +8295,7 @@ Object {
}
`;
-exports[`test case-with-no-expression.pug 1`] = `
+exports[`case-with-no-expression.pug 1`] = `
Object {
"code": "PUG:NO_CASE_EXPRESSION",
"column": 5,
@@ -8299,7 +8304,7 @@ Object {
}
`;
-exports[`test classes.pug 1`] = `
+exports[`classes.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -8345,7 +8350,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "[\'foo\', \'bar\', \'baz\']",
+ "val": "['foo', 'bar', 'baz']",
},
Object {
"loc": Object {
@@ -8434,7 +8439,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "\'bar\'",
+ "val": "'bar'",
},
Object {
"loc": Object {
@@ -8702,7 +8707,7 @@ Array [
]
`;
-exports[`test classes-empty.pug 1`] = `
+exports[`classes-empty.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -8748,7 +8753,7 @@ Array [
"mustEscape": true,
"name": "class",
"type": "attribute",
- "val": "\'\'",
+ "val": "''",
},
Object {
"loc": Object {
@@ -8929,7 +8934,7 @@ Array [
]
`;
-exports[`test code.conditionals.pug 1`] = `
+exports[`code.conditionals.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -9677,7 +9682,7 @@ Array [
},
},
"type": "if",
- "val": "\'nested\'",
+ "val": "'nested'",
},
Object {
"loc": Object {
@@ -9707,7 +9712,7 @@ Array [
},
},
"type": "if",
- "val": "\'works\'",
+ "val": "'works'",
},
Object {
"loc": Object {
@@ -10211,7 +10216,7 @@ Array [
]
`;
-exports[`test code.escape.pug 1`] = `
+exports[`code.escape.pug 1`] = `
Array [
Object {
"loc": Object {
@@ -10243,7 +10248,7 @@ Array [
},
"mustEscape": true,
"type": "code",
- "val": "\'
",
},
@@ -1530,7 +1532,7 @@ Object {
Object {
"mustEscape": true,
"name": "type",
- "val": "\"text/javascript\"",
+ "val": "\\"text/javascript\\"",
},
],
"block": Object {
@@ -1540,11 +1542,11 @@ Object {
Object {
"type": "Text",
"val": "var STRING_SUBSTITUTIONS = { // table of character substitutions
- \'\\t\': \'\\\\t\',
- \'\\r\': \'\\\\r\',
- \'\\n\': \'\\\\n\',
- \'\"\' : \'\\\\\"\',
- \'\\\\\': \'\\\\\\\\\'
+ '\\\\t': '\\\\\\\\t',
+ '\\\\r': '\\\\\\\\r',
+ '\\\\n': '\\\\\\\\n',
+ '\\"' : '\\\\\\\\\\"',
+ '\\\\\\\\': '\\\\\\\\\\\\\\\\'
};",
},
],
@@ -1594,7 +1596,7 @@ Object {
"nodes": Array [
Object {
"type": "Text",
- "val": "var x = \"\\n here is some \\n new lined text\";
+ "val": "var x = \\"\\\\n here is some \\\\n new lined text\\";
",
},
],
@@ -1648,7 +1650,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -1670,7 +1672,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -1692,7 +1694,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -1714,7 +1716,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -1736,7 +1738,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -1780,7 +1782,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -1802,7 +1804,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -1824,7 +1826,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -1846,7 +1848,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -1868,7 +1870,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -1953,7 +1955,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -1975,7 +1977,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -1997,7 +1999,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -2019,7 +2021,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -2041,7 +2043,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -2085,7 +2087,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -2107,7 +2109,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -2129,7 +2131,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -2151,7 +2153,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -2173,7 +2175,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -2248,12 +2250,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'last\'",
+ "val": "'last'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'prepend\'",
+ "val": "'prepend'",
},
],
"block": Object {
@@ -2282,12 +2284,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'first\'",
+ "val": "'first'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'prepend\'",
+ "val": "'prepend'",
},
],
"block": Object {
@@ -2316,7 +2318,7 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'content\'",
+ "val": "'content'",
},
],
"block": Object {
@@ -2345,12 +2347,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'first\'",
+ "val": "'first'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'append\'",
+ "val": "'append'",
},
],
"block": Object {
@@ -2379,12 +2381,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'last\'",
+ "val": "'last'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'append\'",
+ "val": "'append'",
},
],
"block": Object {
@@ -2421,12 +2423,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'last\'",
+ "val": "'last'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'prepend\'",
+ "val": "'prepend'",
},
],
"block": Object {
@@ -2455,12 +2457,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'first\'",
+ "val": "'first'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'prepend\'",
+ "val": "'prepend'",
},
],
"block": Object {
@@ -2489,7 +2491,7 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'content\'",
+ "val": "'content'",
},
],
"block": Object {
@@ -2518,12 +2520,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'first\'",
+ "val": "'first'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'append\'",
+ "val": "'append'",
},
],
"block": Object {
@@ -2552,12 +2554,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'last\'",
+ "val": "'last'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'append\'",
+ "val": "'append'",
},
],
"block": Object {
@@ -2600,7 +2602,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -2622,7 +2624,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'/app.js\'",
+ "val": "'/app.js'",
},
],
"block": Object {
@@ -2644,7 +2646,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'jquery.js\'",
+ "val": "'jquery.js'",
},
],
"block": Object {
@@ -2681,12 +2683,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'last\'",
+ "val": "'last'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'prepend\'",
+ "val": "'prepend'",
},
],
"block": Object {
@@ -2715,12 +2717,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'first\'",
+ "val": "'first'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'prepend\'",
+ "val": "'prepend'",
},
],
"block": Object {
@@ -2749,7 +2751,7 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'content\'",
+ "val": "'content'",
},
],
"block": Object {
@@ -2778,12 +2780,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'first\'",
+ "val": "'first'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'append\'",
+ "val": "'append'",
},
],
"block": Object {
@@ -2812,12 +2814,12 @@ Object {
Object {
"mustEscape": false,
"name": "class",
- "val": "\'last\'",
+ "val": "'last'",
},
Object {
"mustEscape": false,
"name": "class",
- "val": "\'append\'",
+ "val": "'append'",
},
],
"block": Object {
@@ -2855,7 +2857,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -2877,7 +2879,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'/app.js\'",
+ "val": "'/app.js'",
},
],
"block": Object {
@@ -2899,7 +2901,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'jquery.js\'",
+ "val": "'jquery.js'",
},
],
"block": Object {
@@ -2949,7 +2951,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -2971,7 +2973,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -2993,7 +2995,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -3015,7 +3017,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -3037,7 +3039,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -3081,7 +3083,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -3103,7 +3105,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -3125,7 +3127,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -3147,7 +3149,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -3169,7 +3171,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -3254,7 +3256,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -3276,7 +3278,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -3298,7 +3300,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -3320,7 +3322,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -3342,7 +3344,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -3386,7 +3388,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'foo.js\'",
+ "val": "'foo.js'",
},
],
"block": Object {
@@ -3408,7 +3410,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'bar.js\'",
+ "val": "'bar.js'",
},
],
"block": Object {
@@ -3430,7 +3432,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'app.js\'",
+ "val": "'app.js'",
},
],
"block": Object {
@@ -3452,7 +3454,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/jquery.js\'",
+ "val": "'vendor/jquery.js'",
},
],
"block": Object {
@@ -3474,7 +3476,7 @@ Object {
Object {
"mustEscape": true,
"name": "src",
- "val": "\'vendor/caustic.js\'",
+ "val": "'vendor/caustic.js'",
},
],
"block": Object {
@@ -3545,7 +3547,7 @@ exports[`error handling extends-not-first.input.json 1`] = `
Object {
"code": "PUG:EXTENDS_NOT_FIRST",
"line": 4,
- "msg": "Declaration of template inheritance (\"extends\") should be the first thing in the file. There can only be one extends statement per file.",
+ "msg": "Declaration of template inheritance (\\"extends\\") should be the first thing in the file. There can only be one extends statement per file.",
}
`;
@@ -3579,18 +3581,18 @@ Object {
"name": "body",
"nodes": Array [
Object {
- "args": "\'myimg.png\'",
+ "args": "'myimg.png'",
"attributeBlocks": Array [],
"attrs": Array [
Object {
"mustEscape": false,
"name": "class",
- "val": "\'with-border\'",
+ "val": "'with-border'",
},
Object {
"mustEscape": true,
"name": "alt",
- "val": "\"My image\"",
+ "val": "\\"My image\\"",
},
],
"block": null,
@@ -3609,18 +3611,18 @@ Object {
"name": "body",
"nodes": Array [
Object {
- "args": "\'myimg.png\'",
+ "args": "'myimg.png'",
"attributeBlocks": Array [],
"attrs": Array [
Object {
"mustEscape": false,
"name": "class",
- "val": "\'with-border\'",
+ "val": "'with-border'",
},
Object {
"mustEscape": true,
"name": "alt",
- "val": "\"My image\"",
+ "val": "\\"My image\\"",
},
],
"block": null,
@@ -3759,18 +3761,18 @@ Object {
"name": "body",
"nodes": Array [
Object {
- "args": "\'myimg.png\'",
+ "args": "'myimg.png'",
"attributeBlocks": Array [],
"attrs": Array [
Object {
"mustEscape": false,
"name": "class",
- "val": "\'with-border\'",
+ "val": "'with-border'",
},
Object {
"mustEscape": true,
"name": "alt",
- "val": "\"My image\"",
+ "val": "\\"My image\\"",
},
],
"block": null,
diff --git a/packages/pug-load/test/__snapshots__/index.test.js.snap b/packages/pug-load/test/__snapshots__/index.test.js.snap
index f7168dcbc..1fd0b4beb 100644
--- a/packages/pug-load/test/__snapshots__/index.test.js.snap
+++ b/packages/pug-load/test/__snapshots__/index.test.js.snap
@@ -1,4 +1,6 @@
-exports[`test pug-load 1`] = `
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`pug-load 1`] = `
Object {
"filename": "/foo.pug",
"line": 0,
@@ -64,7 +66,7 @@ Object {
"line": 1,
"mustEscape": false,
"name": "class",
- "val": "\'bing\'",
+ "val": "'bing'",
},
],
"block": Object {
@@ -120,7 +122,7 @@ Object {
"fullPath": "/script.js",
"line": 6,
"path": "script.js",
- "str": "document.write(\'hello world!\');
+ "str": "document.write('hello world!');
",
"type": "FileReference",
},
diff --git a/packages/pug-parser/test/__snapshots__/index.test.js.snap b/packages/pug-parser/test/__snapshots__/index.test.js.snap
index 54a141c98..39ab5cbc3 100644
--- a/packages/pug-parser/test/__snapshots__/index.test.js.snap
+++ b/packages/pug-parser/test/__snapshots__/index.test.js.snap
@@ -1,4 +1,6 @@
-exports[`test attr-es2015.tokens.json 1`] = `
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`attr-es2015.tokens.json 1`] = `
Object {
"filename": "attr-es2015.tokens.json",
"line": 0,
@@ -11,7 +13,7 @@ Object {
"line": 1,
"mustEscape": false,
"type": "Code",
- "val": "var avatar = \'219b77f9d21de75e81851b6b886057c7\'",
+ "val": "var avatar = '219b77f9d21de75e81851b6b886057c7'",
},
Object {
"attributeBlocks": Array [],
@@ -22,7 +24,7 @@ Object {
"line": 3,
"mustEscape": false,
"name": "class",
- "val": "\'avatar-div\'",
+ "val": "'avatar-div'",
},
Object {
"column": 16,
@@ -52,7 +54,7 @@ Object {
}
`;
-exports[`test attrs.js.tokens.json 1`] = `
+exports[`attrs.js.tokens.json 1`] = `
Object {
"filename": "attrs.js.tokens.json",
"line": 0,
@@ -75,7 +77,10 @@ Object {
"line": 2,
"mustEscape": false,
"type": "Code",
- "val": "function answer() { return 42; }",
+ "val": "function answer() {
+ return 42;
+}
+",
},
Object {
"attributeBlocks": Array [],
@@ -86,7 +91,7 @@ Object {
"line": 3,
"mustEscape": true,
"name": "href",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"column": 23,
@@ -94,7 +99,7 @@ Object {
"line": 3,
"mustEscape": true,
"name": "class",
- "val": "\'button\'",
+ "val": "'button'",
},
],
"block": Object {
@@ -120,7 +125,7 @@ Object {
"line": 4,
"mustEscape": true,
"name": "href",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"column": 27,
@@ -128,7 +133,7 @@ Object {
"line": 4,
"mustEscape": true,
"name": "class",
- "val": "\'button\'",
+ "val": "'button'",
},
],
"block": Object {
@@ -154,7 +159,7 @@ Object {
"line": 5,
"mustEscape": true,
"name": "key",
- "val": "\'answer\'",
+ "val": "'answer'",
},
Object {
"column": 20,
@@ -188,7 +193,7 @@ Object {
"line": 6,
"mustEscape": true,
"name": "class",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
],
"block": Object {
@@ -214,7 +219,7 @@ Object {
"line": 7,
"mustEscape": false,
"name": "class",
- "val": "\'tag-class\'",
+ "val": "'tag-class'",
},
Object {
"column": 13,
@@ -222,7 +227,7 @@ Object {
"line": 7,
"mustEscape": true,
"name": "class",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
],
"block": Object {
@@ -248,7 +253,7 @@ Object {
"line": 9,
"mustEscape": true,
"name": "href",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"column": 22,
@@ -256,7 +261,7 @@ Object {
"line": 9,
"mustEscape": true,
"name": "class",
- "val": "\'button\'",
+ "val": "'button'",
},
],
"block": Object {
@@ -282,7 +287,7 @@ Object {
"line": 10,
"mustEscape": true,
"name": "href",
- "val": "\'/user/\' + id",
+ "val": "'/user/' + id",
},
Object {
"column": 26,
@@ -290,7 +295,7 @@ Object {
"line": 10,
"mustEscape": true,
"name": "class",
- "val": "\'button\'",
+ "val": "'button'",
},
],
"block": Object {
@@ -316,7 +321,7 @@ Object {
"line": 11,
"mustEscape": true,
"name": "key",
- "val": "\'answer\'",
+ "val": "'answer'",
},
Object {
"column": 19,
@@ -350,7 +355,7 @@ Object {
"line": 12,
"mustEscape": true,
"name": "class",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
],
"block": Object {
@@ -376,7 +381,7 @@ Object {
"line": 13,
"mustEscape": false,
"name": "class",
- "val": "\'tag-class\'",
+ "val": "'tag-class'",
},
Object {
"column": 13,
@@ -384,7 +389,7 @@ Object {
"line": 13,
"mustEscape": true,
"name": "class",
- "val": "[\'class1\', \'class2\']",
+ "val": "['class1', 'class2']",
},
],
"block": Object {
@@ -408,7 +413,7 @@ Object {
"filename": "attrs.js.tokens.json",
"line": 15,
"type": "AttributeBlock",
- "val": "{foo: \'bar\'}",
+ "val": "{foo: 'bar'}",
},
],
"attrs": Array [
@@ -452,7 +457,7 @@ Object {
"filename": "attrs.js.tokens.json",
"line": 17,
"type": "AttributeBlock",
- "val": "{baz: \'baz\'}",
+ "val": "{baz: 'baz'}",
},
],
"attrs": Array [
@@ -492,7 +497,7 @@ Object {
}
`;
-exports[`test attrs.tokens.json 1`] = `
+exports[`attrs.tokens.json 1`] = `
Object {
"filename": "attrs.tokens.json",
"line": 0,
@@ -506,7 +511,7 @@ Object {
"line": 1,
"mustEscape": true,
"name": "href",
- "val": "\'/contact\'",
+ "val": "'/contact'",
},
],
"block": Object {
@@ -540,7 +545,7 @@ Object {
"line": 2,
"mustEscape": true,
"name": "href",
- "val": "\'/save\'",
+ "val": "'/save'",
},
Object {
"column": 16,
@@ -548,7 +553,7 @@ Object {
"line": 2,
"mustEscape": false,
"name": "class",
- "val": "\'button\'",
+ "val": "'button'",
},
],
"block": Object {
@@ -624,7 +629,7 @@ Object {
"line": 4,
"mustEscape": true,
"name": "foo",
- "val": "\'foo, bar, baz\'",
+ "val": "'foo, bar, baz'",
},
Object {
"column": 24,
@@ -658,7 +663,7 @@ Object {
"line": 5,
"mustEscape": true,
"name": "foo",
- "val": "\'((foo))\'",
+ "val": "'((foo))'",
},
Object {
"column": 18,
@@ -699,7 +704,7 @@ Object {
"line": 7,
"mustEscape": true,
"name": "value",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"column": 23,
@@ -749,7 +754,7 @@ Object {
"line": 8,
"mustEscape": true,
"name": "value",
- "val": "\'bar\'",
+ "val": "'bar'",
},
],
"block": Object {
@@ -794,7 +799,7 @@ Object {
"line": 9,
"mustEscape": true,
"name": "foo",
- "val": "\"class:\"",
+ "val": "\\"class:\\"",
},
],
"block": Object {
@@ -820,7 +825,7 @@ Object {
"line": 10,
"mustEscape": true,
"name": "pattern",
- "val": "\'\\\\S+\'",
+ "val": "'\\\\\\\\S+'",
},
],
"block": Object {
@@ -846,7 +851,7 @@ Object {
"line": 12,
"mustEscape": true,
"name": "href",
- "val": "\'/contact\'",
+ "val": "'/contact'",
},
],
"block": Object {
@@ -880,7 +885,7 @@ Object {
"line": 13,
"mustEscape": true,
"name": "href",
- "val": "\'/save\'",
+ "val": "'/save'",
},
Object {
"column": 16,
@@ -888,7 +893,7 @@ Object {
"line": 13,
"mustEscape": false,
"name": "class",
- "val": "\'button\'",
+ "val": "'button'",
},
],
"block": Object {
@@ -964,7 +969,7 @@ Object {
"line": 15,
"mustEscape": true,
"name": "foo",
- "val": "\'foo, bar, baz\'",
+ "val": "'foo, bar, baz'",
},
Object {
"column": 23,
@@ -998,7 +1003,7 @@ Object {
"line": 16,
"mustEscape": true,
"name": "foo",
- "val": "\'((foo))\'",
+ "val": "'((foo))'",
},
Object {
"column": 17,
@@ -1039,7 +1044,7 @@ Object {
"line": 18,
"mustEscape": true,
"name": "value",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"column": 22,
@@ -1089,7 +1094,7 @@ Object {
"line": 19,
"mustEscape": true,
"name": "value",
- "val": "\'bar\'",
+ "val": "'bar'",
},
],
"block": Object {
@@ -1134,7 +1139,7 @@ Object {
"line": 20,
"mustEscape": true,
"name": "foo",
- "val": "\"class:\"",
+ "val": "\\"class:\\"",
},
],
"block": Object {
@@ -1160,7 +1165,7 @@ Object {
"line": 21,
"mustEscape": true,
"name": "pattern",
- "val": "\'\\\\S+\'",
+ "val": "'\\\\\\\\S+'",
},
],
"block": Object {
@@ -1186,7 +1191,7 @@ Object {
"line": 22,
"mustEscape": true,
"name": "terse",
- "val": "\"true\"",
+ "val": "\\"true\\"",
},
],
"block": Object {
@@ -1441,7 +1446,7 @@ Object {
"line": 38,
"mustEscape": false,
"type": "Code",
- "val": "var attrs = {foo: \'bar\', bar: \'\'}",
+ "val": "var attrs = {foo: 'bar', bar: ''}",
},
Object {
"attributeBlocks": Array [
@@ -1477,7 +1482,7 @@ Object {
"line": 42,
"mustEscape": true,
"name": "foo",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"column": 13,
@@ -1485,7 +1490,7 @@ Object {
"line": 42,
"mustEscape": true,
"name": "bar",
- "val": "\"bar\"",
+ "val": "\\"bar\\"",
},
],
"block": Object {
@@ -1511,7 +1516,7 @@ Object {
"line": 43,
"mustEscape": true,
"name": "foo",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"column": 13,
@@ -1519,7 +1524,7 @@ Object {
"line": 43,
"mustEscape": true,
"name": "bar",
- "val": "\'bar\'",
+ "val": "'bar'",
},
],
"block": Object {
@@ -1541,7 +1546,7 @@ Object {
}
`;
-exports[`test attrs.unescaped.tokens.json 1`] = `
+exports[`attrs.unescaped.tokens.json 1`] = `
Object {
"filename": "attrs.unescaped.tokens.json",
"line": 0,
@@ -1555,7 +1560,7 @@ Object {
"line": 1,
"mustEscape": true,
"name": "type",
- "val": "\'text/x-template\'",
+ "val": "'text/x-template'",
},
],
"block": Object {
@@ -1571,7 +1576,7 @@ Object {
"line": 2,
"mustEscape": false,
"name": "id",
- "val": "\'user-<%= user.id %>\'",
+ "val": "'user-<%= user.id %>'",
},
],
"block": Object {
@@ -1630,7 +1635,7 @@ Object {
}
`;
-exports[`test attrs-data.tokens.json 1`] = `
+exports[`attrs-data.tokens.json 1`] = `
Object {
"filename": "attrs-data.tokens.json",
"line": 0,
@@ -1643,7 +1648,7 @@ Object {
"line": 1,
"mustEscape": false,
"type": "Code",
- "val": "var user = { name: \'tobi\' }",
+ "val": "var user = { name: 'tobi' }",
},
Object {
"attributeBlocks": Array [],
@@ -1706,7 +1711,7 @@ Object {
"line": 4,
"mustEscape": true,
"name": "data-username",
- "val": "\'tobi\'",
+ "val": "'tobi'",
},
],
"block": Object {
@@ -1732,7 +1737,7 @@ Object {
"line": 5,
"mustEscape": true,
"name": "data-escaped",
- "val": "{message: \"Let\'s rock!\"}",
+ "val": "{message: \\"Let's rock!\\"}",
},
],
"block": Object {
@@ -1758,7 +1763,7 @@ Object {
"line": 6,
"mustEscape": true,
"name": "data-ampersand",
- "val": "{message: \"a quote: " this & that\"}",
+ "val": "{message: \\"a quote: " this & that\\"}",
},
],
"block": Object {
@@ -1806,7 +1811,7 @@ Object {
}
`;
-exports[`test basic.tokens.json 1`] = `
+exports[`basic.tokens.json 1`] = `
Object {
"filename": "basic.tokens.json",
"line": 0,
@@ -1877,7 +1882,7 @@ Object {
}
`;
-exports[`test blanks.tokens.json 1`] = `
+exports[`blanks.tokens.json 1`] = `
Object {
"filename": "blanks.tokens.json",
"line": 0,
@@ -1980,7 +1985,7 @@ Object {
}
`;
-exports[`test block-code.tokens.json 1`] = `
+exports[`block-code.tokens.json 1`] = `
Object {
"filename": "block-code.tokens.json",
"line": 0,
@@ -1993,8 +1998,8 @@ Object {
"line": 1,
"mustEscape": false,
"type": "Code",
- "val": "list = [\"uno\", \"dos\", \"tres\",
- \"cuatro\", \"cinco\", \"seis\"];",
+ "val": "list = [\\"uno\\", \\"dos\\", \\"tres\\",
+ \\"cuatro\\", \\"cinco\\", \\"seis\\"];",
},
Object {
"buffer": false,
@@ -2076,7 +2081,7 @@ item.slice(1);",
}
`;
-exports[`test block-expansion.shorthands.tokens.json 1`] = `
+exports[`block-expansion.shorthands.tokens.json 1`] = `
Object {
"filename": "block-expansion.shorthands.tokens.json",
"line": 0,
@@ -2097,7 +2102,7 @@ Object {
"line": 2,
"mustEscape": false,
"name": "class",
- "val": "\'list-item\'",
+ "val": "'list-item'",
},
],
"block": Object {
@@ -2113,7 +2118,7 @@ Object {
"line": 2,
"mustEscape": false,
"name": "class",
- "val": "\'foo\'",
+ "val": "'foo'",
},
],
"block": Object {
@@ -2129,7 +2134,7 @@ Object {
"line": 2,
"mustEscape": false,
"name": "id",
- "val": "\'bar\'",
+ "val": "'bar'",
},
],
"block": Object {
@@ -2192,7 +2197,7 @@ Object {
}
`;
-exports[`test block-expansion.tokens.json 1`] = `
+exports[`block-expansion.tokens.json 1`] = `
Object {
"filename": "block-expansion.tokens.json",
"line": 0,
@@ -2220,7 +2225,7 @@ Object {
"line": 2,
"mustEscape": true,
"name": "href",
- "val": "\'#\'",
+ "val": "'#'",
},
],
"block": Object {
@@ -2272,7 +2277,7 @@ Object {
"line": 3,
"mustEscape": true,
"name": "href",
- "val": "\'#\'",
+ "val": "'#'",
},
],
"block": Object {
@@ -2349,7 +2354,7 @@ Object {
}
`;
-exports[`test blockquote.tokens.json 1`] = `
+exports[`blockquote.tokens.json 1`] = `
Object {
"filename": "blockquote.tokens.json",
"line": 0,
@@ -2427,7 +2432,7 @@ Object {
}
`;
-exports[`test blocks-in-blocks.tokens.json 1`] = `
+exports[`blocks-in-blocks.tokens.json 1`] = `
Object {
"filename": "blocks-in-blocks.tokens.json",
"line": 0,
@@ -2485,7 +2490,7 @@ Object {
}
`;
-exports[`test blocks-in-if.tokens.json 1`] = `
+exports[`blocks-in-if.tokens.json 1`] = `
Object {
"filename": "blocks-in-if.tokens.json",
"line": 0,
@@ -2611,7 +2616,7 @@ Object {
"line": 15,
"mustEscape": true,
"name": "charset",
- "val": "\'utf8\'",
+ "val": "'utf8'",
},
],
"block": Object {
@@ -2746,7 +2751,7 @@ Object {
}
`;
-exports[`test case.tokens.json 1`] = `
+exports[`case.tokens.json 1`] = `
Object {
"filename": "case.tokens.json",
"line": 0,
@@ -3063,7 +3068,7 @@ Object {
"line": 16,
"mustEscape": false,
"type": "Code",
- "val": "var friend = \'Tim:G\'",
+ "val": "var friend = 'Tim:G'",
},
Object {
"block": Object {
@@ -3105,7 +3110,7 @@ Object {
},
"column": 7,
"debug": false,
- "expr": "\'Tim:G\'",
+ "expr": "'Tim:G'",
"filename": "case.tokens.json",
"line": 18,
"type": "When",
@@ -3145,7 +3150,7 @@ Object {
},
"column": 7,
"debug": false,
- "expr": "{tim: \'g\'}",
+ "expr": "{tim: 'g'}",
"filename": "case.tokens.json",
"line": 19,
"type": "When",
@@ -3186,7 +3191,7 @@ Object {
}
`;
-exports[`test case-blocks.tokens.json 1`] = `
+exports[`case-blocks.tokens.json 1`] = `
Object {
"filename": "case-blocks.tokens.json",
"line": 0,
@@ -3393,7 +3398,7 @@ Object {
}
`;
-exports[`test classes.tokens.json 1`] = `
+exports[`classes.tokens.json 1`] = `
Object {
"filename": "classes.tokens.json",
"line": 0,
@@ -3407,7 +3412,7 @@ Object {
"line": 1,
"mustEscape": true,
"name": "class",
- "val": "[\'foo\', \'bar\', \'baz\']",
+ "val": "['foo', 'bar', 'baz']",
},
],
"block": Object {
@@ -3433,7 +3438,7 @@ Object {
"line": 5,
"mustEscape": false,
"name": "class",
- "val": "\'foo\'",
+ "val": "'foo'",
},
Object {
"column": 7,
@@ -3441,7 +3446,7 @@ Object {
"line": 5,
"mustEscape": true,
"name": "class",
- "val": "\'bar\'",
+ "val": "'bar'",
},
Object {
"column": 19,
@@ -3449,7 +3454,7 @@ Object {
"line": 5,
"mustEscape": false,
"name": "class",
- "val": "\'baz\'",
+ "val": "'baz'",
},
],
"block": Object {
@@ -3475,7 +3480,7 @@ Object {
"line": 9,
"mustEscape": false,
"name": "class",
- "val": "\'foo-bar_baz\'",
+ "val": "'foo-bar_baz'",
},
],
"block": Object {
@@ -3527,7 +3532,7 @@ Object {
"line": 13,
"mustEscape": false,
"name": "class",
- "val": "\'-foo\'",
+ "val": "'-foo'",
},
],
"block": Object {
@@ -3553,7 +3558,7 @@ Object {
"line": 14,
"mustEscape": false,
"name": "class",
- "val": "\'3foo\'",
+ "val": "'3foo'",
},
],
"block": Object {
@@ -3575,7 +3580,7 @@ Object {
}
`;
-exports[`test classes-empty.tokens.json 1`] = `
+exports[`classes-empty.tokens.json 1`] = `
Object {
"filename": "classes-empty.tokens.json",
"line": 0,
@@ -3589,7 +3594,7 @@ Object {
"line": 1,
"mustEscape": true,
"name": "class",
- "val": "\'\'",
+ "val": "''",
},
],
"block": Object {
@@ -3663,7 +3668,7 @@ Object {
}
`;
-exports[`test code.conditionals.tokens.json 1`] = `
+exports[`code.conditionals.tokens.json 1`] = `
Object {
"filename": "code.conditionals.tokens.json",
"line": 0,
@@ -4083,7 +4088,7 @@ Object {
},
"filename": "code.conditionals.tokens.json",
"line": 26,
- "test": "\'works\'",
+ "test": "'works'",
"type": "Conditional",
},
],
@@ -4091,7 +4096,7 @@ Object {
},
"filename": "code.conditionals.tokens.json",
"line": 25,
- "test": "\'nested\'",
+ "test": "'nested'",
"type": "Conditional",
},
Object {
@@ -4116,7 +4121,7 @@ Object {
"line": 32,
"mustEscape": false,
"name": "class",
- "val": "\'bar\'",
+ "val": "'bar'",
},
],
"block": Object {
@@ -4164,7 +4169,7 @@ Object {
"line": 34,
"mustEscape": false,
"name": "class",
- "val": "\'bar\'",
+ "val": "'bar'",
},
],
"block": Object {
@@ -4198,7 +4203,7 @@ Object {
"line": 36,
"mustEscape": false,
"name": "class",
- "val": "\'bing\'",
+ "val": "'bing'",
},
],
"block": Object {
@@ -4230,7 +4235,7 @@ Object {
"line": 43,
"mustEscape": false,
"name": "class",
- "val": "\'foo\'",
+ "val": "'foo'",
},
],
"block": Object {
@@ -4264,7 +4269,7 @@ Object {
"line": 41,
"mustEscape": false,
"name": "class",
- "val": "\'bar\'",
+ "val": "'bar'",
},
],
"block": Object {
@@ -4303,7 +4308,7 @@ Object {
"line": 39,
"mustEscape": false,
"name": "class",
- "val": "\'bing\'",
+ "val": "'bing'",
},
],
"block": Object {
@@ -4333,7 +4338,7 @@ Object {
}
`;
-exports[`test code.escape.tokens.json 1`] = `
+exports[`code.escape.tokens.json 1`] = `
Object {
"filename": "code.escape.tokens.json",
"line": 0,
@@ -4353,7 +4358,7 @@ Object {
"line": 1,
"mustEscape": true,
"type": "Code",
- "val": "\'
\ No newline at end of file
diff --git a/packages/pug/test/cases/javascript-new-lines.js b/packages/pug/test/cases/javascript-new-lines.js
index 6893341c5..bb0c26f05 100644
--- a/packages/pug/test/cases/javascript-new-lines.js
+++ b/packages/pug/test/cases/javascript-new-lines.js
@@ -1 +1 @@
-var x = "\n here is some \n new lined text";
+var x = '\n here is some \n new lined text';
diff --git a/packages/pug/test/duplicate-block/index.test.js b/packages/pug/test/duplicate-block/index.test.js
index 99161340c..d77631f87 100644
--- a/packages/pug/test/duplicate-block/index.test.js
+++ b/packages/pug/test/duplicate-block/index.test.js
@@ -1,14 +1,10 @@
const pug = require('../../');
test('layout with duplicate block', () => {
- const outputWithAjax = pug.renderFile(
- __dirname + '/index.pug',
- {ajax: true}
- );
- const outputWithoutAjax = pug.renderFile(
- __dirname + '/index.pug',
- {ajax: false}
- );
+ const outputWithAjax = pug.renderFile(__dirname + '/index.pug', {ajax: true});
+ const outputWithoutAjax = pug.renderFile(__dirname + '/index.pug', {
+ ajax: false,
+ });
expect(outputWithAjax).toMatchSnapshot();
expect(outputWithoutAjax).toMatchSnapshot();
});
diff --git a/packages/pug/test/eachOf/index.test.js b/packages/pug/test/eachOf/index.test.js
index 5faf59f34..69da0bae3 100644
--- a/packages/pug/test/eachOf/index.test.js
+++ b/packages/pug/test/eachOf/index.test.js
@@ -2,51 +2,43 @@ const pug = require('../../');
describe('Inproper Usage', () => {
test('Only left-side bracket', () => {
- expect(
- () => pug.compileFile(
- __dirname + '/error/left-side.pug'
- )
- ).toThrow('The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).');
- })
+ expect(() => pug.compileFile(__dirname + '/error/left-side.pug')).toThrow(
+ 'The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).'
+ );
+ });
test('Only right-side bracket', () => {
- expect(
- () => pug.compileFile(
- __dirname + '/error/right-side.pug'
- )
- ).toThrow('The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).');
- })
+ expect(() => pug.compileFile(__dirname + '/error/right-side.pug')).toThrow(
+ 'The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).'
+ );
+ });
test('Only one value inside brackets', () => {
- expect(
- () => pug.compileFile(
- __dirname + '/error/one-val.pug'
- )
- ).toThrow('The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).');
- })
+ expect(() => pug.compileFile(__dirname + '/error/one-val.pug')).toThrow(
+ 'The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).'
+ );
+ });
test('No brackets', () => {
- expect(
- () => pug.compileFile(
- __dirname + '/error/no-brackets.pug'
- )
- ).toThrow('The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).');
- })
-})
+ expect(() => pug.compileFile(__dirname + '/error/no-brackets.pug')).toThrow(
+ 'The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).'
+ );
+ });
+});
describe('Proper Usage', () => {
test('Brackets', () => {
- const html = pug.renderFile(
- __dirname + '/passing/brackets.pug',
- {
- users: new Map([['a', 'b'], ['foo', 'bar']])
- }
- )
+ const html = pug.renderFile(__dirname + '/passing/brackets.pug', {
+ users: new Map([
+ ['a', 'b'],
+ ['foo', 'bar'],
+ ]),
+ });
expect(html).toMatchSnapshot();
- })
+ });
test('No Brackets', () => {
- const html = pug.renderFile(
- __dirname + '/passing/no-brackets.pug',
- {
- users: new Map([['a', 'b'], ['foo', 'bar']])
- }
- )
+ const html = pug.renderFile(__dirname + '/passing/no-brackets.pug', {
+ users: new Map([
+ ['a', 'b'],
+ ['foo', 'bar'],
+ ]),
+ });
expect(html).toMatchSnapshot();
- })
-})
+ });
+});
diff --git a/packages/pug/test/error.reporting.test.js b/packages/pug/test/error.reporting.test.js
index dc6dc4558..e378e1f14 100644
--- a/packages/pug/test/error.reporting.test.js
+++ b/packages/pug/test/error.reporting.test.js
@@ -1,4 +1,3 @@
-
/**
* Module dependencies.
*/
@@ -9,7 +8,7 @@ var fs = require('fs');
// Shortcut
-function getError(str, options){
+function getError(str, options) {
try {
pug.render(str, options);
} catch (ex) {
@@ -17,7 +16,7 @@ function getError(str, options){
}
throw new Error('Input was supposed to result in an error.');
}
-function getFileError(name, options){
+function getFileError(name, options) {
try {
pug.renderFile(name, options);
} catch (ex) {
@@ -26,168 +25,224 @@ function getFileError(name, options){
throw new Error('Input was supposed to result in an error.');
}
-
-describe('error reporting', function () {
- describe('compile time errors', function () {
- describe('with no filename', function () {
- it('includes detail of where the error was thrown', function () {
- var err = getError('foo(')
+describe('error reporting', function() {
+ describe('compile time errors', function() {
+ describe('with no filename', function() {
+ it('includes detail of where the error was thrown', function() {
+ var err = getError('foo(');
expect(err.message).toMatch(/Pug:1/);
expect(err.message).toMatch(/foo\(/);
});
});
- describe('with a filename', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getError('foo(', {filename: 'test.pug'})
+ describe('with a filename', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getError('foo(', {filename: 'test.pug'});
expect(err.message).toMatch(/test\.pug:1/);
expect(err.message).toMatch(/foo\(/);
});
});
- describe('with a layout without block declaration (syntax)', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/compile.with.layout.syntax.error.pug', {})
+ describe('with a layout without block declaration (syntax)', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname + '/fixtures/compile.with.layout.syntax.error.pug',
+ {}
+ );
expect(err.message).toMatch(/[\\\/]layout.syntax.error.pug:2/);
expect(err.message).toMatch(/foo\(/);
});
});
- describe('with a layout without block declaration (locals)', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/compile.with.layout.locals.error.pug', {})
+ describe('with a layout without block declaration (locals)', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname + '/fixtures/compile.with.layout.locals.error.pug',
+ {}
+ );
expect(err.message).toMatch(/[\\\/]layout.locals.error.pug:2/);
expect(err.message).toMatch(/is not a function/);
});
});
- describe('with a include (syntax)', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/compile.with.include.syntax.error.pug', {})
+ describe('with a include (syntax)', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname + '/fixtures/compile.with.include.syntax.error.pug',
+ {}
+ );
expect(err.message).toMatch(/[\\\/]include.syntax.error.pug:2/);
expect(err.message).toMatch(/foo\(/);
});
});
- describe('with a include (locals)', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/compile.with.include.locals.error.pug', {})
+ describe('with a include (locals)', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname + '/fixtures/compile.with.include.locals.error.pug',
+ {}
+ );
expect(err.message).toMatch(/[\\\/]include.locals.error.pug:2/);
expect(err.message).toMatch(/foo\(/);
});
});
- describe('with a layout (without block) with an include (syntax)', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/compile.with.layout.with.include.syntax.error.pug', {})
+ describe('with a layout (without block) with an include (syntax)', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname +
+ '/fixtures/compile.with.layout.with.include.syntax.error.pug',
+ {}
+ );
expect(err.message).toMatch(/[\\\/]include.syntax.error.pug:2/);
expect(err.message).toMatch(/foo\(/);
});
});
- describe('with a layout (without block) with an include (locals)', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/compile.with.layout.with.include.locals.error.pug', {})
+ describe('with a layout (without block) with an include (locals)', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname +
+ '/fixtures/compile.with.layout.with.include.locals.error.pug',
+ {}
+ );
expect(err.message).toMatch(/[\\\/]include.locals.error.pug:2/);
expect(err.message).toMatch(/foo\(/);
});
});
- describe('block that is never actually used', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/invalid-block-in-extends.pug', {});
- expect(err.message).toMatch(/invalid-block-in-extends.pug:6/);;
- expect(err.message).toMatch(/content/);;
+ describe('block that is never actually used', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname + '/fixtures/invalid-block-in-extends.pug',
+ {}
+ );
+ expect(err.message).toMatch(/invalid-block-in-extends.pug:6/);
+ expect(err.message).toMatch(/content/);
});
});
- describe('Unexpected character', function () {
- it('includes details of where the error was thrown', function () {
+ describe('Unexpected character', function() {
+ it('includes details of where the error was thrown', function() {
var err = getError('ul?', {});
expect(err.message).toMatch(/unexpected text \"\?\"/);
});
});
- describe('Include filtered', function () {
- it('includes details of where the error was thrown', function () {
+ describe('Include filtered', function() {
+ it('includes details of where the error was thrown', function() {
var err = getError('include:verbatim()!', {});
assert(err.message.indexOf('unexpected text "!"') !== -1);
var err = getError('include:verbatim ', {});
assert(err.message.indexOf('missing path for include') !== -1);
});
});
- describe('mixin block followed by a lot of blank lines', function () {
- it('reports the correct line number', function () {
+ describe('mixin block followed by a lot of blank lines', function() {
+ it('reports the correct line number', function() {
var err = getError('mixin test\n block\n\ndiv()Test');
var line = /Pug\:(\d+)/.exec(err.message);
assert(line, 'Line number must be included in error message');
- assert(line[1] === '4', 'The error should be reported on line 4, not line ' + line[1]);
+ assert(
+ line[1] === '4',
+ 'The error should be reported on line 4, not line ' + line[1]
+ );
});
});
});
- describe('runtime errors', function () {
- describe('with no filename and `compileDebug` left undefined', function () {
- it('just reports the line number', function () {
+ describe('runtime errors', function() {
+ describe('with no filename and `compileDebug` left undefined', function() {
+ it('just reports the line number', function() {
var sentinel = new Error('sentinel');
- var err = getError('-foo()', {foo: function () { throw sentinel; }})
+ var err = getError('-foo()', {
+ foo: function() {
+ throw sentinel;
+ },
+ });
expect(err.message).toMatch(/on line 1/);
});
});
- describe('with no filename and `compileDebug` set to `true`', function () {
- it('includes detail of where the error was thrown', function () {
+ describe('with no filename and `compileDebug` set to `true`', function() {
+ it('includes detail of where the error was thrown', function() {
var sentinel = new Error('sentinel');
- var err = getError('-foo()', {foo: function () { throw sentinel; }, compileDebug: true})
+ var err = getError('-foo()', {
+ foo: function() {
+ throw sentinel;
+ },
+ compileDebug: true,
+ });
expect(err.message).toMatch(/Pug:1/);
expect(err.message).toMatch(/-foo\(\)/);
});
});
- describe('with a filename that does not correspond to a real file and `compileDebug` left undefined', function () {
- it('just reports the line number', function () {
+ describe('with a filename that does not correspond to a real file and `compileDebug` left undefined', function() {
+ it('just reports the line number', function() {
var sentinel = new Error('sentinel');
- var err = getError('-foo()', {foo: function () { throw sentinel; }, filename: 'fake.pug'})
+ var err = getError('-foo()', {
+ foo: function() {
+ throw sentinel;
+ },
+ filename: 'fake.pug',
+ });
expect(err.message).toMatch(/on line 1/);
});
});
- describe('with a filename that corresponds to a real file and `compileDebug` left undefined', function () {
- it('includes detail of where the error was thrown including the filename', function () {
+ describe('with a filename that corresponds to a real file and `compileDebug` left undefined', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
var sentinel = new Error('sentinel');
- var path = __dirname + '/fixtures/runtime.error.pug'
- var err = getError(fs.readFileSync(path, 'utf8'), {foo: function () { throw sentinel; }, filename: path})
+ var path = __dirname + '/fixtures/runtime.error.pug';
+ var err = getError(fs.readFileSync(path, 'utf8'), {
+ foo: function() {
+ throw sentinel;
+ },
+ filename: path,
+ });
expect(err.message).toMatch(/fixtures[\\\/]runtime\.error\.pug:1/);
expect(err.message).toMatch(/-foo\(\)/);
});
});
- describe('in a mixin', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/runtime.with.mixin.error.pug', {})
+ describe('in a mixin', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname + '/fixtures/runtime.with.mixin.error.pug',
+ {}
+ );
expect(err.message).toMatch(/mixin.error.pug:2/);
expect(err.message).toMatch(/Cannot read property 'length' of null/);
});
});
- describe('in a layout', function () {
- it('includes detail of where the error was thrown including the filename', function () {
- var err = getFileError(__dirname + '/fixtures/runtime.layout.error.pug', {})
+ describe('in a layout', function() {
+ it('includes detail of where the error was thrown including the filename', function() {
+ var err = getFileError(
+ __dirname + '/fixtures/runtime.layout.error.pug',
+ {}
+ );
expect(err.message).toMatch(/layout.with.runtime.error.pug:3/);
- expect(err.message).toMatch(/Cannot read property 'length' of undefined/);
+ expect(err.message).toMatch(
+ /Cannot read property 'length' of undefined/
+ );
});
});
});
- describe('deprecated features', function () {
- it('warns about element-with-multiple-attributes', function () {
+ describe('deprecated features', function() {
+ it('warns about element-with-multiple-attributes', function() {
var consoleWarn = console.warn;
var log = '';
- console.warn = function (str) {
+ console.warn = function(str) {
log += str;
};
- var res = pug.renderFile(__dirname + '/fixtures/element-with-multiple-attributes.pug');
+ var res = pug.renderFile(
+ __dirname + '/fixtures/element-with-multiple-attributes.pug'
+ );
console.warn = consoleWarn;
- expect(log).toMatch(/element-with-multiple-attributes.pug, line 1:/);;
- expect(log).toMatch(/You should not have pug tags with multiple attributes/);;
+ expect(log).toMatch(/element-with-multiple-attributes.pug, line 1:/);
+ expect(log).toMatch(
+ /You should not have pug tags with multiple attributes/
+ );
expect(res).toBe('
');
});
});
- describe('if you throw something that isn\'t an error', function () {
- it('just rethrows without modification', function () {
+ describe("if you throw something that isn't an error", function() {
+ it('just rethrows without modification', function() {
var err = getError('- throw "foo"');
expect(err).toBe('foo');
});
});
- describe('import without a filename for a basedir', function () {
- it('throws an error', function () {
+ describe('import without a filename for a basedir', function() {
+ it('throws an error', function() {
var err = getError('include foo.pug');
- expect(err.message).toMatch(/the "filename" option is required to use/);;
+ expect(err.message).toMatch(/the "filename" option is required to use/);
var err = getError('include /foo.pug');
- expect(err.message).toMatch(/the "basedir" option is required to use/);;
- })
+ expect(err.message).toMatch(/the "basedir" option is required to use/);
+ });
});
});
diff --git a/packages/pug/test/examples.test.js b/packages/pug/test/examples.test.js
index 0537f8de3..a4a4c22a1 100644
--- a/packages/pug/test/examples.test.js
+++ b/packages/pug/test/examples.test.js
@@ -3,14 +3,14 @@
var fs = require('fs');
var pug = require('../');
-describe('examples', function () {
- fs.readdirSync(__dirname + '/../examples').forEach(function (example) {
+describe('examples', function() {
+ fs.readdirSync(__dirname + '/../examples').forEach(function(example) {
if (/\.js$/.test(example)) {
- it(example + ' does not throw any error', function () {
+ it(example + ' does not throw any error', function() {
var log = console.log;
var err = console.error;
- console.log = function () {};
- console.error = function () {};
+ console.log = function() {};
+ console.error = function() {};
try {
require('../examples/' + example);
} finally {
diff --git a/packages/pug/test/extends-not-top-level/index.test.js b/packages/pug/test/extends-not-top-level/index.test.js
index 43877a026..a0fbf274f 100644
--- a/packages/pug/test/extends-not-top-level/index.test.js
+++ b/packages/pug/test/extends-not-top-level/index.test.js
@@ -3,17 +3,13 @@ const pug = require('../../');
// regression test for #2404
test('extends not top level should throw an error', () => {
- expect(
- () => pug.compileFile(
- __dirname + '/index.pug'
- )
- ).toThrow('Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.');
+ expect(() => pug.compileFile(__dirname + '/index.pug')).toThrow(
+ 'Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.'
+ );
});
test('duplicate extends should throw an error', () => {
- expect(
- () => pug.compileFile(
- __dirname + '/duplicate.pug'
- )
- ).toThrow('Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.');
+ expect(() => pug.compileFile(__dirname + '/duplicate.pug')).toThrow(
+ 'Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.'
+ );
});
diff --git a/packages/pug/test/markdown-it/index.test.js b/packages/pug/test/markdown-it/index.test.js
index 7ab82c8a1..00bef9f96 100644
--- a/packages/pug/test/markdown-it/index.test.js
+++ b/packages/pug/test/markdown-it/index.test.js
@@ -1,13 +1,13 @@
const pug = require('../../');
test('inline and include markdow-it should match ', () => {
- const outputMarkdownInline = pug.renderFile(
- __dirname + '/layout-markdown-inline.pug',
- );
+ const outputMarkdownInline = pug.renderFile(
+ __dirname + '/layout-markdown-inline.pug'
+ );
- const outputMarkdownIncludes = pug.renderFile(
- __dirname + '/layout-markdown-include.pug',
- );
+ const outputMarkdownIncludes = pug.renderFile(
+ __dirname + '/layout-markdown-include.pug'
+ );
- expect(outputMarkdownIncludes).toEqual(outputMarkdownInline);
+ expect(outputMarkdownIncludes).toEqual(outputMarkdownInline);
});
diff --git a/packages/pug/test/pug.test.js b/packages/pug/test/pug.test.js
index 3327b1a9e..0b4d85274 100644
--- a/packages/pug/test/pug.test.js
+++ b/packages/pug/test/pug.test.js
@@ -5,7 +5,7 @@ var fs = require('fs');
var path = require('path');
var pug = require('../');
-var perfTest = fs.readFileSync(__dirname + '/fixtures/perf.pug', 'utf8')
+var perfTest = fs.readFileSync(__dirname + '/fixtures/perf.pug', 'utf8');
try {
fs.mkdirSync(__dirname + '/temp');
@@ -15,267 +15,309 @@ try {
}
}
-describe('pug', function(){
-
- describe('unit tests with .render()', function(){
- it('should support doctypes', function(){
- assert.equal('', pug.render('doctype xml'));
+describe('pug', function() {
+ describe('unit tests with .render()', function() {
+ it('should support doctypes', function() {
+ assert.equal(
+ '',
+ pug.render('doctype xml')
+ );
assert.equal('', pug.render('doctype html'));
assert.equal('', pug.render('doctype foo bar baz'));
assert.equal('', pug.render('doctype html'));
- assert.equal('', pug.render('doctype', { doctype:'html' }));
- assert.equal('', pug.render('doctype html', { doctype:'xml' }));
+ assert.equal('', pug.render('doctype', {doctype: 'html'}));
+ assert.equal(
+ '',
+ pug.render('doctype html', {doctype: 'xml'})
+ );
assert.equal('', pug.render('html'));
- assert.equal('', pug.render('html', { doctype:'html' }));
- assert.equal('',
+ pug.render('html', {doctype: 'html'})
+ );
+ assert.equal(
+ 'foo
', pug.render(Buffer.from('p foo')));
});
- it('should support line endings', function(){
- var src = [
- 'p',
- 'div',
- 'img'
- ];
+ it('should support line endings', function() {
+ var src = ['p', 'div', 'img'];
- var html = [
- '
', pug.render(".foo: .bar baz"));
+ it('should support block-expansion', function() {
+ assert.equal(
+ '
',
+ pug.render('li: a foo\nli: a bar\nli: a baz')
+ );
+ assert.equal(
+ '
',
+ pug.render('li.first: a foo\nli: a bar\nli: a baz')
+ );
+ assert.equal(
+ '
',
+ pug.render('.foo: .bar baz')
+ );
});
- it('should support tags', function(){
- var str = [
- 'p',
- 'div',
- 'img',
- 'br/'
- ].join('\n');
+ it('should support tags', function() {
+ var str = ['p', 'div', 'img', 'br/'].join('\n');
- var html = [
- '
', pug.render('#something'), 'Test stand-alone ids');
+ assert.equal(
+ '',
+ pug.render('fb:foo-bar'),
+ 'Test hyphens'
+ );
+ assert.equal(
+ '
',
+ pug.render('div.something'),
+ 'Test classes'
+ );
+ assert.equal(
+ '
',
+ pug.render('div#something'),
+ 'Test ids'
+ );
+ assert.equal(
+ '
',
+ pug.render('.something'),
+ 'Test stand-alone classes'
+ );
+ assert.equal(
+ '
',
+ pug.render('#something'),
+ 'Test stand-alone ids'
+ );
assert.equal('
',
+ pug.render('div#foo(class="bar")')
+ );
+ assert.equal(
+ '
',
+ pug.render('div(class="bar")#foo')
+ );
+ assert.equal(
+ '
',
+ pug.render('div(id="bar").foo')
+ );
+ assert.equal(
+ '
',
+ pug.render('div.foo.bar.baz')
+ );
+ assert.equal(
+ '
',
+ pug.render('div(class="foo").bar.baz')
+ );
+ assert.equal(
+ '
',
+ pug.render('div.foo(class="bar").baz')
+ );
+ assert.equal(
+ '
',
+ pug.render('div.foo.bar(class="baz")')
+ );
assert.equal('
',
+ pug.render('colgroup\n col.test')
+ );
});
- it('should support nested tags', function(){
+ it('should support nested tags', function() {
var str = [
- 'ul',
- ' li a',
- ' li b',
- ' li',
- ' ul',
- ' li c',
- ' li d',
- ' li e',
+ 'ul',
+ ' li a',
+ ' li b',
+ ' li',
+ ' ul',
+ ' li c',
+ ' li d',
+ ' li e',
].join('\n');
var html = [
- '
',
].join('');
assert.equal(html, pug.render(str));
- var str = [
- 'a(href="#")',
- ' | foo ',
- ' | bar ',
- ' | baz'
- ].join('\n');
+ var str = ['a(href="#")', ' | foo ', ' | bar ', ' | baz'].join('\n');
assert.equal('foo \nbar \nbaz', pug.render(str));
- var str = [
- 'ul',
- ' li one',
- ' ul',
- ' | two',
- ' li three'
- ].join('\n');
+ var str = ['ul', ' li one', ' ul', ' | two', ' li three'].join(
+ '\n'
+ );
var html = [
- '
',
].join('');
assert.equal(html, pug.render(str));
});
- it('should support variable length newlines', function(){
+ it('should support variable length newlines', function() {
var str = [
- 'ul',
- ' li a',
- ' ',
- ' li b',
- ' ',
- ' ',
- ' li',
- ' ul',
- ' li c',
- '',
- ' li d',
- ' li e',
+ 'ul',
+ ' li a',
+ ' ',
+ ' li b',
+ ' ',
+ ' ',
+ ' li',
+ ' ul',
+ ' li c',
+ '',
+ ' li d',
+ ' li e',
].join('\n');
var html = [
- '
',
].join('');
assert.equal(html, pug.render(str));
});
- it('should support tab conversion', function(){
+ it('should support tab conversion', function() {
var str = [
- 'ul',
- '\tli a',
- '\t',
- '\tli b',
- '\t\t',
- '\t\t\t\t\t\t',
- '\tli',
- '\t\tul',
- '\t\t\tli c',
- '',
- '\t\t\tli d',
- '\tli e',
+ 'ul',
+ '\tli a',
+ '\t',
+ '\tli b',
+ '\t\t',
+ '\t\t\t\t\t\t',
+ '\tli',
+ '\t\tul',
+ '\t\t\tli c',
+ '',
+ '\t\t\tli d',
+ '\tli e',
].join('\n');
var html = [
- '
',
].join('');
assert.equal(html, pug.render(str));
});
- it('should support newlines', function(){
+ it('should support newlines', function() {
var str = [
- 'ul',
- ' li a',
- ' ',
- ' ',
- '',
- ' ',
- ' li b',
- ' li',
- ' ',
- ' ',
- ' ',
- ' ul',
- ' ',
- ' li c',
- ' li d',
- ' li e',
+ 'ul',
+ ' li a',
+ ' ',
+ ' ',
+ '',
+ ' ',
+ ' li b',
+ ' li',
+ ' ',
+ ' ',
+ ' ',
+ ' ul',
+ ' ',
+ ' li c',
+ ' li d',
+ ' li e',
].join('\n');
var html = [
- '
',
].join('');
assert.equal(html, pug.render(str));
var str = [
- 'html',
- ' ',
- ' head',
- ' != "test"',
- ' ',
- ' ',
- ' ',
- ' body'
+ 'html',
+ ' ',
+ ' head',
+ ' != "test"',
+ ' ',
+ ' ',
+ ' ',
+ ' body',
].join('\n');
var html = [
- '',
- '