So siehts ganz gut aus !

This commit is contained in:
2019-04-03 17:44:16 +02:00
parent 3695b33c83
commit 0fe884c90a
6758 changed files with 530485 additions and 65 deletions

10
node_modules/pug-linker/HISTORY.md generated vendored Normal file
View File

@@ -0,0 +1,10 @@
1.0.1 / 2016-08-26
==================
* Update to `pug-walk@^1.0.0`
1.0.0 / 2016-06-02
==================
* Mark as stable
* Make unexpected blocks errors

19
node_modules/pug-linker/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2015 Forbes Lindesay
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

27
node_modules/pug-linker/README.md generated vendored Normal file
View File

@@ -0,0 +1,27 @@
# pug-linker
Link multiple pug ASTs together using include/extends
[![Build Status](https://img.shields.io/travis/pugjs/pug-linker/master.svg)](https://travis-ci.org/pugjs/pug-linker)
[![Dependency Status](https://img.shields.io/david/pugjs/pug-linker.svg)](https://david-dm.org/pugjs/pug-linker)
[![NPM version](https://img.shields.io/npm/v/pug-linker.svg)](https://www.npmjs.org/package/pug-linker)
## Installation
npm install pug-linker
## Usage
```js
var link = require('pug-linker');
```
### `link(ast)`
Flatten the Pug AST of inclusion and inheritance.
This function merely links the AST together; it doesn't read the file system to resolve and parse included and extended files. Thus, the main AST must already have the ASTs of the included and extended files embedded in the `FileReference` nodes. `pug-load` is designed to do that.
## License
MIT

185
node_modules/pug-linker/index.js generated vendored Normal file
View File

@@ -0,0 +1,185 @@
'use strict';
var assert = require('assert');
var walk = require('pug-walk');
function error() {
throw require('pug-error').apply(null, arguments);
}
module.exports = link;
function link(ast) {
assert(ast.type === 'Block', 'The top level element should always be a block');
var extendsNode = null;
if (ast.nodes.length) {
var hasExtends = ast.nodes[0].type === 'Extends';
checkExtendPosition(ast, hasExtends);
if (hasExtends) {
extendsNode = ast.nodes.shift();
}
}
ast = applyIncludes(ast);
ast.declaredBlocks = findDeclaredBlocks(ast);
if (extendsNode) {
var mixins = [];
var expectedBlocks = [];
ast.nodes.forEach(function addNode(node) {
if (node.type === 'NamedBlock') {
expectedBlocks.push(node);
} else if (node.type === 'Block') {
node.nodes.forEach(addNode);
} else if (node.type === 'Mixin' && node.call === false) {
mixins.push(node);
} else {
error('UNEXPECTED_NODES_IN_EXTENDING_ROOT', 'Only named blocks and mixins can appear at the top level of an extending template', node);
}
});
var parent = link(extendsNode.file.ast);
extend(parent.declaredBlocks, ast);
var foundBlockNames = [];
walk(parent, function (node) {
if (node.type === 'NamedBlock') {
foundBlockNames.push(node.name);
}
});
expectedBlocks.forEach(function (expectedBlock) {
if (foundBlockNames.indexOf(expectedBlock.name) === -1) {
error(
'UNEXPECTED_BLOCK',
'Unexpected block ' + expectedBlock.name,
expectedBlock
);
}
});
Object.keys(ast.declaredBlocks).forEach(function (name) {
parent.declaredBlocks[name] = ast.declaredBlocks[name];
});
parent.nodes = mixins.concat(parent.nodes);
parent.hasExtends = true;
return parent;
}
return ast;
}
function findDeclaredBlocks(ast) /*: {[name: string]: Array<BlockNode>}*/ {
var definitions = {};
walk(ast, function before(node) {
if (node.type === 'NamedBlock' && node.mode === 'replace') {
definitions[node.name] = definitions[node.name] || [];
definitions[node.name].push(node);
}
});
return definitions;
}
function flattenParentBlocks(parentBlocks, accumulator) {
accumulator = accumulator || [];
parentBlocks.forEach(function (parentBlock) {
if (parentBlock.parents) {
flattenParentBlocks(parentBlock.parents, accumulator);
}
accumulator.push(parentBlock);
});
return accumulator;
}
function extend(parentBlocks, ast) {
var stack = {};
walk(ast, function before(node) {
if (node.type === 'NamedBlock') {
if (stack[node.name] === node.name) {
return node.ignore = true;
}
stack[node.name] = node.name;
var parentBlockList = parentBlocks[node.name] ? flattenParentBlocks(parentBlocks[node.name]) : [];
if (parentBlockList.length) {
node.parents = parentBlockList;
parentBlockList.forEach(function (parentBlock) {
switch (node.mode) {
case 'append':
parentBlock.nodes = parentBlock.nodes.concat(node.nodes);
break;
case 'prepend':
parentBlock.nodes = node.nodes.concat(parentBlock.nodes);
break;
case 'replace':
parentBlock.nodes = node.nodes;
break;
}
});
}
}
}, function after(node) {
if (node.type === 'NamedBlock' && !node.ignore) {
delete stack[node.name];
}
});
}
function applyIncludes(ast, child) {
return walk(ast, function before(node, replace) {
if (node.type === 'RawInclude') {
replace({type: 'Text', val: node.file.str.replace(/\r/g, '')});
}
}, function after(node, replace) {
if (node.type === 'Include') {
var childAST = link(node.file.ast);
if (childAST.hasExtends) {
childAST = removeBlocks(childAST);
}
replace(applyYield(childAST, node.block));
}
});
}
function removeBlocks(ast) {
return walk(ast, function (node, replace) {
if (node.type === 'NamedBlock') {
replace({
type: 'Block',
nodes: node.nodes
});
}
});
}
function applyYield(ast, block) {
if (!block || !block.nodes.length) return ast;
var replaced = false;
ast = walk(ast, null, function (node, replace) {
if (node.type === 'YieldBlock') {
replaced = true;
node.type = 'Block';
node.nodes = [block];
}
});
function defaultYieldLocation(node) {
var res = node;
for (var i = 0; i < node.nodes.length; i++) {
if (node.nodes[i].textOnly) continue;
if (node.nodes[i].type === 'Block') {
res = defaultYieldLocation(node.nodes[i]);
} else if (node.nodes[i].block && node.nodes[i].block.nodes.length) {
res = defaultYieldLocation(node.nodes[i].block);
}
}
return res;
}
if (!replaced) {
// todo: probably should deprecate this with a warning
defaultYieldLocation(ast).nodes.push(block);
}
return ast;
}
function checkExtendPosition(ast, hasExtends) {
var legitExtendsReached = false;
walk(ast, function (node) {
if (node.type === 'Extends') {
if (hasExtends && !legitExtendsReached) {
legitExtendsReached = true;
} else {
error('EXTENDS_NOT_FIRST', 'Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.', node);
}
}
});
}

54
node_modules/pug-linker/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"_from": "pug-linker@^3.0.5",
"_id": "pug-linker@3.0.5",
"_inBundle": false,
"_integrity": "sha1-npp65ABWgtAn3uuWsAD4juuDoC8=",
"_location": "/pug-linker",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "pug-linker@^3.0.5",
"name": "pug-linker",
"escapedName": "pug-linker",
"rawSpec": "^3.0.5",
"saveSpec": null,
"fetchSpec": "^3.0.5"
},
"_requiredBy": [
"/pug"
],
"_resolved": "https://registry.npmjs.org/pug-linker/-/pug-linker-3.0.5.tgz",
"_shasum": "9e9a7ae4005682d027deeb96b000f88eeb83a02f",
"_spec": "pug-linker@^3.0.5",
"_where": "/Users/rxf/WebstormProjects/laufschrift/node_modules/pug",
"author": {
"name": "Forbes Lindesay"
},
"bugs": {
"url": "https://github.com/pugjs/pug-linker/issues"
},
"bundleDependencies": false,
"dependencies": {
"pug-error": "^1.3.2",
"pug-walk": "^1.1.7"
},
"deprecated": false,
"description": "Link multiple pug ASTs together using include/extends",
"devDependencies": {
"pug-lexer": "^4.0.0",
"pug-load": "^2.0.11",
"pug-parser": "^5.0.0"
},
"homepage": "https://github.com/pugjs/pug-linker#readme",
"keywords": [
"pug"
],
"license": "MIT",
"name": "pug-linker",
"repository": {
"type": "git",
"url": "git+https://github.com/pugjs/pug-linker.git"
},
"version": "3.0.5"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
block content

View File

@@ -0,0 +1,4 @@
mixin test()
.test&attributes(attributes)
+test()

View File

@@ -0,0 +1,8 @@
doctype html
html
head
title Default title
body
block body
.container
block content

View File

@@ -0,0 +1,6 @@
extends window.pug
block window-content
.dialog
block content

View File

@@ -0,0 +1,2 @@
block test

View File

@@ -0,0 +1,3 @@
<script>
console.log("foo\nbar")
</script>

View File

@@ -0,0 +1,5 @@
extends empty-block.pug
block test
div test1

View File

@@ -0,0 +1,5 @@
extends empty-block.pug
block test
div test2

View File

@@ -0,0 +1,4 @@
extends /auxiliary/layout.pug
block content
include /auxiliary/include-from-root.pug

View File

@@ -0,0 +1,4 @@
extends ../../cases-src/auxiliary/layout
block content
include ../../cases-src/auxiliary/include-from-root

View File

@@ -0,0 +1,8 @@
html
head
style(type="text/css")
:less
@pad: 15px;
body {
padding: @pad;
}

View File

@@ -0,0 +1,7 @@
var STRING_SUBSTITUTIONS = { // table of character substitutions
'\t': '\\t',
'\r': '\\r',
'\n': '\\n',
'"' : '\\"',
'\\': '\\\\'
};

View File

@@ -0,0 +1 @@
h1 hello

View File

@@ -0,0 +1,11 @@
mixin article()
article
block
html
head
title My Application
block head
body
+article
block content

View File

@@ -0,0 +1,2 @@
h1 grand-grandparent
block grand-grandparent

View File

@@ -0,0 +1,6 @@
extends inheritance.extend.recursive-grand-grandparent.pug
block grand-grandparent
h2 grandparent
block grandparent

View File

@@ -0,0 +1,5 @@
extends inheritance.extend.recursive-grandparent.pug
block grandparent
h3 parent
block parent

View File

@@ -0,0 +1,7 @@
html
head
title My Application
block head
body
block content
include window.pug

View File

@@ -0,0 +1,6 @@
html
head
title My Application
block head
body
block content

View File

@@ -0,0 +1,3 @@
mixin slide
section.slide
block

View File

@@ -0,0 +1,3 @@
mixin foo()
p bar

View File

@@ -0,0 +1,3 @@
.pet
h1 {{name}}
p {{name}} is a {{species}} that is {{age}} old

View File

@@ -0,0 +1 @@
<p>:)</p>

View File

@@ -0,0 +1,4 @@
.window
a(href='#').close Close
block window-content

View File

@@ -0,0 +1,10 @@
html
head
title
body
h1 Page
#content
#content-wrapper
yield
#footer
stuff

View File

@@ -0,0 +1 @@
include /auxiliary/extends-from-root.pug

View File

@@ -0,0 +1,2 @@
include auxiliary/extends-empty-block-1.pug
include auxiliary/extends-empty-block-2.pug

View File

@@ -0,0 +1 @@
include ../cases-src/auxiliary/extends-relative.pug

View File

@@ -0,0 +1,2 @@
math =
square: (value) -> value * value

View File

@@ -0,0 +1,2 @@
style(type="text/css")
include:stylus some.styl

View File

@@ -0,0 +1,7 @@
html
body
include:markdown-it some.md
script
include:coffee-script(minify=true) include-filter-coffee.coffee
script
include:coffee-script(minify=false) include-filter-coffee.coffee

View File

@@ -0,0 +1,3 @@
| The message is "
yield
| "

View File

@@ -0,0 +1,5 @@
html
body
p
include include-only-text-body.pug
em hello world

View File

@@ -0,0 +1,3 @@
head
script(type='text/javascript').
alert('hello world');

View File

@@ -0,0 +1,4 @@
html
include include-with-text-head.pug
script(src='/caustic.js')
script(src='/app.js')

View File

@@ -0,0 +1,2 @@
script#pet-template(type='text/x-template')
include auxiliary/pet.pug

View File

@@ -0,0 +1,4 @@
include auxiliary/yield-nested.pug
p some content
p and some more

View File

@@ -0,0 +1,3 @@
pre
code
include javascript-new-lines.js

10
node_modules/pug-linker/test/cases-src/includes.pug generated vendored Normal file
View File

@@ -0,0 +1,10 @@
include auxiliary/mixins.pug
+foo
body
include auxiliary/smile.html
include auxiliary/escapes.html
script(type="text/javascript")
include:verbatim auxiliary/includable.js

View File

@@ -0,0 +1 @@
var x = "\n here is some \n new lined text";

View File

@@ -0,0 +1,6 @@
extends ../fixtures/append/app-layout.pug
block append head
script(src='foo.js')
script(src='bar.js')

View File

@@ -0,0 +1,6 @@
extends ../fixtures/append-without-block/app-layout.pug
append head
script(src='foo.js')
script(src='bar.js')

View File

@@ -0,0 +1,19 @@
extends ../fixtures/multi-append-prepend-block/redefine.pug
append content
p.first.append Something appended to content
prepend content
p.first.prepend Something prepended to content
append content
p.last.append Last append must be most last
prepend content
p.last.prepend Last prepend must appear at top
append head
script(src='jquery.js')
prepend head
script(src='foo.js')

View File

@@ -0,0 +1,6 @@
extends ../fixtures/prepend/app-layout.pug
block prepend head
script(src='foo.js')
script(src='bar.js')

View File

@@ -0,0 +1,6 @@
extends ../fixtures/prepend-without-block/app-layout.pug
prepend head
script(src='foo.js')
script(src='bar.js')

View File

@@ -0,0 +1,2 @@
body
padding 10px

3
node_modules/pug-linker/test/cases-src/some.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
Just _some_ markdown **tests**.
With new line.

1
node_modules/pug-linker/test/cases-src/some.styl generated vendored Normal file
View File

@@ -0,0 +1 @@
@import "some-included"

View File

@@ -0,0 +1,201 @@
{
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 1,
"filename": "include-extends-from-root.pug",
"path": "/auxiliary/extends-from-root.pug",
"fullPath": "auxiliary/extends-from-root.pug",
"str": "extends /auxiliary/layout.pug\n\nblock content\n include /auxiliary/include-from-root.pug\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "/auxiliary/layout.pug",
"line": 1,
"filename": "auxiliary/extends-from-root.pug",
"fullPath": "auxiliary/layout.pug",
"str": "html\n head\n title My Application\n block head\n body\n block content",
"ast": {
"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": "title",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "My Application",
"line": 3,
"filename": "auxiliary/layout.pug"
}
],
"line": 3,
"filename": "auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "auxiliary/layout.pug"
},
{
"type": "NamedBlock",
"nodes": [],
"line": 4,
"filename": "auxiliary/layout.pug",
"name": "head",
"mode": "replace"
}
],
"line": 2,
"filename": "auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "auxiliary/layout.pug"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 6,
"filename": "auxiliary/layout.pug",
"name": "content",
"mode": "replace"
}
],
"line": 5,
"filename": "auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "auxiliary/layout.pug"
}
],
"line": 1,
"filename": "auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "auxiliary/layout.pug"
}
],
"line": 0,
"filename": "auxiliary/layout.pug"
}
},
"line": 1,
"filename": "auxiliary/extends-from-root.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 4,
"filename": "auxiliary/extends-from-root.pug",
"path": "/auxiliary/include-from-root.pug",
"fullPath": "auxiliary/include-from-root.pug",
"str": "h1 hello",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "h1",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "hello",
"line": 1,
"filename": "auxiliary/include-from-root.pug"
}
],
"line": 1,
"filename": "auxiliary/include-from-root.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "auxiliary/include-from-root.pug"
}
],
"line": 0,
"filename": "auxiliary/include-from-root.pug"
}
},
"line": 4,
"filename": "auxiliary/extends-from-root.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 4,
"filename": "auxiliary/extends-from-root.pug"
}
}
],
"line": 3,
"filename": "auxiliary/extends-from-root.pug",
"name": "content",
"mode": "replace"
}
],
"line": 0,
"filename": "auxiliary/extends-from-root.pug"
}
},
"line": 1,
"filename": "include-extends-from-root.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 1,
"filename": "include-extends-from-root.pug"
}
}
],
"line": 0,
"filename": "include-extends-from-root.pug"
}

View File

@@ -0,0 +1,179 @@
{
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 1,
"filename": "include-extends-of-common-template.pug",
"path": "auxiliary/extends-empty-block-1.pug",
"fullPath": "auxiliary/extends-empty-block-1.pug",
"str": "extends empty-block.pug\n\nblock test\n div test1\n\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "empty-block.pug",
"line": 1,
"filename": "auxiliary/extends-empty-block-1.pug",
"fullPath": "auxiliary/empty-block.pug",
"str": "block test\n\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 1,
"filename": "auxiliary/empty-block.pug",
"name": "test",
"mode": "replace"
}
],
"line": 0,
"filename": "auxiliary/empty-block.pug"
}
},
"line": 1,
"filename": "auxiliary/extends-empty-block-1.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "test1",
"line": 4,
"filename": "auxiliary/extends-empty-block-1.pug"
}
],
"line": 4,
"filename": "auxiliary/extends-empty-block-1.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "auxiliary/extends-empty-block-1.pug"
}
],
"line": 3,
"filename": "auxiliary/extends-empty-block-1.pug",
"name": "test",
"mode": "replace"
}
],
"line": 0,
"filename": "auxiliary/extends-empty-block-1.pug"
}
},
"line": 1,
"filename": "include-extends-of-common-template.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 1,
"filename": "include-extends-of-common-template.pug"
}
},
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 2,
"filename": "include-extends-of-common-template.pug",
"path": "auxiliary/extends-empty-block-2.pug",
"fullPath": "auxiliary/extends-empty-block-2.pug",
"str": "extends empty-block.pug\n\nblock test\n div test2\n\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "empty-block.pug",
"line": 1,
"filename": "auxiliary/extends-empty-block-2.pug",
"fullPath": "auxiliary/empty-block.pug",
"str": "block test\n\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 1,
"filename": "auxiliary/empty-block.pug",
"name": "test",
"mode": "replace"
}
],
"line": 0,
"filename": "auxiliary/empty-block.pug"
}
},
"line": 1,
"filename": "auxiliary/extends-empty-block-2.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "test2",
"line": 4,
"filename": "auxiliary/extends-empty-block-2.pug"
}
],
"line": 4,
"filename": "auxiliary/extends-empty-block-2.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "auxiliary/extends-empty-block-2.pug"
}
],
"line": 3,
"filename": "auxiliary/extends-empty-block-2.pug",
"name": "test",
"mode": "replace"
}
],
"line": 0,
"filename": "auxiliary/extends-empty-block-2.pug"
}
},
"line": 2,
"filename": "include-extends-of-common-template.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 2,
"filename": "include-extends-of-common-template.pug"
}
}
],
"line": 0,
"filename": "include-extends-of-common-template.pug"
}

View File

@@ -0,0 +1,166 @@
{
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 1,
"filename": "include-extends-relative.pug",
"path": "../cases-src/auxiliary/extends-relative.pug",
"fullPath": "../cases-src/auxiliary/extends-relative.pug",
"str": "extends ../../cases-src/auxiliary/layout\n\nblock content\n include ../../cases-src/auxiliary/include-from-root\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../../cases-src/auxiliary/layout",
"line": 1,
"filename": "../cases-src/auxiliary/extends-relative.pug",
"fullPath": "../cases-src/auxiliary/layout.pug",
"str": "html\n head\n title My Application\n block head\n body\n block content",
"ast": {
"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": "title",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "My Application",
"line": 3,
"filename": "../cases-src/auxiliary/layout.pug"
}
],
"line": 3,
"filename": "../cases-src/auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "../cases-src/auxiliary/layout.pug"
},
{
"type": "NamedBlock",
"nodes": [],
"line": 4,
"filename": "../cases-src/auxiliary/layout.pug",
"name": "head",
"mode": "replace"
}
],
"line": 2,
"filename": "../cases-src/auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "../cases-src/auxiliary/layout.pug"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 6,
"filename": "../cases-src/auxiliary/layout.pug",
"name": "content",
"mode": "replace"
}
],
"line": 5,
"filename": "../cases-src/auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../cases-src/auxiliary/layout.pug"
}
],
"line": 1,
"filename": "../cases-src/auxiliary/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "../cases-src/auxiliary/layout.pug"
}
],
"line": 0,
"filename": "../cases-src/auxiliary/layout.pug"
}
},
"line": 1,
"filename": "../cases-src/auxiliary/extends-relative.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 4,
"filename": "../cases-src/auxiliary/extends-relative.pug",
"path": "../../cases-src/auxiliary/include-from-root",
"fullPath": "../cases-src/auxiliary/include-from-root.pug",
"str": "h1 hello"
},
"line": 4,
"filename": "../cases-src/auxiliary/extends-relative.pug",
"filters": []
}
],
"line": 3,
"filename": "../cases-src/auxiliary/extends-relative.pug",
"name": "content",
"mode": "replace"
}
],
"line": 0,
"filename": "../cases-src/auxiliary/extends-relative.pug"
}
},
"line": 1,
"filename": "include-extends-relative.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 1,
"filename": "include-extends-relative.pug"
}
}
],
"line": 0,
"filename": "include-extends-relative.pug"
}

View File

@@ -0,0 +1,52 @@
{
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "style",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 2,
"filename": "include-filter-stylus.pug",
"path": "some.styl",
"fullPath": "some.styl",
"str": "@import \"some-included\"\n"
},
"line": 2,
"filename": "include-filter-stylus.pug",
"filters": [
{
"type": "IncludeFilter",
"name": "stylus",
"attrs": [],
"line": 2,
"filename": "include-filter-stylus.pug"
}
]
}
],
"line": 1,
"filename": "include-filter-stylus.pug"
},
"attrs": [
{
"name": "type",
"val": "\"text/css\"",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "include-filter-stylus.pug"
}
],
"line": 0,
"filename": "include-filter-stylus.pug"
}

View File

@@ -0,0 +1,153 @@
{
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 3,
"filename": "include-filter.pug",
"path": "some.md",
"fullPath": "some.md",
"str": "Just _some_ markdown **tests**.\n\nWith new line.\n"
},
"line": 3,
"filename": "include-filter.pug",
"filters": [
{
"type": "IncludeFilter",
"name": "markdown-it",
"attrs": [],
"line": 3,
"filename": "include-filter.pug"
}
]
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 5,
"filename": "include-filter.pug",
"path": "include-filter-coffee.coffee",
"fullPath": "include-filter-coffee.coffee",
"str": "math =\n square: (value) -> value * value\n"
},
"line": 5,
"filename": "include-filter.pug",
"filters": [
{
"type": "IncludeFilter",
"name": "coffee-script",
"attrs": [
{
"name": "minify",
"val": "true",
"mustEscape": true
}
],
"line": 5,
"filename": "include-filter.pug"
}
]
}
],
"line": 4,
"filename": "include-filter.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "include-filter.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 7,
"filename": "include-filter.pug",
"path": "include-filter-coffee.coffee",
"fullPath": "include-filter-coffee.coffee",
"str": "math =\n square: (value) -> value * value\n"
},
"line": 7,
"filename": "include-filter.pug",
"filters": [
{
"type": "IncludeFilter",
"name": "coffee-script",
"attrs": [
{
"name": "minify",
"val": "false",
"mustEscape": true
}
],
"line": 7,
"filename": "include-filter.pug"
}
]
}
],
"line": 6,
"filename": "include-filter.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "include-filter.pug"
}
],
"line": 2,
"filename": "include-filter.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "include-filter.pug"
}
],
"line": 1,
"filename": "include-filter.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "include-filter.pug"
}
],
"line": 0,
"filename": "include-filter.pug"
}

View File

@@ -0,0 +1,24 @@
{
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "The message is \"",
"line": 1,
"filename": "include-only-text-body.pug"
},
{
"type": "YieldBlock",
"line": 2,
"filename": "include-only-text-body.pug"
},
{
"type": "Text",
"val": "\"",
"line": 3,
"filename": "include-only-text-body.pug"
}
],
"line": 0,
"filename": "include-only-text-body.pug"
}

View File

@@ -0,0 +1,125 @@
{
"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": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 4,
"filename": "include-only-text.pug",
"path": "include-only-text-body.pug",
"fullPath": "include-only-text-body.pug",
"str": "| The message is \"\nyield\n| \"\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "The message is \"",
"line": 1,
"filename": "include-only-text-body.pug"
},
{
"type": "YieldBlock",
"line": 2,
"filename": "include-only-text-body.pug"
},
{
"type": "Text",
"val": "\"",
"line": 3,
"filename": "include-only-text-body.pug"
}
],
"line": 0,
"filename": "include-only-text-body.pug"
}
},
"line": 4,
"filename": "include-only-text.pug",
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "em",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "hello world",
"line": 5,
"filename": "include-only-text.pug"
}
],
"line": 5,
"filename": "include-only-text.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": true,
"line": 5,
"filename": "include-only-text.pug"
}
],
"line": 5,
"filename": "include-only-text.pug"
}
}
],
"line": 3,
"filename": "include-only-text.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "include-only-text.pug"
}
],
"line": 2,
"filename": "include-only-text.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "include-only-text.pug"
}
],
"line": 1,
"filename": "include-only-text.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "include-only-text.pug"
}
],
"line": 0,
"filename": "include-only-text.pug"
}

View File

@@ -0,0 +1,53 @@
{
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "head",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "alert('hello world');",
"line": 3
}
],
"line": 2,
"filename": "include-with-text-head.pug"
},
"attrs": [
{
"name": "type",
"val": "'text/javascript'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "include-with-text-head.pug",
"textOnly": true
}
],
"line": 1,
"filename": "include-with-text-head.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "include-with-text-head.pug"
}
],
"line": 0,
"filename": "include-with-text-head.pug"
}

View File

@@ -0,0 +1,141 @@
{
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 2,
"filename": "include-with-text.pug",
"path": "include-with-text-head.pug",
"fullPath": "include-with-text-head.pug",
"str": "head\n script(type='text/javascript').\n alert('hello world');\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "head",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "alert('hello world');",
"line": 3
}
],
"line": 2,
"filename": "include-with-text-head.pug"
},
"attrs": [
{
"name": "type",
"val": "'text/javascript'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "include-with-text-head.pug",
"textOnly": true
}
],
"line": 1,
"filename": "include-with-text-head.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "include-with-text-head.pug"
}
],
"line": 0,
"filename": "include-with-text-head.pug"
}
},
"line": 2,
"filename": "include-with-text.pug",
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 3,
"filename": "include-with-text.pug"
},
"attrs": [
{
"name": "src",
"val": "'/caustic.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "include-with-text.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 4,
"filename": "include-with-text.pug"
},
"attrs": [
{
"name": "src",
"val": "'/app.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "include-with-text.pug"
}
],
"line": 3,
"filename": "include-with-text.pug"
}
}
],
"line": 1,
"filename": "include-with-text.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "include-with-text.pug"
}
],
"line": 0,
"filename": "include-with-text.pug"
}

View File

@@ -0,0 +1,130 @@
{
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 2,
"filename": "include.script.pug",
"path": "auxiliary/pet.pug",
"fullPath": "auxiliary/pet.pug",
"str": ".pet\n h1 {{name}}\n p {{name}} is a {{species}} that is {{age}} old",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "h1",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "{{name}}",
"line": 2,
"filename": "auxiliary/pet.pug"
}
],
"line": 2,
"filename": "auxiliary/pet.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "auxiliary/pet.pug"
},
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "{{name}} is a {{species}} that is {{age}} old",
"line": 3,
"filename": "auxiliary/pet.pug"
}
],
"line": 3,
"filename": "auxiliary/pet.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "auxiliary/pet.pug"
}
],
"line": 1,
"filename": "auxiliary/pet.pug"
},
"attrs": [
{
"name": "class",
"val": "'pet'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "auxiliary/pet.pug"
}
],
"line": 0,
"filename": "auxiliary/pet.pug"
}
},
"line": 2,
"filename": "include.script.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 2,
"filename": "include.script.pug"
}
}
],
"line": 1,
"filename": "include.script.pug"
},
"attrs": [
{
"name": "id",
"val": "'pet-template'",
"mustEscape": false
},
{
"name": "type",
"val": "'text/x-template'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "include.script.pug"
}
],
"line": 0,
"filename": "include.script.pug"
}

View File

@@ -0,0 +1,260 @@
{
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 2,
"filename": "include.yield.nested.pug",
"path": "auxiliary/yield-nested.pug",
"fullPath": "auxiliary/yield-nested.pug",
"str": "html\n head\n title\n body\n h1 Page\n #content\n #content-wrapper\n yield\n #footer\n stuff",
"ast": {
"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": "title",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 3,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 2,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "auxiliary/yield-nested.pug"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "h1",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Page",
"line": 5,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 5,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "auxiliary/yield-nested.pug"
},
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "YieldBlock",
"line": 8,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 7,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [
{
"name": "id",
"val": "'content-wrapper'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 7,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 6,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [
{
"name": "id",
"val": "'content'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "auxiliary/yield-nested.pug"
},
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "stuff",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 10,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 10,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 9,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [
{
"name": "id",
"val": "'footer'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 9,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 4,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 1,
"filename": "auxiliary/yield-nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "auxiliary/yield-nested.pug"
}
],
"line": 0,
"filename": "auxiliary/yield-nested.pug"
}
},
"line": 2,
"filename": "include.yield.nested.pug",
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "some content",
"line": 3,
"filename": "include.yield.nested.pug"
}
],
"line": 3,
"filename": "include.yield.nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "include.yield.nested.pug"
},
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "and some more",
"line": 4,
"filename": "include.yield.nested.pug"
}
],
"line": 4,
"filename": "include.yield.nested.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "include.yield.nested.pug"
}
],
"line": 3,
"filename": "include.yield.nested.pug"
}
}
],
"line": 0,
"filename": "include.yield.nested.pug"
}

View File

@@ -0,0 +1,55 @@
{
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "pre",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "code",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 3,
"filename": "includes-with-ext-js.pug",
"path": "javascript-new-lines.js",
"fullPath": "javascript-new-lines.js",
"str": "var x = \"\\n here is some \\n new lined text\";\n"
},
"line": 3,
"filename": "includes-with-ext-js.pug",
"filters": []
}
],
"line": 2,
"filename": "includes-with-ext-js.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": true,
"line": 2,
"filename": "includes-with-ext-js.pug"
}
],
"line": 1,
"filename": "includes-with-ext-js.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "includes-with-ext-js.pug"
}
],
"line": 0,
"filename": "includes-with-ext-js.pug"
}

172
node_modules/pug-linker/test/cases/includes.input.json generated vendored Normal file
View File

@@ -0,0 +1,172 @@
{
"type": "Block",
"nodes": [
{
"type": "Include",
"file": {
"type": "FileReference",
"line": 2,
"filename": "includes.pug",
"path": "auxiliary/mixins.pug",
"fullPath": "auxiliary/mixins.pug",
"str": "\nmixin foo()\n p bar",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Mixin",
"name": "foo",
"args": null,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "bar",
"line": 3,
"filename": "auxiliary/mixins.pug"
}
],
"line": 3,
"filename": "auxiliary/mixins.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "auxiliary/mixins.pug"
}
],
"line": 3,
"filename": "auxiliary/mixins.pug"
},
"call": false,
"line": 2,
"filename": "auxiliary/mixins.pug"
}
],
"line": 0,
"filename": "auxiliary/mixins.pug"
}
},
"line": 2,
"filename": "includes.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 2,
"filename": "includes.pug"
}
},
{
"type": "Mixin",
"name": "foo",
"args": null,
"block": null,
"call": true,
"attrs": [],
"attributeBlocks": [],
"line": 4,
"filename": "includes.pug"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 7,
"filename": "includes.pug",
"path": "auxiliary/smile.html",
"fullPath": "auxiliary/smile.html",
"str": "<p>:)</p>\n"
},
"line": 7,
"filename": "includes.pug",
"filters": []
},
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 8,
"filename": "includes.pug",
"path": "auxiliary/escapes.html",
"fullPath": "auxiliary/escapes.html",
"str": "<script>\n console.log(\"foo\\nbar\")\n</script>\n"
},
"line": 8,
"filename": "includes.pug",
"filters": []
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "RawInclude",
"file": {
"type": "FileReference",
"line": 10,
"filename": "includes.pug",
"path": "auxiliary/includable.js",
"fullPath": "auxiliary/includable.js",
"str": "var STRING_SUBSTITUTIONS = { // table of character substitutions\n '\\t': '\\\\t',\n '\\r': '\\\\r',\n '\\n': '\\\\n',\n '\"' : '\\\\\"',\n '\\\\': '\\\\\\\\'\n};"
},
"line": 10,
"filename": "includes.pug",
"filters": [
{
"type": "IncludeFilter",
"name": "verbatim",
"attrs": [],
"line": 10,
"filename": "includes.pug"
}
]
}
],
"line": 9,
"filename": "includes.pug"
},
"attrs": [
{
"name": "type",
"val": "\"text/javascript\"",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 9,
"filename": "includes.pug"
}
],
"line": 6,
"filename": "includes.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "includes.pug"
}
],
"line": 0,
"filename": "includes.pug"
}

View File

@@ -0,0 +1,226 @@
{
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/append/app-layout.pug",
"line": 2,
"filename": "layout.append.pug",
"fullPath": "../fixtures/append/app-layout.pug",
"str": "\nextends layout\n\nblock append head\n script(src='app.js')",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "layout",
"line": 2,
"filename": "../fixtures/append/app-layout.pug",
"fullPath": "../fixtures/append/layout.pug",
"str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 4,
"filename": "../fixtures/append/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/jquery.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "../fixtures/append/layout.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/append/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/caustic.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/append/layout.pug"
}
],
"line": 3,
"filename": "../fixtures/append/layout.pug",
"name": "head",
"mode": "replace"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 7,
"filename": "../fixtures/append/layout.pug",
"name": "body",
"mode": "replace"
}
],
"line": 6,
"filename": "../fixtures/append/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "../fixtures/append/layout.pug"
}
],
"line": 2,
"filename": "../fixtures/append/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "../fixtures/append/layout.pug"
}
],
"line": 0,
"filename": "../fixtures/append/layout.pug"
}
},
"line": 2,
"filename": "../fixtures/append/app-layout.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/append/app-layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'app.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/append/app-layout.pug"
}
],
"line": 4,
"filename": "../fixtures/append/app-layout.pug",
"name": "head",
"mode": "append"
}
],
"line": 0,
"filename": "../fixtures/append/app-layout.pug"
}
},
"line": 2,
"filename": "layout.append.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "layout.append.pug"
},
"attrs": [
{
"name": "src",
"val": "'foo.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "layout.append.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 6,
"filename": "layout.append.pug"
},
"attrs": [
{
"name": "src",
"val": "'bar.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "layout.append.pug"
}
],
"line": 4,
"filename": "layout.append.pug",
"name": "head",
"mode": "append"
}
],
"line": 0,
"filename": "layout.append.pug"
}

View File

@@ -0,0 +1,226 @@
{
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/append-without-block/app-layout.pug",
"line": 2,
"filename": "layout.append.without-block.pug",
"fullPath": "../fixtures/append-without-block/app-layout.pug",
"str": "\nextends layout.pug\n\nappend head\n script(src='app.js')\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "layout.pug",
"line": 2,
"filename": "../fixtures/append-without-block/app-layout.pug",
"fullPath": "../fixtures/append-without-block/layout.pug",
"str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 4,
"filename": "../fixtures/append-without-block/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/jquery.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "../fixtures/append-without-block/layout.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/append-without-block/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/caustic.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/append-without-block/layout.pug"
}
],
"line": 3,
"filename": "../fixtures/append-without-block/layout.pug",
"name": "head",
"mode": "replace"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 7,
"filename": "../fixtures/append-without-block/layout.pug",
"name": "body",
"mode": "replace"
}
],
"line": 6,
"filename": "../fixtures/append-without-block/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "../fixtures/append-without-block/layout.pug"
}
],
"line": 2,
"filename": "../fixtures/append-without-block/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "../fixtures/append-without-block/layout.pug"
}
],
"line": 0,
"filename": "../fixtures/append-without-block/layout.pug"
}
},
"line": 2,
"filename": "../fixtures/append-without-block/app-layout.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/append-without-block/app-layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'app.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/append-without-block/app-layout.pug"
}
],
"line": 4,
"filename": "../fixtures/append-without-block/app-layout.pug",
"name": "head",
"mode": "append"
}
],
"line": 0,
"filename": "../fixtures/append-without-block/app-layout.pug"
}
},
"line": 2,
"filename": "layout.append.without-block.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "layout.append.without-block.pug"
},
"attrs": [
{
"name": "src",
"val": "'foo.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "layout.append.without-block.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 6,
"filename": "layout.append.without-block.pug"
},
"attrs": [
{
"name": "src",
"val": "'bar.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "layout.append.without-block.pug"
}
],
"line": 4,
"filename": "layout.append.without-block.pug",
"name": "head",
"mode": "append"
}
],
"line": 0,
"filename": "layout.append.without-block.pug"
}

View File

@@ -0,0 +1,365 @@
{
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/multi-append-prepend-block/redefine.pug",
"line": 1,
"filename": "layout.multi.append.prepend.block.pug",
"fullPath": "../fixtures/multi-append-prepend-block/redefine.pug",
"str": "extends root.pug\n\nblock content\n\t.content\n\t\t| Defined content\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "root.pug",
"line": 1,
"filename": "../fixtures/multi-append-prepend-block/redefine.pug",
"fullPath": "../fixtures/multi-append-prepend-block/root.pug",
"str": "block content\n\t| default content\n\nblock head\n\tscript(src='/app.js')",
"ast": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Text",
"val": "default content",
"line": 2,
"filename": "../fixtures/multi-append-prepend-block/root.pug"
}
],
"line": 1,
"filename": "../fixtures/multi-append-prepend-block/root.pug",
"name": "content",
"mode": "replace"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/multi-append-prepend-block/root.pug"
},
"attrs": [
{
"name": "src",
"val": "'/app.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/multi-append-prepend-block/root.pug"
}
],
"line": 4,
"filename": "../fixtures/multi-append-prepend-block/root.pug",
"name": "head",
"mode": "replace"
}
],
"line": 0,
"filename": "../fixtures/multi-append-prepend-block/root.pug"
}
},
"line": 1,
"filename": "../fixtures/multi-append-prepend-block/redefine.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Defined content",
"line": 5,
"filename": "../fixtures/multi-append-prepend-block/redefine.pug"
}
],
"line": 4,
"filename": "../fixtures/multi-append-prepend-block/redefine.pug"
},
"attrs": [
{
"name": "class",
"val": "'content'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "../fixtures/multi-append-prepend-block/redefine.pug"
}
],
"line": 3,
"filename": "../fixtures/multi-append-prepend-block/redefine.pug",
"name": "content",
"mode": "replace"
}
],
"line": 0,
"filename": "../fixtures/multi-append-prepend-block/redefine.pug"
}
},
"line": 1,
"filename": "layout.multi.append.prepend.block.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Something appended to content",
"line": 4,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 4,
"filename": "layout.multi.append.prepend.block.pug"
},
"attrs": [
{
"name": "class",
"val": "'first'",
"mustEscape": false
},
{
"name": "class",
"val": "'append'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 3,
"filename": "layout.multi.append.prepend.block.pug",
"name": "content",
"mode": "append"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Something prepended to content",
"line": 7,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 7,
"filename": "layout.multi.append.prepend.block.pug"
},
"attrs": [
{
"name": "class",
"val": "'first'",
"mustEscape": false
},
{
"name": "class",
"val": "'prepend'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 7,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 6,
"filename": "layout.multi.append.prepend.block.pug",
"name": "content",
"mode": "prepend"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Last append must be most last",
"line": 10,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 10,
"filename": "layout.multi.append.prepend.block.pug"
},
"attrs": [
{
"name": "class",
"val": "'last'",
"mustEscape": false
},
{
"name": "class",
"val": "'append'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 10,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 9,
"filename": "layout.multi.append.prepend.block.pug",
"name": "content",
"mode": "append"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Last prepend must appear at top",
"line": 13,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 13,
"filename": "layout.multi.append.prepend.block.pug"
},
"attrs": [
{
"name": "class",
"val": "'last'",
"mustEscape": false
},
{
"name": "class",
"val": "'prepend'",
"mustEscape": false
}
],
"attributeBlocks": [],
"isInline": false,
"line": 13,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 12,
"filename": "layout.multi.append.prepend.block.pug",
"name": "content",
"mode": "prepend"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 16,
"filename": "layout.multi.append.prepend.block.pug"
},
"attrs": [
{
"name": "src",
"val": "'jquery.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 16,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 15,
"filename": "layout.multi.append.prepend.block.pug",
"name": "head",
"mode": "append"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 19,
"filename": "layout.multi.append.prepend.block.pug"
},
"attrs": [
{
"name": "src",
"val": "'foo.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 19,
"filename": "layout.multi.append.prepend.block.pug"
}
],
"line": 18,
"filename": "layout.multi.append.prepend.block.pug",
"name": "head",
"mode": "prepend"
}
],
"line": 0,
"filename": "layout.multi.append.prepend.block.pug"
}

View File

@@ -0,0 +1,226 @@
{
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/prepend/app-layout.pug",
"line": 2,
"filename": "layout.prepend.pug",
"fullPath": "../fixtures/prepend/app-layout.pug",
"str": "\nextends layout.pug\n\nblock prepend head\n script(src='app.js')\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "layout.pug",
"line": 2,
"filename": "../fixtures/prepend/app-layout.pug",
"fullPath": "../fixtures/prepend/layout.pug",
"str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 4,
"filename": "../fixtures/prepend/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/jquery.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "../fixtures/prepend/layout.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/prepend/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/caustic.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/prepend/layout.pug"
}
],
"line": 3,
"filename": "../fixtures/prepend/layout.pug",
"name": "head",
"mode": "replace"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 7,
"filename": "../fixtures/prepend/layout.pug",
"name": "body",
"mode": "replace"
}
],
"line": 6,
"filename": "../fixtures/prepend/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "../fixtures/prepend/layout.pug"
}
],
"line": 2,
"filename": "../fixtures/prepend/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "../fixtures/prepend/layout.pug"
}
],
"line": 0,
"filename": "../fixtures/prepend/layout.pug"
}
},
"line": 2,
"filename": "../fixtures/prepend/app-layout.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/prepend/app-layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'app.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/prepend/app-layout.pug"
}
],
"line": 4,
"filename": "../fixtures/prepend/app-layout.pug",
"name": "head",
"mode": "prepend"
}
],
"line": 0,
"filename": "../fixtures/prepend/app-layout.pug"
}
},
"line": 2,
"filename": "layout.prepend.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "layout.prepend.pug"
},
"attrs": [
{
"name": "src",
"val": "'foo.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "layout.prepend.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 6,
"filename": "layout.prepend.pug"
},
"attrs": [
{
"name": "src",
"val": "'bar.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "layout.prepend.pug"
}
],
"line": 4,
"filename": "layout.prepend.pug",
"name": "head",
"mode": "prepend"
}
],
"line": 0,
"filename": "layout.prepend.pug"
}

View File

@@ -0,0 +1,226 @@
{
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/prepend-without-block/app-layout.pug",
"line": 2,
"filename": "layout.prepend.without-block.pug",
"fullPath": "../fixtures/prepend-without-block/app-layout.pug",
"str": "\nextends layout.pug\n\nprepend head\n script(src='app.js')\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "layout.pug",
"line": 2,
"filename": "../fixtures/prepend-without-block/app-layout.pug",
"fullPath": "../fixtures/prepend-without-block/layout.pug",
"str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 4,
"filename": "../fixtures/prepend-without-block/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/jquery.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "../fixtures/prepend-without-block/layout.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/prepend-without-block/layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'vendor/caustic.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/prepend-without-block/layout.pug"
}
],
"line": 3,
"filename": "../fixtures/prepend-without-block/layout.pug",
"name": "head",
"mode": "replace"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 7,
"filename": "../fixtures/prepend-without-block/layout.pug",
"name": "body",
"mode": "replace"
}
],
"line": 6,
"filename": "../fixtures/prepend-without-block/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "../fixtures/prepend-without-block/layout.pug"
}
],
"line": 2,
"filename": "../fixtures/prepend-without-block/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "../fixtures/prepend-without-block/layout.pug"
}
],
"line": 0,
"filename": "../fixtures/prepend-without-block/layout.pug"
}
},
"line": 2,
"filename": "../fixtures/prepend-without-block/app-layout.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "../fixtures/prepend-without-block/app-layout.pug"
},
"attrs": [
{
"name": "src",
"val": "'app.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "../fixtures/prepend-without-block/app-layout.pug"
}
],
"line": 4,
"filename": "../fixtures/prepend-without-block/app-layout.pug",
"name": "head",
"mode": "prepend"
}
],
"line": 0,
"filename": "../fixtures/prepend-without-block/app-layout.pug"
}
},
"line": 2,
"filename": "layout.prepend.without-block.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 5,
"filename": "layout.prepend.without-block.pug"
},
"attrs": [
{
"name": "src",
"val": "'foo.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 5,
"filename": "layout.prepend.without-block.pug"
},
{
"type": "Tag",
"name": "script",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [],
"line": 6,
"filename": "layout.prepend.without-block.pug"
},
"attrs": [
{
"name": "src",
"val": "'bar.js'",
"mustEscape": true
}
],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "layout.prepend.without-block.pug"
}
],
"line": 4,
"filename": "layout.prepend.without-block.pug",
"name": "head",
"mode": "prepend"
}
],
"line": 0,
"filename": "layout.prepend.without-block.pug"
}

View File

@@ -0,0 +1,6 @@
extend ../fixtures/layout
block body
p Hello world!
p BAD!!!

View File

@@ -0,0 +1,4 @@
block body
p Hey
extends ../fixtures/layout

View File

@@ -0,0 +1,4 @@
extends ../fixtures/empty.pug
block foo
div Hello World

View File

@@ -0,0 +1,163 @@
{
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/layout",
"line": 1,
"filename": "child-with-tags.pug",
"fullPath": "../fixtures/layout.pug",
"str": "doctype\n\nhtml\n head\n block head\n <title>Hello world!</title>\n body\n block body\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Doctype",
"val": "",
"line": 1,
"filename": "../fixtures/layout.pug"
},
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "head",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Text",
"val": "<title>Hello world!</title>",
"filename": "../fixtures/layout.pug",
"line": 6,
"isHtml": true
}
],
"line": 5,
"filename": "../fixtures/layout.pug",
"name": "head",
"mode": "replace"
}
],
"line": 4,
"filename": "../fixtures/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "../fixtures/layout.pug"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 8,
"filename": "../fixtures/layout.pug",
"name": "body",
"mode": "replace"
}
],
"line": 7,
"filename": "../fixtures/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 7,
"filename": "../fixtures/layout.pug"
}
],
"line": 3,
"filename": "../fixtures/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "../fixtures/layout.pug"
}
],
"line": 0,
"filename": "../fixtures/layout.pug"
}
},
"line": 1,
"filename": "child-with-tags.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Hello world!",
"line": 4,
"filename": "child-with-tags.pug"
}
],
"line": 4,
"filename": "child-with-tags.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "child-with-tags.pug"
}
],
"line": 3,
"filename": "child-with-tags.pug",
"name": "body",
"mode": "replace"
},
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "BAD!!!",
"line": 6,
"filename": "child-with-tags.pug"
}
],
"line": 6,
"filename": "child-with-tags.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 6,
"filename": "child-with-tags.pug"
}
],
"line": 0,
"filename": "child-with-tags.pug"
}

View File

@@ -0,0 +1,140 @@
{
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "p",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Hey",
"line": 2,
"filename": "extends-not-first.pug"
}
],
"line": 2,
"filename": "extends-not-first.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 2,
"filename": "extends-not-first.pug"
}
],
"line": 1,
"filename": "extends-not-first.pug",
"name": "body",
"mode": "replace"
},
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/layout",
"line": 4,
"filename": "extends-not-first.pug",
"fullPath": "../fixtures/layout.pug",
"str": "doctype\n\nhtml\n head\n block head\n <title>Hello world!</title>\n body\n block body\n",
"ast": {
"type": "Block",
"nodes": [
{
"type": "Doctype",
"val": "",
"line": 1,
"filename": "../fixtures/layout.pug"
},
{
"type": "Tag",
"name": "html",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Tag",
"name": "head",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [
{
"type": "Text",
"val": "<title>Hello world!</title>",
"filename": "../fixtures/layout.pug",
"line": 6,
"isHtml": true
}
],
"line": 5,
"filename": "../fixtures/layout.pug",
"name": "head",
"mode": "replace"
}
],
"line": 4,
"filename": "../fixtures/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "../fixtures/layout.pug"
},
{
"type": "Tag",
"name": "body",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "NamedBlock",
"nodes": [],
"line": 8,
"filename": "../fixtures/layout.pug",
"name": "body",
"mode": "replace"
}
],
"line": 7,
"filename": "../fixtures/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 7,
"filename": "../fixtures/layout.pug"
}
],
"line": 3,
"filename": "../fixtures/layout.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 3,
"filename": "../fixtures/layout.pug"
}
],
"line": 0,
"filename": "../fixtures/layout.pug"
}
},
"line": 4,
"filename": "extends-not-first.pug"
}
],
"line": 0,
"filename": "extends-not-first.pug"
}

View File

@@ -0,0 +1,58 @@
{
"type": "Block",
"nodes": [
{
"type": "Extends",
"file": {
"type": "FileReference",
"path": "../fixtures/empty.pug",
"line": 1,
"filename": "unexpected-block.pug",
"fullPath": "../fixtures/empty.pug",
"str": "",
"ast": {
"type": "Block",
"nodes": [],
"line": 0,
"filename": "../fixtures/empty.pug"
}
},
"line": 1,
"filename": "unexpected-block.pug"
},
{
"type": "NamedBlock",
"nodes": [
{
"type": "Tag",
"name": "div",
"selfClosing": false,
"block": {
"type": "Block",
"nodes": [
{
"type": "Text",
"val": "Hello World",
"line": 4,
"filename": "unexpected-block.pug"
}
],
"line": 4,
"filename": "unexpected-block.pug"
},
"attrs": [],
"attributeBlocks": [],
"isInline": false,
"line": 4,
"filename": "unexpected-block.pug"
}
],
"line": 3,
"filename": "unexpected-block.pug",
"name": "foo",
"mode": "replace"
}
],
"line": 0,
"filename": "unexpected-block.pug"
}

View File

@@ -0,0 +1,5 @@
extends layout.pug
append head
script(src='app.js')

View File

@@ -0,0 +1,7 @@
html
block head
script(src='vendor/jquery.js')
script(src='vendor/caustic.js')
body
block body

View File

@@ -0,0 +1,6 @@
extends app-layout.pug
append head
script(src='foo.js')
script(src='bar.js')

View File

@@ -0,0 +1,5 @@
extends layout
block append head
script(src='app.js')

View File

@@ -0,0 +1,7 @@
html
block head
script(src='vendor/jquery.js')
script(src='vendor/caustic.js')
body
block body

View File

@@ -0,0 +1,9 @@
<html>
<script src="vendor/jquery.js"></script>
<script src="vendor/caustic.js"></script>
<script src="app.js"></script>
<script src="foo.js"></script>
<script src="bar.js"></script>
<body>
</body>
</html>

View File

@@ -0,0 +1,6 @@
extends app-layout
block append head
script(src='foo.js')
script(src='bar.js')

0
node_modules/pug-linker/test/fixtures/empty.pug generated vendored Normal file
View File

8
node_modules/pug-linker/test/fixtures/layout.pug generated vendored Normal file
View File

@@ -0,0 +1,8 @@
doctype
html
head
block head
<title>Hello world!</title>
body
block body

2
node_modules/pug-linker/test/fixtures/mixins.pug generated vendored Normal file
View File

@@ -0,0 +1,2 @@
mixin image(src)
img(cl-src=src)&attributes(attributes)

View File

@@ -0,0 +1,5 @@
extends root.pug
block content
.content
| Defined content

View File

@@ -0,0 +1,5 @@
block content
| default content
block head
script(src='/app.js')

View File

@@ -0,0 +1,5 @@
extends layout.pug
prepend head
script(src='app.js')

View File

@@ -0,0 +1,7 @@
html
block head
script(src='vendor/jquery.js')
script(src='vendor/caustic.js')
body
block body

View File

@@ -0,0 +1,9 @@
<html>
<script src="foo.js"></script>
<script src="bar.js"></script>
<script src="app.js"></script>
<script src="vendor/jquery.js"></script>
<script src="vendor/caustic.js"></script>
<body>
</body>
</html>

View File

@@ -0,0 +1,6 @@
extends app-layout.pug
prepend head
script(src='foo.js')
script(src='bar.js')

View File

@@ -0,0 +1,5 @@
extends layout.pug
block prepend head
script(src='app.js')

View File

@@ -0,0 +1,7 @@
html
block head
script(src='vendor/jquery.js')
script(src='vendor/caustic.js')
body
block body

View File

@@ -0,0 +1,9 @@
<html>
<script src="foo.js"></script>
<script src="bar.js"></script>
<script src="app.js"></script>
<script src="vendor/jquery.js"></script>
<script src="vendor/caustic.js"></script>
<body>
</body>
</html>

View File

@@ -0,0 +1,6 @@
extends app-layout.pug
block prepend head
script(src='foo.js')
script(src='bar.js')

46
node_modules/pug-linker/test/index.test.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
var assert = require('assert');
var fs = require('fs');
var link = require('../');
function testDir (dir) {
fs.readdirSync(dir).forEach(function (name) {
if (!/\.input\.json$/.test(name)) return;
test(name, function () {
var actual = link(JSON.parse(fs.readFileSync(dir + '/' + name, 'utf8')));
expect(actual).toMatchSnapshot();
});
});
}
function testDirError (dir) {
fs.readdirSync(dir).forEach(function (name) {
if (!/\.input\.json$/.test(name)) return;
test(name, function () {
var input = JSON.parse(fs.readFileSync(dir + '/' + name, 'utf8'));
var err;
try {
link(input);
} catch (ex) {
err = {
msg: ex.msg,
code: ex.code,
line: ex.line
};
}
if (!err) throw new Error('Expected error')
expect(err).toMatchSnapshot();
});
});
}
describe('cases from pug', function () {
testDir(__dirname + '/cases');
});
describe('special cases', function () {
testDir(__dirname + '/special-cases');
});
describe('error handling', function () {
testDirError(__dirname + '/errors');
});

View File

@@ -0,0 +1 @@
extend ../fixtures/empty.pug

Some files were not shown because too many files have changed in this diff Show More