fix: add scoped error logging for lexer/parser errors
- Add std.log.scoped(.pugz) to template.zig and view_engine.zig - Log detailed error info (code, line, column, message) when parsing fails - Log template path context in ViewEngine on parse errors - Remove debug print from lexer, use proper scoped logging instead - Move benchmarks, docs, examples, playground, tests out of src/ to project root - Update build.zig and documentation paths accordingly - Bump version to 0.3.1
This commit is contained in:
4155
tests/sample_data/pug-linker/test/__snapshots__/index.test.js.snap
Normal file
4155
tests/sample_data/pug-linker/test/__snapshots__/index.test.js.snap
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
block content
|
||||
@@ -0,0 +1,4 @@
|
||||
mixin test()
|
||||
.test&attributes(attributes)
|
||||
|
||||
+test()
|
||||
@@ -0,0 +1,8 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
title Default title
|
||||
body
|
||||
block body
|
||||
.container
|
||||
block content
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
extends window.pug
|
||||
|
||||
block window-content
|
||||
.dialog
|
||||
block content
|
||||
@@ -0,0 +1,2 @@
|
||||
block test
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<script>
|
||||
console.log("foo\nbar")
|
||||
</script>
|
||||
@@ -0,0 +1,5 @@
|
||||
extends empty-block.pug
|
||||
|
||||
block test
|
||||
div test1
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
extends empty-block.pug
|
||||
|
||||
block test
|
||||
div test2
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
extends /auxiliary/layout.pug
|
||||
|
||||
block content
|
||||
include /auxiliary/include-from-root.pug
|
||||
@@ -0,0 +1,4 @@
|
||||
extends ../../cases-src/auxiliary/layout
|
||||
|
||||
block content
|
||||
include ../../cases-src/auxiliary/include-from-root
|
||||
@@ -0,0 +1,8 @@
|
||||
html
|
||||
head
|
||||
style(type="text/css")
|
||||
:less
|
||||
@pad: 15px;
|
||||
body {
|
||||
padding: @pad;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
var STRING_SUBSTITUTIONS = {
|
||||
// table of character substitutions
|
||||
'\t': '\\t',
|
||||
'\r': '\\r',
|
||||
'\n': '\\n',
|
||||
'"': '\\"',
|
||||
'\\': '\\\\',
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
h1 hello
|
||||
@@ -0,0 +1,11 @@
|
||||
mixin article()
|
||||
article
|
||||
block
|
||||
|
||||
html
|
||||
head
|
||||
title My Application
|
||||
block head
|
||||
body
|
||||
+article
|
||||
block content
|
||||
@@ -0,0 +1,2 @@
|
||||
h1 grand-grandparent
|
||||
block grand-grandparent
|
||||
@@ -0,0 +1,6 @@
|
||||
extends inheritance.extend.recursive-grand-grandparent.pug
|
||||
|
||||
block grand-grandparent
|
||||
h2 grandparent
|
||||
block grandparent
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
extends inheritance.extend.recursive-grandparent.pug
|
||||
|
||||
block grandparent
|
||||
h3 parent
|
||||
block parent
|
||||
@@ -0,0 +1,7 @@
|
||||
html
|
||||
head
|
||||
title My Application
|
||||
block head
|
||||
body
|
||||
block content
|
||||
include window.pug
|
||||
@@ -0,0 +1,6 @@
|
||||
html
|
||||
head
|
||||
title My Application
|
||||
block head
|
||||
body
|
||||
block content
|
||||
@@ -0,0 +1,3 @@
|
||||
mixin slide
|
||||
section.slide
|
||||
block
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
mixin foo()
|
||||
p bar
|
||||
@@ -0,0 +1,3 @@
|
||||
.pet
|
||||
h1 {{name}}
|
||||
p {{name}} is a {{species}} that is {{age}} old
|
||||
@@ -0,0 +1 @@
|
||||
<p>:)</p>
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
.window
|
||||
a(href='#').close Close
|
||||
block window-content
|
||||
@@ -0,0 +1,10 @@
|
||||
html
|
||||
head
|
||||
title
|
||||
body
|
||||
h1 Page
|
||||
#content
|
||||
#content-wrapper
|
||||
yield
|
||||
#footer
|
||||
stuff
|
||||
@@ -0,0 +1 @@
|
||||
include /auxiliary/extends-from-root.pug
|
||||
@@ -0,0 +1,2 @@
|
||||
include auxiliary/extends-empty-block-1.pug
|
||||
include auxiliary/extends-empty-block-2.pug
|
||||
@@ -0,0 +1 @@
|
||||
include ../cases-src/auxiliary/extends-relative.pug
|
||||
@@ -0,0 +1,2 @@
|
||||
math =
|
||||
square: (value) -> value * value
|
||||
@@ -0,0 +1,2 @@
|
||||
style(type="text/css")
|
||||
include:stylus some.styl
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
| The message is "
|
||||
yield
|
||||
| "
|
||||
@@ -0,0 +1,5 @@
|
||||
html
|
||||
body
|
||||
p
|
||||
include include-only-text-body.pug
|
||||
em hello world
|
||||
@@ -0,0 +1,3 @@
|
||||
head
|
||||
script(type='text/javascript').
|
||||
alert('hello world');
|
||||
@@ -0,0 +1,4 @@
|
||||
html
|
||||
include include-with-text-head.pug
|
||||
script(src='/caustic.js')
|
||||
script(src='/app.js')
|
||||
@@ -0,0 +1,2 @@
|
||||
script#pet-template(type='text/x-template')
|
||||
include auxiliary/pet.pug
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
include auxiliary/yield-nested.pug
|
||||
p some content
|
||||
p and some more
|
||||
@@ -0,0 +1,3 @@
|
||||
pre
|
||||
code
|
||||
include javascript-new-lines.js
|
||||
10
tests/sample_data/pug-linker/test/cases-src/includes.pug
Normal file
10
tests/sample_data/pug-linker/test/cases-src/includes.pug
Normal 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
|
||||
@@ -0,0 +1 @@
|
||||
var x = '\n here is some \n new lined text';
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
extends ../fixtures/append/app-layout.pug
|
||||
|
||||
block append head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
extends ../fixtures/append-without-block/app-layout.pug
|
||||
|
||||
append head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
@@ -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')
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
extends ../fixtures/prepend/app-layout.pug
|
||||
|
||||
block prepend head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
extends ../fixtures/prepend-without-block/app-layout.pug
|
||||
|
||||
prepend head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
@@ -0,0 +1,2 @@
|
||||
body
|
||||
padding 10px
|
||||
3
tests/sample_data/pug-linker/test/cases-src/some.md
Normal file
3
tests/sample_data/pug-linker/test/cases-src/some.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Just _some_ markdown **tests**.
|
||||
|
||||
With new line.
|
||||
1
tests/sample_data/pug-linker/test/cases-src/some.styl
Normal file
1
tests/sample_data/pug-linker/test/cases-src/some.styl
Normal file
@@ -0,0 +1 @@
|
||||
@import "some-included"
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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
tests/sample_data/pug-linker/test/cases/includes.input.json
Normal file
172
tests/sample_data/pug-linker/test/cases/includes.input.json
Normal 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"
|
||||
}
|
||||
226
tests/sample_data/pug-linker/test/cases/layout.append.input.json
Normal file
226
tests/sample_data/pug-linker/test/cases/layout.append.input.json
Normal 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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
extend ../fixtures/layout
|
||||
|
||||
block body
|
||||
p Hello world!
|
||||
|
||||
p BAD!!!
|
||||
@@ -0,0 +1,4 @@
|
||||
block body
|
||||
p Hey
|
||||
|
||||
extends ../fixtures/layout
|
||||
@@ -0,0 +1,4 @@
|
||||
extends ../fixtures/empty.pug
|
||||
|
||||
block foo
|
||||
div Hello World
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
5
tests/sample_data/pug-linker/test/fixtures/append-without-block/app-layout.pug
vendored
Normal file
5
tests/sample_data/pug-linker/test/fixtures/append-without-block/app-layout.pug
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
extends layout.pug
|
||||
|
||||
append head
|
||||
script(src='app.js')
|
||||
7
tests/sample_data/pug-linker/test/fixtures/append-without-block/layout.pug
vendored
Normal file
7
tests/sample_data/pug-linker/test/fixtures/append-without-block/layout.pug
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
html
|
||||
block head
|
||||
script(src='vendor/jquery.js')
|
||||
script(src='vendor/caustic.js')
|
||||
body
|
||||
block body
|
||||
6
tests/sample_data/pug-linker/test/fixtures/append-without-block/page.pug
vendored
Normal file
6
tests/sample_data/pug-linker/test/fixtures/append-without-block/page.pug
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
extends app-layout.pug
|
||||
|
||||
append head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
5
tests/sample_data/pug-linker/test/fixtures/append/app-layout.pug
vendored
Normal file
5
tests/sample_data/pug-linker/test/fixtures/append/app-layout.pug
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
extends layout
|
||||
|
||||
block append head
|
||||
script(src='app.js')
|
||||
7
tests/sample_data/pug-linker/test/fixtures/append/layout.pug
vendored
Normal file
7
tests/sample_data/pug-linker/test/fixtures/append/layout.pug
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
html
|
||||
block head
|
||||
script(src='vendor/jquery.js')
|
||||
script(src='vendor/caustic.js')
|
||||
body
|
||||
block body
|
||||
9
tests/sample_data/pug-linker/test/fixtures/append/page.html
vendored
Normal file
9
tests/sample_data/pug-linker/test/fixtures/append/page.html
vendored
Normal 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>
|
||||
6
tests/sample_data/pug-linker/test/fixtures/append/page.pug
vendored
Normal file
6
tests/sample_data/pug-linker/test/fixtures/append/page.pug
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
extends app-layout
|
||||
|
||||
block append head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
0
tests/sample_data/pug-linker/test/fixtures/empty.pug
vendored
Normal file
0
tests/sample_data/pug-linker/test/fixtures/empty.pug
vendored
Normal file
8
tests/sample_data/pug-linker/test/fixtures/layout.pug
vendored
Normal file
8
tests/sample_data/pug-linker/test/fixtures/layout.pug
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
doctype
|
||||
|
||||
html
|
||||
head
|
||||
block head
|
||||
<title>Hello world!</title>
|
||||
body
|
||||
block body
|
||||
2
tests/sample_data/pug-linker/test/fixtures/mixins.pug
vendored
Normal file
2
tests/sample_data/pug-linker/test/fixtures/mixins.pug
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
mixin image(src)
|
||||
img(cl-src=src)&attributes(attributes)
|
||||
5
tests/sample_data/pug-linker/test/fixtures/multi-append-prepend-block/redefine.pug
vendored
Normal file
5
tests/sample_data/pug-linker/test/fixtures/multi-append-prepend-block/redefine.pug
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
extends root.pug
|
||||
|
||||
block content
|
||||
.content
|
||||
| Defined content
|
||||
5
tests/sample_data/pug-linker/test/fixtures/multi-append-prepend-block/root.pug
vendored
Normal file
5
tests/sample_data/pug-linker/test/fixtures/multi-append-prepend-block/root.pug
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
block content
|
||||
| default content
|
||||
|
||||
block head
|
||||
script(src='/app.js')
|
||||
5
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/app-layout.pug
vendored
Normal file
5
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/app-layout.pug
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
extends layout.pug
|
||||
|
||||
prepend head
|
||||
script(src='app.js')
|
||||
7
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/layout.pug
vendored
Normal file
7
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/layout.pug
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
html
|
||||
block head
|
||||
script(src='vendor/jquery.js')
|
||||
script(src='vendor/caustic.js')
|
||||
body
|
||||
block body
|
||||
9
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/page.html
vendored
Normal file
9
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/page.html
vendored
Normal 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>
|
||||
6
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/page.pug
vendored
Normal file
6
tests/sample_data/pug-linker/test/fixtures/prepend-without-block/page.pug
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
extends app-layout.pug
|
||||
|
||||
prepend head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
5
tests/sample_data/pug-linker/test/fixtures/prepend/app-layout.pug
vendored
Normal file
5
tests/sample_data/pug-linker/test/fixtures/prepend/app-layout.pug
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
extends layout.pug
|
||||
|
||||
block prepend head
|
||||
script(src='app.js')
|
||||
7
tests/sample_data/pug-linker/test/fixtures/prepend/layout.pug
vendored
Normal file
7
tests/sample_data/pug-linker/test/fixtures/prepend/layout.pug
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
html
|
||||
block head
|
||||
script(src='vendor/jquery.js')
|
||||
script(src='vendor/caustic.js')
|
||||
body
|
||||
block body
|
||||
9
tests/sample_data/pug-linker/test/fixtures/prepend/page.html
vendored
Normal file
9
tests/sample_data/pug-linker/test/fixtures/prepend/page.html
vendored
Normal 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>
|
||||
6
tests/sample_data/pug-linker/test/fixtures/prepend/page.pug
vendored
Normal file
6
tests/sample_data/pug-linker/test/fixtures/prepend/page.pug
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
extends app-layout.pug
|
||||
|
||||
block prepend head
|
||||
script(src='foo.js')
|
||||
script(src='bar.js')
|
||||
46
tests/sample_data/pug-linker/test/index.test.js
Normal file
46
tests/sample_data/pug-linker/test/index.test.js
Normal 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');
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
extend ../fixtures/empty.pug
|
||||
@@ -0,0 +1,5 @@
|
||||
extend ../fixtures/layout.pug
|
||||
include ../fixtures/mixins.pug
|
||||
|
||||
block body
|
||||
+image('myimg.png').with-border(alt="My image")
|
||||
@@ -0,0 +1,9 @@
|
||||
extend ../fixtures/layout.pug
|
||||
|
||||
mixin myMixin
|
||||
p Hello world
|
||||
|
||||
block body
|
||||
p Before
|
||||
+myMixin
|
||||
p After
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Extends",
|
||||
"file": {
|
||||
"type": "FileReference",
|
||||
"path": "../fixtures/empty.pug",
|
||||
"line": 1,
|
||||
"filename": "extending-empty.pug",
|
||||
"fullPath": "../fixtures/empty.pug",
|
||||
"str": "",
|
||||
"ast": {
|
||||
"type": "Block",
|
||||
"nodes": [],
|
||||
"line": 0,
|
||||
"filename": "../fixtures/empty.pug"
|
||||
}
|
||||
},
|
||||
"line": 1,
|
||||
"filename": "extending-empty.pug"
|
||||
}
|
||||
],
|
||||
"line": 0,
|
||||
"filename": "extending-empty.pug"
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
{
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Extends",
|
||||
"file": {
|
||||
"type": "FileReference",
|
||||
"path": "../fixtures/layout.pug",
|
||||
"line": 1,
|
||||
"filename": "extending-include.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": "extending-include.pug"
|
||||
},
|
||||
{
|
||||
"type": "Include",
|
||||
"file": {
|
||||
"type": "FileReference",
|
||||
"line": 2,
|
||||
"filename": "extending-include.pug",
|
||||
"path": "../fixtures/mixins.pug",
|
||||
"fullPath": "../fixtures/mixins.pug",
|
||||
"str": "mixin image(src)\n img(cl-src=src)&attributes(attributes)\n",
|
||||
"ast": {
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Mixin",
|
||||
"name": "image",
|
||||
"args": "src",
|
||||
"block": {
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Tag",
|
||||
"name": "img",
|
||||
"selfClosing": false,
|
||||
"block": {
|
||||
"type": "Block",
|
||||
"nodes": [],
|
||||
"line": 2,
|
||||
"filename": "../fixtures/mixins.pug"
|
||||
},
|
||||
"attrs": [
|
||||
{
|
||||
"name": "cl-src",
|
||||
"val": "src",
|
||||
"mustEscape": true
|
||||
}
|
||||
],
|
||||
"attributeBlocks": [
|
||||
"attributes"
|
||||
],
|
||||
"isInline": true,
|
||||
"line": 2,
|
||||
"filename": "../fixtures/mixins.pug"
|
||||
}
|
||||
],
|
||||
"line": 2,
|
||||
"filename": "../fixtures/mixins.pug"
|
||||
},
|
||||
"call": false,
|
||||
"line": 1,
|
||||
"filename": "../fixtures/mixins.pug"
|
||||
}
|
||||
],
|
||||
"line": 0,
|
||||
"filename": "../fixtures/mixins.pug"
|
||||
}
|
||||
},
|
||||
"line": 2,
|
||||
"filename": "extending-include.pug",
|
||||
"block": {
|
||||
"type": "Block",
|
||||
"nodes": [],
|
||||
"line": 2,
|
||||
"filename": "extending-include.pug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "NamedBlock",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Mixin",
|
||||
"name": "image",
|
||||
"args": "'myimg.png'",
|
||||
"block": null,
|
||||
"call": true,
|
||||
"attrs": [
|
||||
{
|
||||
"name": "class",
|
||||
"val": "'with-border'",
|
||||
"mustEscape": false
|
||||
},
|
||||
{
|
||||
"name": "alt",
|
||||
"val": "\"My image\"",
|
||||
"mustEscape": true
|
||||
}
|
||||
],
|
||||
"attributeBlocks": [],
|
||||
"line": 5,
|
||||
"filename": "extending-include.pug"
|
||||
}
|
||||
],
|
||||
"line": 4,
|
||||
"filename": "extending-include.pug",
|
||||
"name": "body",
|
||||
"mode": "replace"
|
||||
}
|
||||
],
|
||||
"line": 0,
|
||||
"filename": "extending-include.pug"
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
{
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Extends",
|
||||
"file": {
|
||||
"type": "FileReference",
|
||||
"path": "../fixtures/layout.pug",
|
||||
"line": 1,
|
||||
"filename": "root-mixin.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": "root-mixin.pug"
|
||||
},
|
||||
{
|
||||
"type": "Mixin",
|
||||
"name": "myMixin",
|
||||
"args": null,
|
||||
"block": {
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Tag",
|
||||
"name": "p",
|
||||
"selfClosing": false,
|
||||
"block": {
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"val": "Hello world",
|
||||
"line": 4,
|
||||
"filename": "root-mixin.pug"
|
||||
}
|
||||
],
|
||||
"line": 4,
|
||||
"filename": "root-mixin.pug"
|
||||
},
|
||||
"attrs": [],
|
||||
"attributeBlocks": [],
|
||||
"isInline": false,
|
||||
"line": 4,
|
||||
"filename": "root-mixin.pug"
|
||||
}
|
||||
],
|
||||
"line": 4,
|
||||
"filename": "root-mixin.pug"
|
||||
},
|
||||
"call": false,
|
||||
"line": 3,
|
||||
"filename": "root-mixin.pug"
|
||||
},
|
||||
{
|
||||
"type": "NamedBlock",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Tag",
|
||||
"name": "p",
|
||||
"selfClosing": false,
|
||||
"block": {
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"val": "Before",
|
||||
"line": 7,
|
||||
"filename": "root-mixin.pug"
|
||||
}
|
||||
],
|
||||
"line": 7,
|
||||
"filename": "root-mixin.pug"
|
||||
},
|
||||
"attrs": [],
|
||||
"attributeBlocks": [],
|
||||
"isInline": false,
|
||||
"line": 7,
|
||||
"filename": "root-mixin.pug"
|
||||
},
|
||||
{
|
||||
"type": "Mixin",
|
||||
"name": "myMixin",
|
||||
"args": null,
|
||||
"block": null,
|
||||
"call": true,
|
||||
"attrs": [],
|
||||
"attributeBlocks": [],
|
||||
"line": 8,
|
||||
"filename": "root-mixin.pug"
|
||||
},
|
||||
{
|
||||
"type": "Tag",
|
||||
"name": "p",
|
||||
"selfClosing": false,
|
||||
"block": {
|
||||
"type": "Block",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"val": "After",
|
||||
"line": 9,
|
||||
"filename": "root-mixin.pug"
|
||||
}
|
||||
],
|
||||
"line": 9,
|
||||
"filename": "root-mixin.pug"
|
||||
},
|
||||
"attrs": [],
|
||||
"attributeBlocks": [],
|
||||
"isInline": false,
|
||||
"line": 9,
|
||||
"filename": "root-mixin.pug"
|
||||
}
|
||||
],
|
||||
"line": 6,
|
||||
"filename": "root-mixin.pug",
|
||||
"name": "body",
|
||||
"mode": "replace"
|
||||
}
|
||||
],
|
||||
"line": 0,
|
||||
"filename": "root-mixin.pug"
|
||||
}
|
||||
Reference in New Issue
Block a user