├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.md └── workflows │ ├── rollingversions-canary.yml │ ├── rollingversions.yml │ └── test.yml ├── .gitignore ├── .prettierrc.js ├── README.md ├── SECURITY.md ├── package.json ├── packages ├── pug-attrs │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ └── index.test.js ├── pug-code-gen │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── pug-error │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.js │ └── tsconfig.json ├── pug-filters │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── handle-filters.js │ │ └── run-filter.js │ ├── package.json │ └── test │ │ ├── __snapshots__ │ │ ├── filter-aliases.test.js.snap │ │ ├── index.test.js.snap │ │ └── per-filter-options-applied-to-nested-filters.test.js.snap │ │ ├── cases │ │ ├── filters-empty.input.json │ │ ├── filters.cdata.input.json │ │ ├── filters.coffeescript.input.json │ │ ├── filters.custom.input.json │ │ ├── filters.include.custom.input.json │ │ ├── filters.include.custom.pug │ │ ├── filters.include.input.json │ │ ├── filters.inline.input.json │ │ ├── filters.less.input.json │ │ ├── filters.markdown.input.json │ │ ├── filters.nested.input.json │ │ ├── filters.stylus.input.json │ │ ├── include-filter-coffee.coffee │ │ └── some.md │ │ ├── custom-filters.js │ │ ├── errors-src │ │ └── dynamic-option.jade │ │ ├── errors │ │ └── dynamic-option.input.json │ │ ├── filter-aliases.test.js │ │ ├── index.test.js │ │ └── per-filter-options-applied-to-nested-filters.test.js ├── pug-lexer │ ├── History.md │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── index.js │ ├── package.json │ └── test │ │ ├── __snapshots__ │ │ └── index.test.js.snap │ │ ├── cases │ │ ├── attr-es2015.pug │ │ ├── attrs-data.pug │ │ ├── attrs.js.pug │ │ ├── attrs.pug │ │ ├── attrs.unescaped.pug │ │ ├── basic.pug │ │ ├── blanks.pug │ │ ├── block-code.pug │ │ ├── block-expansion.pug │ │ ├── block-expansion.shorthands.pug │ │ ├── blockquote.pug │ │ ├── blocks-in-blocks.pug │ │ ├── blocks-in-if.pug │ │ ├── case-blocks.pug │ │ ├── case.pug │ │ ├── classes-empty.pug │ │ ├── classes.pug │ │ ├── code.conditionals.pug │ │ ├── code.escape.pug │ │ ├── code.iteration.pug │ │ ├── code.pug │ │ ├── comments-in-case.pug │ │ ├── comments.pug │ │ ├── comments.source.pug │ │ ├── doctype.custom.pug │ │ ├── doctype.default.pug │ │ ├── doctype.keyword.pug │ │ ├── each.else.pug │ │ ├── escape-chars.pug │ │ ├── escape-test.pug │ │ ├── escaping-class-attribute.pug │ │ ├── filter-in-include.pug │ │ ├── filters-empty.pug │ │ ├── filters.coffeescript.pug │ │ ├── filters.custom.pug │ │ ├── filters.include.custom.pug │ │ ├── filters.include.pug │ │ ├── filters.inline.pug │ │ ├── filters.less.pug │ │ ├── filters.markdown.pug │ │ ├── filters.nested.pug │ │ ├── filters.stylus.pug │ │ ├── filters.verbatim.pug │ │ ├── html.pug │ │ ├── html5.pug │ │ ├── include-extends-from-root.pug │ │ ├── include-extends-of-common-template.pug │ │ ├── include-extends-relative.pug │ │ ├── include-only-text-body.pug │ │ ├── include-only-text.pug │ │ ├── include-with-text-head.pug │ │ ├── include-with-text.pug │ │ ├── include.script.pug │ │ ├── include.yield.nested.pug │ │ ├── includes-with-ext-js.pug │ │ ├── includes.pug │ │ ├── inheritance.alert-dialog.pug │ │ ├── inheritance.defaults.pug │ │ ├── inheritance.extend.include.pug │ │ ├── inheritance.extend.mixins.block.pug │ │ ├── inheritance.extend.mixins.pug │ │ ├── inheritance.extend.pug │ │ ├── inheritance.extend.recursive.pug │ │ ├── inheritance.extend.whitespace.pug │ │ ├── inheritance.pug │ │ ├── inline-block-comment.pug │ │ ├── inline-tag.pug │ │ ├── intepolated-elements.pug │ │ ├── interpolated-mixin.pug │ │ ├── interpolation.escape.pug │ │ ├── javascript-new-lines.js │ │ ├── layout.append.pug │ │ ├── layout.append.without-block.pug │ │ ├── layout.multi.append.prepend.block.pug │ │ ├── layout.prepend.pug │ │ ├── layout.prepend.without-block.pug │ │ ├── mixin-at-end-of-file.pug │ │ ├── mixin-block-with-space.pug │ │ ├── mixin-hoist.pug │ │ ├── mixin-via-include.pug │ │ ├── mixin.attrs.pug │ │ ├── mixin.block-tag-behaviour.pug │ │ ├── mixin.blocks.pug │ │ ├── mixin.merge.pug │ │ ├── mixins-unused.pug │ │ ├── mixins.pug │ │ ├── mixins.rest-args.pug │ │ ├── namespaces.pug │ │ ├── nesting.pug │ │ ├── pipeless-comments.pug │ │ ├── pipeless-filters.pug │ │ ├── pipeless-tag.pug │ │ ├── pre.pug │ │ ├── quotes.pug │ │ ├── regression.1794.pug │ │ ├── regression.784.pug │ │ ├── script.whitespace.pug │ │ ├── scripts.non-js.pug │ │ ├── scripts.pug │ │ ├── self-closing-html.pug │ │ ├── single-period.pug │ │ ├── source.pug │ │ ├── styles.pug │ │ ├── tag-blocks.pug │ │ ├── tag.interpolation.pug │ │ ├── tags.self-closing.pug │ │ ├── template.pug │ │ ├── text-block.pug │ │ ├── text.pug │ │ ├── utf8bom.pug │ │ ├── vars.pug │ │ ├── while.pug │ │ ├── xml.pug │ │ ├── yield-before-conditional-head.pug │ │ ├── yield-before-conditional.pug │ │ ├── yield-head.pug │ │ ├── yield-title-head.pug │ │ ├── yield-title.pug │ │ └── yield.pug │ │ ├── check-lexer-functions.test.js │ │ ├── errors │ │ ├── attribute-invalid-expression.pug │ │ ├── case-with-invalid-expression.pug │ │ ├── case-with-no-expression.pug │ │ ├── default-with-expression.pug │ │ ├── else-with-condition.pug │ │ ├── extends-no-path.pug │ │ ├── include-filter-no-path-2.pug │ │ ├── include-filter-no-path.pug │ │ ├── include-filter-no-space.pug │ │ ├── include-no-path.pug │ │ ├── inconsistent-indentation.pug │ │ ├── interpolated-call.pug │ │ ├── invalid-class-name-1.pug │ │ ├── invalid-class-name-2.pug │ │ ├── invalid-class-name-3.pug │ │ ├── invalid-id.pug │ │ ├── malformed-each.pug │ │ ├── malformed-extend.pug │ │ ├── malformed-include.pug │ │ ├── mismatched-inline-tag.pug │ │ ├── mismatched-tag-interpolation.pug │ │ ├── multi-line-interpolation.pug │ │ ├── old-prefixed-each.pug │ │ ├── open-interpolation.pug │ │ ├── when-with-no-expression.pug │ │ └── while-with-no-expression.pug │ │ └── index.test.js ├── pug-linker │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ ├── __snapshots__ │ │ └── index.test.js.snap │ │ ├── cases-src │ │ ├── auxiliary │ │ │ ├── 1794-extends.pug │ │ │ ├── 1794-include.pug │ │ │ ├── blocks-in-blocks-layout.pug │ │ │ ├── dialog.pug │ │ │ ├── empty-block.pug │ │ │ ├── escapes.html │ │ │ ├── extends-empty-block-1.pug │ │ │ ├── extends-empty-block-2.pug │ │ │ ├── extends-from-root.pug │ │ │ ├── extends-relative.pug │ │ │ ├── filter-in-include.pug │ │ │ ├── includable.js │ │ │ ├── include-from-root.pug │ │ │ ├── inheritance.extend.mixin.block.pug │ │ │ ├── inheritance.extend.recursive-grand-grandparent.pug │ │ │ ├── inheritance.extend.recursive-grandparent.pug │ │ │ ├── inheritance.extend.recursive-parent.pug │ │ │ ├── layout.include.pug │ │ │ ├── layout.pug │ │ │ ├── mixin-at-end-of-file.pug │ │ │ ├── mixins.pug │ │ │ ├── pet.pug │ │ │ ├── smile.html │ │ │ ├── window.pug │ │ │ └── yield-nested.pug │ │ ├── include-extends-from-root.pug │ │ ├── include-extends-of-common-template.pug │ │ ├── include-extends-relative.pug │ │ ├── include-filter-coffee.coffee │ │ ├── include-filter-stylus.pug │ │ ├── include-filter.pug │ │ ├── include-only-text-body.pug │ │ ├── include-only-text.pug │ │ ├── include-with-text-head.pug │ │ ├── include-with-text.pug │ │ ├── include.script.pug │ │ ├── include.yield.nested.pug │ │ ├── includes-with-ext-js.pug │ │ ├── includes.pug │ │ ├── javascript-new-lines.js │ │ ├── layout.append.pug │ │ ├── layout.append.without-block.pug │ │ ├── layout.multi.append.prepend.block.pug │ │ ├── layout.prepend.pug │ │ ├── layout.prepend.without-block.pug │ │ ├── some-included.styl │ │ ├── some.md │ │ └── some.styl │ │ ├── cases │ │ ├── include-extends-from-root.input.json │ │ ├── include-extends-of-common-template.input.json │ │ ├── include-extends-relative.input.json │ │ ├── include-filter-stylus.input.json │ │ ├── include-filter.input.json │ │ ├── include-only-text-body.input.json │ │ ├── include-only-text.input.json │ │ ├── include-with-text-head.input.json │ │ ├── include-with-text.input.json │ │ ├── include.script.input.json │ │ ├── include.yield.nested.input.json │ │ ├── includes-with-ext-js.input.json │ │ ├── includes.input.json │ │ ├── layout.append.input.json │ │ ├── layout.append.without-block.input.json │ │ ├── layout.multi.append.prepend.block.input.json │ │ ├── layout.prepend.input.json │ │ └── layout.prepend.without-block.input.json │ │ ├── errors-src │ │ ├── child-with-tags.pug │ │ ├── extends-not-first.pug │ │ └── unexpected-block.pug │ │ ├── errors │ │ ├── child-with-tags.input.json │ │ ├── extends-not-first.input.json │ │ └── unexpected-block.input.json │ │ ├── fixtures │ │ ├── append-without-block │ │ │ ├── app-layout.pug │ │ │ ├── layout.pug │ │ │ └── page.pug │ │ ├── append │ │ │ ├── app-layout.pug │ │ │ ├── layout.pug │ │ │ ├── page.html │ │ │ └── page.pug │ │ ├── empty.pug │ │ ├── layout.pug │ │ ├── mixins.pug │ │ ├── multi-append-prepend-block │ │ │ ├── redefine.pug │ │ │ └── root.pug │ │ ├── prepend-without-block │ │ │ ├── app-layout.pug │ │ │ ├── layout.pug │ │ │ ├── page.html │ │ │ └── page.pug │ │ └── prepend │ │ │ ├── app-layout.pug │ │ │ ├── layout.pug │ │ │ ├── page.html │ │ │ └── page.pug │ │ ├── index.test.js │ │ ├── special-cases-src │ │ ├── extending-empty.pug │ │ ├── extending-include.pug │ │ └── root-mixin.pug │ │ └── special-cases │ │ ├── extending-empty.input.json │ │ ├── extending-include.input.json │ │ └── root-mixin.input.json ├── pug-load │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ ├── __snapshots__ │ │ └── index.test.js.snap │ │ ├── bar.pug │ │ ├── bing.pug │ │ ├── foo.pug │ │ ├── index.test.js │ │ └── script.js ├── pug-parser │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ └── inline-tags.js │ ├── package.json │ └── test │ │ ├── __snapshots__ │ │ ├── index.test.js.snap │ │ └── no-unnecessary-blocks.test.js.snap │ │ ├── cases │ │ ├── attr-es2015.tokens.json │ │ ├── attrs-data.tokens.json │ │ ├── attrs.js.tokens.json │ │ ├── attrs.tokens.json │ │ ├── attrs.unescaped.tokens.json │ │ ├── basic.tokens.json │ │ ├── blanks.tokens.json │ │ ├── block-code.tokens.json │ │ ├── block-expansion.shorthands.tokens.json │ │ ├── block-expansion.tokens.json │ │ ├── blockquote.tokens.json │ │ ├── blocks-in-blocks.tokens.json │ │ ├── blocks-in-if.tokens.json │ │ ├── case-blocks.tokens.json │ │ ├── case.tokens.json │ │ ├── classes-empty.tokens.json │ │ ├── classes.tokens.json │ │ ├── code.conditionals.tokens.json │ │ ├── code.escape.tokens.json │ │ ├── code.iteration.tokens.json │ │ ├── code.tokens.json │ │ ├── comments-in-case.tokens.json │ │ ├── comments.source.tokens.json │ │ ├── comments.tokens.json │ │ ├── doctype.custom.tokens.json │ │ ├── doctype.default.tokens.json │ │ ├── doctype.keyword.tokens.json │ │ ├── each.else.tokens.json │ │ ├── escape-chars.tokens.json │ │ ├── escape-test.tokens.json │ │ ├── escaping-class-attribute.tokens.json │ │ ├── filter-in-include.tokens.json │ │ ├── filters-empty.tokens.json │ │ ├── filters.coffeescript.tokens.json │ │ ├── filters.custom.tokens.json │ │ ├── filters.include.custom.tokens.json │ │ ├── filters.include.tokens.json │ │ ├── filters.inline.tokens.json │ │ ├── filters.less.tokens.json │ │ ├── filters.markdown.tokens.json │ │ ├── filters.nested.tokens.json │ │ ├── filters.stylus.tokens.json │ │ ├── filters.verbatim.tokens.json │ │ ├── html.tokens.json │ │ ├── html5.tokens.json │ │ ├── include-extends-from-root.tokens.json │ │ ├── include-extends-of-common-template.tokens.json │ │ ├── include-extends-relative.tokens.json │ │ ├── include-only-text-body.tokens.json │ │ ├── include-only-text.tokens.json │ │ ├── include-with-text-head.tokens.json │ │ ├── include-with-text.tokens.json │ │ ├── include.script.tokens.json │ │ ├── include.yield.nested.tokens.json │ │ ├── includes-with-ext-js.tokens.json │ │ ├── includes.tokens.json │ │ ├── inheritance.alert-dialog.tokens.json │ │ ├── inheritance.defaults.tokens.json │ │ ├── inheritance.extend.include.tokens.json │ │ ├── inheritance.extend.mixins.block.tokens.json │ │ ├── inheritance.extend.mixins.tokens.json │ │ ├── inheritance.extend.recursive.tokens.json │ │ ├── inheritance.extend.tokens.json │ │ ├── inheritance.extend.whitespace.tokens.json │ │ ├── inheritance.tokens.json │ │ ├── inline-block-comment.tokens.json │ │ ├── inline-tag.tokens.json │ │ ├── intepolated-elements.tokens.json │ │ ├── interpolated-mixin.tokens.json │ │ ├── interpolation.escape.tokens.json │ │ ├── layout.append.tokens.json │ │ ├── layout.append.without-block.tokens.json │ │ ├── layout.multi.append.prepend.block.tokens.json │ │ ├── layout.prepend.tokens.json │ │ ├── layout.prepend.without-block.tokens.json │ │ ├── mixin-at-end-of-file.tokens.json │ │ ├── mixin-block-with-space.tokens.json │ │ ├── mixin-hoist.tokens.json │ │ ├── mixin-via-include.tokens.json │ │ ├── mixin.attrs.tokens.json │ │ ├── mixin.block-tag-behaviour.tokens.json │ │ ├── mixin.blocks.tokens.json │ │ ├── mixin.merge.tokens.json │ │ ├── mixins-unused.tokens.json │ │ ├── mixins.rest-args.tokens.json │ │ ├── mixins.tokens.json │ │ ├── namespaces.tokens.json │ │ ├── nesting.tokens.json │ │ ├── pipeless-comments.tokens.json │ │ ├── pipeless-filters.tokens.json │ │ ├── pipeless-tag.tokens.json │ │ ├── pre.tokens.json │ │ ├── quotes.tokens.json │ │ ├── regression.1794.tokens.json │ │ ├── regression.784.tokens.json │ │ ├── script.whitespace.tokens.json │ │ ├── scripts.non-js.tokens.json │ │ ├── scripts.tokens.json │ │ ├── self-closing-html.tokens.json │ │ ├── single-period.tokens.json │ │ ├── source.tokens.json │ │ ├── styles.tokens.json │ │ ├── tag-blocks.tokens.json │ │ ├── tag.interpolation.tokens.json │ │ ├── tags.self-closing.tokens.json │ │ ├── template.tokens.json │ │ ├── text-block.tokens.json │ │ ├── text.tokens.json │ │ ├── utf8bom.tokens.json │ │ ├── vars.tokens.json │ │ ├── while.tokens.json │ │ ├── xml.tokens.json │ │ ├── yield-before-conditional-head.tokens.json │ │ ├── yield-before-conditional.tokens.json │ │ ├── yield-head.tokens.json │ │ ├── yield-title-head.tokens.json │ │ ├── yield-title.tokens.json │ │ └── yield.tokens.json │ │ ├── index.test.js │ │ └── no-unnecessary-blocks.test.js ├── pug-runtime │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── build.js │ ├── index.js │ ├── package.json │ ├── prepublish.js │ ├── test │ │ └── index.test.js │ └── wrap.js ├── pug-strip-comments │ ├── CHANGELOG.md │ ├── LICENSE │ ├── LICENSE.md │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ ├── __snapshots__ │ │ └── index.test.js.snap │ │ ├── cases │ │ ├── comments-in-case.input.json │ │ ├── comments.input.json │ │ └── comments.source.input.json │ │ ├── errors │ │ ├── comment-in-comment.input.json │ │ ├── end.input.json │ │ └── startstart.input.json │ │ └── index.test.js ├── pug-walk │ ├── .gitignore │ ├── .travis.yml │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ └── index.test.js └── pug │ ├── History.md │ ├── LICENSE │ ├── README.md │ ├── examples │ ├── README.md │ ├── attributes.js │ ├── attributes.pug │ ├── code.js │ ├── code.pug │ ├── dynamicscript.js │ ├── dynamicscript.pug │ ├── each.js │ ├── each.pug │ ├── extend-layout.pug │ ├── extend.js │ ├── extend.pug │ ├── form.js │ ├── form.pug │ ├── includes.js │ ├── includes.pug │ ├── includes │ │ ├── foot.pug │ │ ├── head.pug │ │ ├── scripts.pug │ │ └── style.css │ ├── layout-debug.js │ ├── layout.js │ ├── layout.pug │ ├── mixins.js │ ├── mixins.pug │ ├── mixins │ │ ├── dialog.pug │ │ └── profile.pug │ ├── pet.pug │ ├── rss.js │ ├── rss.pug │ ├── text.js │ ├── text.pug │ ├── whitespace.js │ └── whitespace.pug │ ├── lib │ └── index.js │ ├── package.json │ ├── register.js │ ├── support │ └── benchmark.js │ └── test │ ├── README.md │ ├── __snapshots__ │ └── pug.test.js.snap │ ├── anti-cases │ ├── attrs.unescaped.pug │ ├── case-when.pug │ ├── case-without-with.pug │ ├── else-condition.pug │ ├── else-without-if.pug │ ├── inlining-a-mixin-after-a-tag.pug │ ├── key-char-ending-badly.pug │ ├── key-ending-badly.pug │ ├── mismatched-inline-tag.pug │ ├── mixin-args-syntax-error.pug │ ├── mixins-blocks-with-bodies.pug │ ├── multiple-non-nested-tags-on-a-line.pug │ ├── non-existant-filter.pug │ ├── non-mixin-block.pug │ ├── open-brace-in-attributes.pug │ ├── readme.md │ ├── self-closing-tag-with-block.pug │ ├── self-closing-tag-with-body.pug │ ├── self-closing-tag-with-code.pug │ ├── tabs-and-spaces.pug │ ├── unclosed-interpolated-call.pug │ ├── unclosed-interpolated-tag.pug │ └── unclosed-interpolation.pug │ ├── browser │ ├── index.html │ └── index.pug │ ├── cases-es2015 │ ├── attr.html │ └── attr.pug │ ├── cases │ ├── attrs-data.html │ ├── attrs-data.pug │ ├── attrs.colon.html │ ├── attrs.colon.pug │ ├── attrs.html │ ├── attrs.js.html │ ├── attrs.js.pug │ ├── attrs.pug │ ├── attrs.unescaped.html │ ├── attrs.unescaped.pug │ ├── auxiliary │ │ ├── 1794-extends.pug │ │ ├── 1794-include.pug │ │ ├── blocks-in-blocks-layout.pug │ │ ├── dialog.pug │ │ ├── empty-block.pug │ │ ├── escapes.html │ │ ├── extends-empty-block-1.pug │ │ ├── extends-empty-block-2.pug │ │ ├── extends-from-root.pug │ │ ├── extends-relative.pug │ │ ├── filter-in-include.pug │ │ ├── includable.js │ │ ├── include-from-root.pug │ │ ├── inheritance.extend.mixin.block.pug │ │ ├── inheritance.extend.recursive-grand-grandparent.pug │ │ ├── inheritance.extend.recursive-grandparent.pug │ │ ├── inheritance.extend.recursive-parent.pug │ │ ├── layout.include.pug │ │ ├── layout.pug │ │ ├── mixin-at-end-of-file.pug │ │ ├── mixins.pug │ │ ├── pet.pug │ │ ├── smile.html │ │ ├── window.pug │ │ └── yield-nested.pug │ ├── basic.html │ ├── basic.pug │ ├── blanks.html │ ├── blanks.pug │ ├── block-code.html │ ├── block-code.pug │ ├── block-expansion.html │ ├── block-expansion.pug │ ├── block-expansion.shorthands.html │ ├── block-expansion.shorthands.pug │ ├── blockquote.html │ ├── blockquote.pug │ ├── blocks-in-blocks.html │ ├── blocks-in-blocks.pug │ ├── blocks-in-if.html │ ├── blocks-in-if.pug │ ├── case-blocks.html │ ├── case-blocks.pug │ ├── case.html │ ├── case.pug │ ├── classes-empty.html │ ├── classes-empty.pug │ ├── classes.html │ ├── classes.pug │ ├── code.conditionals.html │ ├── code.conditionals.pug │ ├── code.escape.html │ ├── code.escape.pug │ ├── code.html │ ├── code.iteration.html │ ├── code.iteration.pug │ ├── code.pug │ ├── comments-in-case.html │ ├── comments-in-case.pug │ ├── comments.html │ ├── comments.pug │ ├── comments.source.html │ ├── comments.source.pug │ ├── doctype.custom.html │ ├── doctype.custom.pug │ ├── doctype.default.html │ ├── doctype.default.pug │ ├── doctype.keyword.html │ ├── doctype.keyword.pug │ ├── each.else.html │ ├── each.else.pug │ ├── escape-chars.html │ ├── escape-chars.pug │ ├── escape-test.html │ ├── escape-test.pug │ ├── escaping-class-attribute.html │ ├── escaping-class-attribute.pug │ ├── filter-in-include.html │ ├── filter-in-include.pug │ ├── filters-empty.html │ ├── filters-empty.pug │ ├── filters.coffeescript.html │ ├── filters.coffeescript.pug │ ├── filters.custom.html │ ├── filters.custom.pug │ ├── filters.include.custom.html │ ├── filters.include.custom.pug │ ├── filters.include.html │ ├── filters.include.pug │ ├── filters.inline.html │ ├── filters.inline.pug │ ├── filters.less.html │ ├── filters.less.pug │ ├── filters.markdown.html │ ├── filters.markdown.pug │ ├── filters.nested.html │ ├── filters.nested.pug │ ├── filters.stylus.html │ ├── filters.stylus.pug │ ├── html.html │ ├── html.pug │ ├── html5.html │ ├── html5.pug │ ├── include-extends-from-root.html │ ├── include-extends-from-root.pug │ ├── include-extends-of-common-template.html │ ├── include-extends-of-common-template.pug │ ├── include-extends-relative.html │ ├── include-extends-relative.pug │ ├── include-filter-coffee.coffee │ ├── include-only-text-body.html │ ├── include-only-text-body.pug │ ├── include-only-text.html │ ├── include-only-text.pug │ ├── include-with-text-head.html │ ├── include-with-text-head.pug │ ├── include-with-text.html │ ├── include-with-text.pug │ ├── include.script.html │ ├── include.script.pug │ ├── include.yield.nested.html │ ├── include.yield.nested.pug │ ├── includes-with-ext-js.html │ ├── includes-with-ext-js.pug │ ├── includes.html │ ├── includes.pug │ ├── inheritance.alert-dialog.html │ ├── inheritance.alert-dialog.pug │ ├── inheritance.defaults.html │ ├── inheritance.defaults.pug │ ├── inheritance.extend.html │ ├── inheritance.extend.include.html │ ├── inheritance.extend.include.pug │ ├── inheritance.extend.mixins.block.html │ ├── inheritance.extend.mixins.block.pug │ ├── inheritance.extend.mixins.html │ ├── inheritance.extend.mixins.pug │ ├── inheritance.extend.pug │ ├── inheritance.extend.recursive.html │ ├── inheritance.extend.recursive.pug │ ├── inheritance.extend.whitespace.html │ ├── inheritance.extend.whitespace.pug │ ├── inheritance.html │ ├── inheritance.pug │ ├── inline-tag.html │ ├── inline-tag.pug │ ├── intepolated-elements.html │ ├── intepolated-elements.pug │ ├── interpolated-mixin.html │ ├── interpolated-mixin.pug │ ├── interpolation.escape.html │ ├── interpolation.escape.pug │ ├── javascript-new-lines.js │ ├── layout.append.html │ ├── layout.append.pug │ ├── layout.append.without-block.html │ ├── layout.append.without-block.pug │ ├── layout.multi.append.prepend.block.html │ ├── layout.multi.append.prepend.block.pug │ ├── layout.prepend.html │ ├── layout.prepend.pug │ ├── layout.prepend.without-block.html │ ├── layout.prepend.without-block.pug │ ├── mixin-at-end-of-file.html │ ├── mixin-at-end-of-file.pug │ ├── mixin-block-with-space.html │ ├── mixin-block-with-space.pug │ ├── mixin-hoist.html │ ├── mixin-hoist.pug │ ├── mixin-via-include.html │ ├── mixin-via-include.pug │ ├── mixin.attrs.html │ ├── mixin.attrs.pug │ ├── mixin.block-tag-behaviour.html │ ├── mixin.block-tag-behaviour.pug │ ├── mixin.blocks.html │ ├── mixin.blocks.pug │ ├── mixin.merge.html │ ├── mixin.merge.pug │ ├── mixins-unused.html │ ├── mixins-unused.pug │ ├── mixins.html │ ├── mixins.pug │ ├── mixins.rest-args.html │ ├── mixins.rest-args.pug │ ├── namespaces.html │ ├── namespaces.pug │ ├── nesting.html │ ├── nesting.pug │ ├── pipeless-comments.html │ ├── pipeless-comments.pug │ ├── pipeless-filters.html │ ├── pipeless-filters.pug │ ├── pipeless-tag.html │ ├── pipeless-tag.pug │ ├── pre.html │ ├── pre.pug │ ├── quotes.html │ ├── quotes.pug │ ├── regression.1794.html │ ├── regression.1794.pug │ ├── regression.784.html │ ├── regression.784.pug │ ├── script.whitespace.html │ ├── script.whitespace.pug │ ├── scripts.html │ ├── scripts.non-js.html │ ├── scripts.non-js.pug │ ├── scripts.pug │ ├── self-closing-html.html │ ├── self-closing-html.pug │ ├── single-period.html │ ├── single-period.pug │ ├── some-included.styl │ ├── some.md │ ├── some.styl │ ├── source.html │ ├── source.pug │ ├── styles.html │ ├── styles.pug │ ├── tag.interpolation.html │ ├── tag.interpolation.pug │ ├── tags.self-closing.html │ ├── tags.self-closing.pug │ ├── template.html │ ├── template.pug │ ├── text-block.html │ ├── text-block.pug │ ├── text.html │ ├── text.pug │ ├── utf8bom.html │ ├── utf8bom.pug │ ├── vars.html │ ├── vars.pug │ ├── while.html │ ├── while.pug │ ├── xml.html │ ├── xml.pug │ ├── yield-before-conditional-head.html │ ├── yield-before-conditional-head.pug │ ├── yield-before-conditional.html │ ├── yield-before-conditional.pug │ ├── yield-head.html │ ├── yield-head.pug │ ├── yield-title-head.html │ ├── yield-title-head.pug │ ├── yield-title.html │ ├── yield-title.pug │ ├── yield.html │ └── yield.pug │ ├── dependencies │ ├── dependency1.pug │ ├── dependency2.pug │ ├── dependency3.pug │ ├── extends1.pug │ ├── extends2.pug │ ├── include1.pug │ └── include2.pug │ ├── duplicate-block │ ├── __snapshots__ │ │ └── index.test.js.snap │ ├── index.pug │ ├── index.test.js │ └── layout-with-duplicate-block.pug │ ├── eachOf │ ├── __snapshots__ │ │ └── index.test.js.snap │ ├── error │ │ ├── left-side.pug │ │ ├── no-brackets.pug │ │ ├── one-val.pug │ │ └── right-side.pug │ ├── index.test.js │ └── passing │ │ ├── brackets.pug │ │ └── no-brackets.pug │ ├── error.reporting.test.js │ ├── examples.test.js │ ├── extends-not-top-level │ ├── default.pug │ ├── duplicate.pug │ ├── index.pug │ └── index.test.js │ ├── fixtures │ ├── append-without-block │ │ ├── app-layout.pug │ │ ├── layout.pug │ │ └── page.pug │ ├── append │ │ ├── app-layout.pug │ │ ├── layout.pug │ │ ├── page.html │ │ └── page.pug │ ├── compile.with.include.locals.error.pug │ ├── compile.with.include.syntax.error.pug │ ├── compile.with.layout.locals.error.pug │ ├── compile.with.layout.syntax.error.pug │ ├── compile.with.layout.with.include.locals.error.pug │ ├── compile.with.layout.with.include.syntax.error.pug │ ├── element-with-multiple-attributes.pug │ ├── include.locals.error.pug │ ├── include.syntax.error.pug │ ├── invalid-block-in-extends.pug │ ├── issue-1593 │ │ ├── include-layout.pug │ │ ├── include.pug │ │ ├── index.pug │ │ └── layout.pug │ ├── layout.locals.error.pug │ ├── layout.pug │ ├── layout.syntax.error.pug │ ├── layout.with.runtime.error.pug │ ├── mixin-include.pug │ ├── mixin.error.pug │ ├── multi-append-prepend-block │ │ ├── redefine.pug │ │ └── root.pug │ ├── perf.pug │ ├── prepend-without-block │ │ ├── app-layout.pug │ │ ├── layout.pug │ │ ├── page.html │ │ └── page.pug │ ├── prepend │ │ ├── app-layout.pug │ │ ├── layout.pug │ │ ├── page.html │ │ └── page.pug │ ├── runtime.error.pug │ ├── runtime.layout.error.pug │ ├── runtime.with.mixin.error.pug │ └── scripts.pug │ ├── markdown-it │ ├── comment.md │ ├── index.test.js │ ├── layout-markdown-include.pug │ └── layout-markdown-inline.pug │ ├── output-es2015 │ └── attr.html │ ├── plugins.test.js │ ├── pug.test.js │ ├── regression-2436 │ ├── __snapshots__ │ │ └── index.test.js.snap │ ├── index.test.js │ ├── issue1.pug │ ├── issue2.pug │ ├── layout.pug │ ├── other1.pug │ ├── other2.pug │ └── other_layout.pug │ ├── run-es2015.test.js │ ├── run-syntax-errors.test.js │ ├── run-utils.js │ ├── run.test.js │ ├── shadowed-block │ ├── __snapshots__ │ │ └── index.test.js.snap │ ├── base.pug │ ├── index.pug │ ├── index.test.js │ └── layout.pug │ └── temp │ ├── input-compileFile.pug │ ├── input-compileFileClient.pug │ └── input-renderFile.pug ├── scripts ├── buffer-serializer.js ├── filename-serializer.js ├── prebuild.js └── prettier-javascript-serializer.js ├── tsconfig.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | tab_width = 2 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: pug 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: npm/pug 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with a single custom sponsorship URL 13 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-latest 11 | 12 | strategy: 13 | matrix: 14 | node-version: [10.x, 12.x, 14.x] 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Use Node.js ${{ matrix.node-version }} 19 | uses: actions/setup-node@v1 20 | with: 21 | node-version: ${{ matrix.node-version }} 22 | - run: yarn install --frozen-lockfile 23 | - run: yarn prettier:check 24 | - run: yarn test 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | .vscode 4 | testing 5 | node_modules 6 | lib-cov 7 | coverage 8 | cov-pt* 9 | *.seed 10 | *.log 11 | *.csv 12 | *.dat 13 | *.out 14 | *.patch 15 | *.pid 16 | *.gz 17 | **/test/output* 18 | **/test/temp 19 | .release.json 20 | package-lock.json 21 | 22 | scripts/tsconfig.json 23 | packages/pug-error/lib 24 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | singleQuote: true, 4 | trailingComma: 'all', 5 | overrides: [ 6 | { 7 | files: '*.js', 8 | options: { 9 | parser: 'babel', 10 | trailingComma: 'es5', 11 | }, 12 | }, 13 | ], 14 | }; 15 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | | -------- | ------------------ | 7 | | ^3.0.1 | :white_check_mark: | 8 | | <3.0.1 | :x: | 9 | 10 | ## Reporting a Vulnerability 11 | 12 | To report a security vulnerability, please use the 13 | [Tidelift security contact](https://tidelift.com/security). 14 | Tidelift will coordinate the fix and disclosure. 15 | -------------------------------------------------------------------------------- /packages/pug-attrs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pug-attrs", 3 | "version": "2.0.4", 4 | "description": "Generate code for Pug attributes", 5 | "keywords": [ 6 | "pug" 7 | ], 8 | "dependencies": { 9 | "constantinople": "^4.0.1", 10 | "js-stringify": "^1.0.2", 11 | "pug-runtime": "^2.0.5" 12 | }, 13 | "files": [ 14 | "index.js" 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/pugjs/pug/tree/master/packages/pug-attrs" 19 | }, 20 | "author": "Forbes Lindesay", 21 | "license": "MIT" 22 | } 23 | -------------------------------------------------------------------------------- /packages/pug-code-gen/HISTORY.md: -------------------------------------------------------------------------------- 1 | # Change log 2 | 3 | ## 1.1.0 / 2016-08-23 4 | 5 | - Wrap `each` and `for` in IIFE to prevent variable from leaking 6 | 7 | ## 1.0.1 / 2016-08-10 8 | 9 | - Update doctypes to 1.1.0 10 | 11 | ## 1.0.0 / 2016-08-10 12 | 13 | - First stable release 14 | -------------------------------------------------------------------------------- /packages/pug-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pug-error", 3 | "version": "1.3.3", 4 | "description": "Standard error objects for pug", 5 | "main": "./lib/index.js", 6 | "types": "./lib/index.d.ts", 7 | "keywords": [ 8 | "pug" 9 | ], 10 | "files": [ 11 | "lib/" 12 | ], 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/pugjs/pug/tree/master/packages/pug-error" 16 | }, 17 | "author": "Forbes Lindesay", 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /packages/pug-error/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "rootDir": "src", 6 | "outDir": "lib", 7 | "tsBuildInfoFile": "lib/tsconfig.tsbuildinfo", 8 | }, 9 | "references": [], 10 | } 11 | -------------------------------------------------------------------------------- /packages/pug-filters/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change log 2 | 3 | ## 1.2.4 / 2016-08-23 4 | 5 | - Update to `pug-walk@1.0.0` 6 | 7 | ## 1.2.3 / 2016-07-18 8 | 9 | - Fix includes using custom filters 10 | 11 | ## 1.2.2 / 2016-06-06 12 | 13 | - Update to `jstransformer@1.0.0` 14 | 15 | ## 1.2.1 / 2016-04-27 16 | 17 | - Apply filters to included files as well 18 | 19 | ## 1.2.0 / 2016-04-01 20 | 21 | - Add support for specifying per-filter options 22 | 23 | ## 1.1.1 / 2015-12-23 24 | 25 | - Update UglifyJS to 2.6.2 26 | - Rename to Pug 27 | 28 | ## 1.1.0 / 2015-11-14 29 | 30 | - Add support for filtered includes 31 | 32 | ## 1.0.0 / 2015-10-08 33 | 34 | - Initial stable release 35 | -------------------------------------------------------------------------------- /packages/pug-filters/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.runFilter = require('./lib/run-filter'); 4 | exports.handleFilters = require('./lib/handle-filters'); 5 | -------------------------------------------------------------------------------- /packages/pug-filters/test/cases/filters.include.custom.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | pre 4 | include:custom(opt='val' num=2) filters.include.custom.pug 5 | -------------------------------------------------------------------------------- /packages/pug-filters/test/cases/include-filter-coffee.coffee: -------------------------------------------------------------------------------- 1 | math = 2 | square: (value) -> value * value 3 | -------------------------------------------------------------------------------- /packages/pug-filters/test/cases/some.md: -------------------------------------------------------------------------------- 1 | Just _some_ markdown **tests**. 2 | 3 | With new line. 4 | -------------------------------------------------------------------------------- /packages/pug-filters/test/custom-filters.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | 3 | module.exports = { 4 | custom: function(str, options) { 5 | expect(options.opt).toBe('val'); 6 | expect(options.num).toBe(2); 7 | return 'BEGIN' + str + 'END'; 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/pug-filters/test/errors-src/dynamic-option.jade: -------------------------------------------------------------------------------- 1 | - var opt = 'a' 2 | :cdata(option=opt) 3 | hey 4 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/attr-es2015.pug: -------------------------------------------------------------------------------- 1 | - var avatar = '219b77f9d21de75e81851b6b886057c7' 2 | 3 | div.avatar-div(style=`background-image: url(https://www.gravatar.com/avatar/${avatar})`) 4 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/attrs-data.pug: -------------------------------------------------------------------------------- 1 | - var user = { name: 'tobi' } 2 | foo(data-user=user) 3 | foo(data-items=[1,2,3]) 4 | foo(data-username='tobi') 5 | foo(data-escaped={message: "Let's rock!"}) 6 | foo(data-ampersand={message: "a quote: " this & that"}) 7 | foo(data-epoc=new Date(0)) 8 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/attrs.unescaped.pug: -------------------------------------------------------------------------------- 1 | script(type='text/x-template') 2 | div(id!='user-<%= user.id %>') 3 | h1 <%= user.title %> -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/basic.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | h1 Title -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/blanks.pug: -------------------------------------------------------------------------------- 1 | 2 | 3 | ul 4 | li foo 5 | 6 | li bar 7 | 8 | li baz 9 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/block-code.pug: -------------------------------------------------------------------------------- 1 | - 2 | list = ["uno", "dos", "tres", 3 | "cuatro", "cinco", "seis"]; 4 | //- Without a block, the element is accepted and no code is generated 5 | - 6 | each item in list 7 | - 8 | string = item.charAt(0) 9 | 10 | .toUpperCase() + 11 | item.slice(1); 12 | li= string 13 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/block-expansion.pug: -------------------------------------------------------------------------------- 1 | ul 2 | li: a(href='#') foo 3 | li: a(href='#') bar 4 | 5 | p baz -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/block-expansion.shorthands.pug: -------------------------------------------------------------------------------- 1 | ul 2 | li.list-item: .foo: #bar baz -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/blockquote.pug: -------------------------------------------------------------------------------- 1 | figure 2 | blockquote 3 | | Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that. 4 | figcaption from @thefray at 1:43pm on May 10 -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/blocks-in-blocks.pug: -------------------------------------------------------------------------------- 1 | extends ./auxiliary/blocks-in-blocks-layout.pug 2 | 3 | block body 4 | h1 Page 2 5 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/blocks-in-if.pug: -------------------------------------------------------------------------------- 1 | //- see https://github.com/pugjs/pug/issues/1589 2 | 3 | -var ajax = true 4 | 5 | -if( ajax ) 6 | //- return only contents if ajax requests 7 | block contents 8 | p ajax contents 9 | 10 | -else 11 | //- return all html 12 | doctype html 13 | html 14 | head 15 | meta( charset='utf8' ) 16 | title sample 17 | body 18 | block contents 19 | p all contetns 20 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/case-blocks.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | - var friends = 1 4 | case friends 5 | when 0 6 | p you have no friends 7 | when 1 8 | p you have a friend 9 | default 10 | p you have #{friends} friends -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/case.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | - var friends = 1 4 | case friends 5 | when 0: p you have no friends 6 | when 1: p you have a friend 7 | default: p you have #{friends} friends 8 | - var friends = 0 9 | case friends 10 | when 0 11 | when 1 12 | p you have very few friends 13 | default 14 | p you have #{friends} friends 15 | 16 | - var friend = 'Tim:G' 17 | case friend 18 | when 'Tim:G': p Friend is a string 19 | when {tim: 'g'}: p Friend is an object 20 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/classes-empty.pug: -------------------------------------------------------------------------------- 1 | a(class='') 2 | a(class=null) 3 | a(class=undefined) -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/classes.pug: -------------------------------------------------------------------------------- 1 | a(class=['foo', 'bar', 'baz']) 2 | 3 | 4 | 5 | a.foo(class='bar').baz 6 | 7 | 8 | 9 | a.foo-bar_baz 10 | 11 | a(class={foo: true, bar: false, baz: true}) 12 | 13 | a.-foo 14 | a.3foo 15 | -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/code.conditionals.pug: -------------------------------------------------------------------------------- 1 | 2 | - if (true) 3 | p foo 4 | - else 5 | p bar 6 | 7 | - if (true) { 8 | p foo 9 | - } else { 10 | p bar 11 | - } 12 | 13 | if true 14 | p foo 15 | p bar 16 | p baz 17 | else 18 | p bar 19 | 20 | unless true 21 | p foo 22 | else 23 | p bar 24 | 25 | if 'nested' 26 | if 'works' 27 | p yay 28 | 29 | //- allow empty blocks 30 | if false 31 | else 32 | .bar 33 | if true 34 | .bar 35 | else 36 | .bing 37 | 38 | if false 39 | .bing 40 | else if false 41 | .bar 42 | else 43 | .foo -------------------------------------------------------------------------------- /packages/pug-lexer/test/cases/code.escape.pug: -------------------------------------------------------------------------------- 1 | p= ' 4 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/extends-empty-block-1.pug: -------------------------------------------------------------------------------- 1 | extends empty-block.pug 2 | 3 | block test 4 | div test1 5 | 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/extends-empty-block-2.pug: -------------------------------------------------------------------------------- 1 | extends empty-block.pug 2 | 3 | block test 4 | div test2 5 | 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/extends-from-root.pug: -------------------------------------------------------------------------------- 1 | extends /auxiliary/layout.pug 2 | 3 | block content 4 | include /auxiliary/include-from-root.pug 5 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/extends-relative.pug: -------------------------------------------------------------------------------- 1 | extends ../../cases-src/auxiliary/layout 2 | 3 | block content 4 | include ../../cases-src/auxiliary/include-from-root 5 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/filter-in-include.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | style(type="text/css") 4 | :less 5 | @pad: 15px; 6 | body { 7 | padding: @pad; 8 | } 9 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/includable.js: -------------------------------------------------------------------------------- 1 | var STRING_SUBSTITUTIONS = { 2 | // table of character substitutions 3 | '\t': '\\t', 4 | '\r': '\\r', 5 | '\n': '\\n', 6 | '"': '\\"', 7 | '\\': '\\\\', 8 | }; 9 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/include-from-root.pug: -------------------------------------------------------------------------------- 1 | h1 hello -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/inheritance.extend.mixin.block.pug: -------------------------------------------------------------------------------- 1 | mixin article() 2 | article 3 | block 4 | 5 | html 6 | head 7 | title My Application 8 | block head 9 | body 10 | +article 11 | block content 12 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grand-grandparent.pug: -------------------------------------------------------------------------------- 1 | h1 grand-grandparent 2 | block grand-grandparent -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grandparent.pug: -------------------------------------------------------------------------------- 1 | extends inheritance.extend.recursive-grand-grandparent.pug 2 | 3 | block grand-grandparent 4 | h2 grandparent 5 | block grandparent 6 | 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-parent.pug: -------------------------------------------------------------------------------- 1 | extends inheritance.extend.recursive-grandparent.pug 2 | 3 | block grandparent 4 | h3 parent 5 | block parent -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/layout.include.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title My Application 4 | block head 5 | body 6 | block content 7 | include window.pug 8 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/layout.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title My Application 4 | block head 5 | body 6 | block content -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/mixin-at-end-of-file.pug: -------------------------------------------------------------------------------- 1 | mixin slide 2 | section.slide 3 | block -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/mixins.pug: -------------------------------------------------------------------------------- 1 | 2 | mixin foo() 3 | p bar -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/pet.pug: -------------------------------------------------------------------------------- 1 | .pet 2 | h1 {{name}} 3 | p {{name}} is a {{species}} that is {{age}} old -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/smile.html: -------------------------------------------------------------------------------- 1 |

:)

2 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/window.pug: -------------------------------------------------------------------------------- 1 | 2 | .window 3 | a(href='#').close Close 4 | block window-content -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/auxiliary/yield-nested.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title 4 | body 5 | h1 Page 6 | #content 7 | #content-wrapper 8 | yield 9 | #footer 10 | stuff -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-extends-from-root.pug: -------------------------------------------------------------------------------- 1 | include /auxiliary/extends-from-root.pug 2 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-extends-of-common-template.pug: -------------------------------------------------------------------------------- 1 | include auxiliary/extends-empty-block-1.pug 2 | include auxiliary/extends-empty-block-2.pug 3 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-extends-relative.pug: -------------------------------------------------------------------------------- 1 | include ../cases-src/auxiliary/extends-relative.pug 2 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-filter-coffee.coffee: -------------------------------------------------------------------------------- 1 | math = 2 | square: (value) -> value * value 3 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-filter-stylus.pug: -------------------------------------------------------------------------------- 1 | style(type="text/css") 2 | include:stylus some.styl 3 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-filter.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | include:markdown-it some.md 4 | script 5 | include:coffee-script(minify=true) include-filter-coffee.coffee 6 | script 7 | include:coffee-script(minify=false) include-filter-coffee.coffee 8 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-only-text-body.pug: -------------------------------------------------------------------------------- 1 | | The message is " 2 | yield 3 | | " 4 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-only-text.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | p 4 | include include-only-text-body.pug 5 | em hello world 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-with-text-head.pug: -------------------------------------------------------------------------------- 1 | head 2 | script(type='text/javascript'). 3 | alert('hello world'); 4 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include-with-text.pug: -------------------------------------------------------------------------------- 1 | html 2 | include include-with-text-head.pug 3 | script(src='/caustic.js') 4 | script(src='/app.js') 5 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include.script.pug: -------------------------------------------------------------------------------- 1 | script#pet-template(type='text/x-template') 2 | include auxiliary/pet.pug 3 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/include.yield.nested.pug: -------------------------------------------------------------------------------- 1 | 2 | include auxiliary/yield-nested.pug 3 | p some content 4 | p and some more 5 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/includes-with-ext-js.pug: -------------------------------------------------------------------------------- 1 | pre 2 | code 3 | include javascript-new-lines.js 4 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/includes.pug: -------------------------------------------------------------------------------- 1 | 2 | include auxiliary/mixins.pug 3 | 4 | +foo 5 | 6 | body 7 | include auxiliary/smile.html 8 | include auxiliary/escapes.html 9 | script(type="text/javascript") 10 | include:verbatim auxiliary/includable.js 11 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/javascript-new-lines.js: -------------------------------------------------------------------------------- 1 | var x = '\n here is some \n new lined text'; 2 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/layout.append.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/append/app-layout.pug 3 | 4 | block append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/layout.append.without-block.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/append-without-block/app-layout.pug 3 | 4 | append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/layout.multi.append.prepend.block.pug: -------------------------------------------------------------------------------- 1 | extends ../fixtures/multi-append-prepend-block/redefine.pug 2 | 3 | append content 4 | p.first.append Something appended to content 5 | 6 | prepend content 7 | p.first.prepend Something prepended to content 8 | 9 | append content 10 | p.last.append Last append must be most last 11 | 12 | prepend content 13 | p.last.prepend Last prepend must appear at top 14 | 15 | append head 16 | script(src='jquery.js') 17 | 18 | prepend head 19 | script(src='foo.js') 20 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/layout.prepend.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/prepend/app-layout.pug 3 | 4 | block prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/layout.prepend.without-block.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/prepend-without-block/app-layout.pug 3 | 4 | prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/some-included.styl: -------------------------------------------------------------------------------- 1 | body 2 | padding 10px 3 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/some.md: -------------------------------------------------------------------------------- 1 | Just _some_ markdown **tests**. 2 | 3 | With new line. 4 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases-src/some.styl: -------------------------------------------------------------------------------- 1 | @import "some-included" 2 | -------------------------------------------------------------------------------- /packages/pug-linker/test/cases/include-only-text-body.input.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "Block", 3 | "nodes": [ 4 | { 5 | "type": "Text", 6 | "val": "The message is \"", 7 | "line": 1, 8 | "filename": "include-only-text-body.pug" 9 | }, 10 | { 11 | "type": "YieldBlock", 12 | "line": 2, 13 | "filename": "include-only-text-body.pug" 14 | }, 15 | { 16 | "type": "Text", 17 | "val": "\"", 18 | "line": 3, 19 | "filename": "include-only-text-body.pug" 20 | } 21 | ], 22 | "line": 0, 23 | "filename": "include-only-text-body.pug" 24 | } -------------------------------------------------------------------------------- /packages/pug-linker/test/errors-src/child-with-tags.pug: -------------------------------------------------------------------------------- 1 | extend ../fixtures/layout 2 | 3 | block body 4 | p Hello world! 5 | 6 | p BAD!!! 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/errors-src/extends-not-first.pug: -------------------------------------------------------------------------------- 1 | block body 2 | p Hey 3 | 4 | extends ../fixtures/layout 5 | -------------------------------------------------------------------------------- /packages/pug-linker/test/errors-src/unexpected-block.pug: -------------------------------------------------------------------------------- 1 | extends ../fixtures/empty.pug 2 | 3 | block foo 4 | div Hello World 5 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/append-without-block/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout.pug 3 | 4 | append head 5 | script(src='app.js') 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/append-without-block/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/append-without-block/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout.pug 3 | 4 | append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/append/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout 3 | 4 | block append head 5 | script(src='app.js') -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/append/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/append/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/append/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout 3 | 4 | block append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/empty.pug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pugjs/pug/32acfe8f197dc44c54e8af32c7d7b19aa9d350fb/packages/pug-linker/test/fixtures/empty.pug -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/layout.pug: -------------------------------------------------------------------------------- 1 | doctype 2 | 3 | html 4 | head 5 | block head 6 | Hello world! 7 | body 8 | block body 9 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/mixins.pug: -------------------------------------------------------------------------------- 1 | mixin image(src) 2 | img(cl-src=src)&attributes(attributes) 3 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/multi-append-prepend-block/redefine.pug: -------------------------------------------------------------------------------- 1 | extends root.pug 2 | 3 | block content 4 | .content 5 | | Defined content 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/multi-append-prepend-block/root.pug: -------------------------------------------------------------------------------- 1 | block content 2 | | default content 3 | 4 | block head 5 | script(src='/app.js') -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend-without-block/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout.pug 3 | 4 | prepend head 5 | script(src='app.js') 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend-without-block/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend-without-block/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend-without-block/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout.pug 3 | 4 | prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout.pug 3 | 4 | block prepend head 5 | script(src='app.js') 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug-linker/test/fixtures/prepend/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout.pug 3 | 4 | block prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug-linker/test/special-cases-src/extending-empty.pug: -------------------------------------------------------------------------------- 1 | extend ../fixtures/empty.pug 2 | -------------------------------------------------------------------------------- /packages/pug-linker/test/special-cases-src/extending-include.pug: -------------------------------------------------------------------------------- 1 | extend ../fixtures/layout.pug 2 | include ../fixtures/mixins.pug 3 | 4 | block body 5 | +image('myimg.png').with-border(alt="My image") 6 | -------------------------------------------------------------------------------- /packages/pug-linker/test/special-cases-src/root-mixin.pug: -------------------------------------------------------------------------------- 1 | extend ../fixtures/layout.pug 2 | 3 | mixin myMixin 4 | p Hello world 5 | 6 | block body 7 | p Before 8 | +myMixin 9 | p After 10 | -------------------------------------------------------------------------------- /packages/pug-load/HISTORY.md: -------------------------------------------------------------------------------- 1 | 2.0.3 / 2016-08-24 2 | ================== 3 | 4 | * Do not pollute the user's `options` object 5 | 6 | 2.0.2 / 2016-08-23 7 | ================== 8 | 9 | * Only publish the module itself 10 | 11 | 2.0.1 / 2016-08-23 12 | ================== 13 | 14 | * Update to pug-walk@^1.0.0 15 | 16 | 2.0.0 / 2016-05-14 17 | ================== 18 | 19 | * Make filename part of the options - updates to the 2.x.y APIs for lexer and parser 20 | -------------------------------------------------------------------------------- /packages/pug-load/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pug-load", 3 | "version": "2.0.12", 4 | "description": "The Pug loader is responsible for loading the depenendencies of a given Pug file.", 5 | "keywords": [ 6 | "pug" 7 | ], 8 | "dependencies": { 9 | "object-assign": "^4.1.1", 10 | "pug-walk": "^1.1.8" 11 | }, 12 | "devDependencies": { 13 | "pug-lexer": "^4.1.0", 14 | "pug-parser": "^5.0.1" 15 | }, 16 | "files": [ 17 | "index.js" 18 | ], 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/pugjs/pug/tree/master/packages/pug-load" 22 | }, 23 | "author": "ForbesLindesay", 24 | "license": "MIT" 25 | } 26 | -------------------------------------------------------------------------------- /packages/pug-load/test/bar.pug: -------------------------------------------------------------------------------- 1 | block bing 2 | -------------------------------------------------------------------------------- /packages/pug-load/test/bing.pug: -------------------------------------------------------------------------------- 1 | .bing bong 2 | -------------------------------------------------------------------------------- /packages/pug-load/test/foo.pug: -------------------------------------------------------------------------------- 1 | extends bar.pug 2 | 3 | block bing 4 | include bing.pug 5 | script 6 | include script.js 7 | -------------------------------------------------------------------------------- /packages/pug-load/test/script.js: -------------------------------------------------------------------------------- 1 | document.write('hello world!'); 2 | -------------------------------------------------------------------------------- /packages/pug-parser/HISTORY.md: -------------------------------------------------------------------------------- 1 | 2.0.1 / 2016-06-01 2 | ================== 3 | 4 | * Add a brief API introduction to README 5 | 6 | 2.0.0 / 2016-05-14 7 | ================== 8 | 9 | * Take the `filename` as an option rather than special casing it. This means that parse only takes 2 arguments rather than 3 10 | * Add type checking on arguments 11 | * Treat the legacy `.jade` extension as `.pug` rather than a raw include 12 | -------------------------------------------------------------------------------- /packages/pug-parser/lib/inline-tags.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = [ 4 | 'a', 5 | 'abbr', 6 | 'acronym', 7 | 'b', 8 | 'br', 9 | 'code', 10 | 'em', 11 | 'font', 12 | 'i', 13 | 'img', 14 | 'ins', 15 | 'kbd', 16 | 'map', 17 | 'samp', 18 | 'small', 19 | 'span', 20 | 'strong', 21 | 'sub', 22 | 'sup', 23 | ]; 24 | -------------------------------------------------------------------------------- /packages/pug-parser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pug-parser", 3 | "version": "5.0.1", 4 | "description": "The pug parser (takes an array of tokens and converts it to an abstract syntax tree)", 5 | "keywords": [ 6 | "pug" 7 | ], 8 | "dependencies": { 9 | "pug-error": "^1.3.3", 10 | "token-stream": "1.0.0" 11 | }, 12 | "devDependencies": {}, 13 | "files": [ 14 | "lib/inline-tags.js", 15 | "index.js" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/pugjs/pug/tree/master/packages/pug-parser" 20 | }, 21 | "author": "ForbesLindesay", 22 | "license": "MIT" 23 | } 24 | -------------------------------------------------------------------------------- /packages/pug-parser/test/cases/doctype.custom.tokens.json: -------------------------------------------------------------------------------- 1 | {"type":"doctype","loc":{"start":{"line":1,"column":1},"filename":"/cases/doctype.custom.pug","end":{"line":1,"column":21}},"val":"custom stuff"} 2 | {"type":"eos","loc":{"start":{"line":1,"column":21},"filename":"/cases/doctype.custom.pug","end":{"line":1,"column":21}}} -------------------------------------------------------------------------------- /packages/pug-parser/test/cases/doctype.keyword.tokens.json: -------------------------------------------------------------------------------- 1 | {"type":"doctype","loc":{"start":{"line":1,"column":1},"filename":"/cases/doctype.keyword.pug","end":{"line":1,"column":13}},"val":"html"} 2 | {"type":"eos","loc":{"start":{"line":1,"column":13},"filename":"/cases/doctype.keyword.pug","end":{"line":1,"column":13}}} -------------------------------------------------------------------------------- /packages/pug-parser/test/cases/filter-in-include.tokens.json: -------------------------------------------------------------------------------- 1 | {"type":"include","loc":{"start":{"line":1,"column":1},"filename":"/cases/filter-in-include.pug","end":{"line":1,"column":8}}} 2 | {"type":"path","loc":{"start":{"line":1,"column":9},"filename":"/cases/filter-in-include.pug","end":{"line":1,"column":42}},"val":"./auxiliary/filter-in-include.pug"} 3 | {"type":"newline","loc":{"start":{"line":2,"column":1},"filename":"/cases/filter-in-include.pug","end":{"line":2,"column":1}}} 4 | {"type":"eos","loc":{"start":{"line":2,"column":1},"filename":"/cases/filter-in-include.pug","end":{"line":2,"column":1}}} -------------------------------------------------------------------------------- /packages/pug-parser/test/cases/include-extends-from-root.tokens.json: -------------------------------------------------------------------------------- 1 | {"type":"include","loc":{"start":{"line":1,"column":1},"filename":"/cases/include-extends-from-root.pug","end":{"line":1,"column":8}}} 2 | {"type":"path","loc":{"start":{"line":1,"column":9},"filename":"/cases/include-extends-from-root.pug","end":{"line":1,"column":41}},"val":"/auxiliary/extends-from-root.pug"} 3 | {"type":"newline","loc":{"start":{"line":2,"column":1},"filename":"/cases/include-extends-from-root.pug","end":{"line":2,"column":1}}} 4 | {"type":"eos","loc":{"start":{"line":2,"column":1},"filename":"/cases/include-extends-from-root.pug","end":{"line":2,"column":1}}} -------------------------------------------------------------------------------- /packages/pug-parser/test/cases/include-extends-relative.tokens.json: -------------------------------------------------------------------------------- 1 | {"type":"include","loc":{"start":{"line":1,"column":1},"filename":"/cases/include-extends-relative.pug","end":{"line":1,"column":8}}} 2 | {"type":"path","loc":{"start":{"line":1,"column":9},"filename":"/cases/include-extends-relative.pug","end":{"line":1,"column":48}},"val":"../cases/auxiliary/extends-relative.pug"} 3 | {"type":"newline","loc":{"start":{"line":2,"column":1},"filename":"/cases/include-extends-relative.pug","end":{"line":2,"column":1}}} 4 | {"type":"eos","loc":{"start":{"line":2,"column":1},"filename":"/cases/include-extends-relative.pug","end":{"line":2,"column":1}}} -------------------------------------------------------------------------------- /packages/pug-parser/test/cases/single-period.tokens.json: -------------------------------------------------------------------------------- 1 | {"type":"tag","loc":{"start":{"line":1,"column":1},"filename":"/cases/single-period.pug","end":{"line":1,"column":5}},"val":"span"} 2 | {"type":"text","loc":{"start":{"line":1,"column":6},"filename":"/cases/single-period.pug","end":{"line":1,"column":7}},"val":"."} 3 | {"type":"eos","loc":{"start":{"line":1,"column":7},"filename":"/cases/single-period.pug","end":{"line":1,"column":7}}} -------------------------------------------------------------------------------- /packages/pug-parser/test/cases/utf8bom.tokens.json: -------------------------------------------------------------------------------- 1 | {"type":"tag","loc":{"start":{"line":1,"column":1},"filename":"/cases/utf8bom.pug","end":{"line":1,"column":2}},"val":"p"} 2 | {"type":"text","loc":{"start":{"line":1,"column":3},"filename":"/cases/utf8bom.pug","end":{"line":1,"column":8}},"val":"\"foo\""} 3 | {"type":"newline","loc":{"start":{"line":2,"column":1},"filename":"/cases/utf8bom.pug","end":{"line":2,"column":1}}} 4 | {"type":"eos","loc":{"start":{"line":2,"column":1},"filename":"/cases/utf8bom.pug","end":{"line":2,"column":1}}} -------------------------------------------------------------------------------- /packages/pug-parser/test/no-unnecessary-blocks.test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var lex = require('pug-lexer'); 4 | var parse = require('../'); 5 | 6 | const input = ` 7 | div 8 | | Hello 9 | | World 10 | `; 11 | 12 | test('no uncessessary blocks should be added', () => { 13 | expect(parse(lex(input))).toMatchSnapshot(); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/pug-runtime/.gitignore: -------------------------------------------------------------------------------- 1 | /lib 2 | -------------------------------------------------------------------------------- /packages/pug-runtime/wrap.js: -------------------------------------------------------------------------------- 1 | var runtime = require('./'); 2 | 3 | module.exports = wrap; 4 | function wrap(template, templateName) { 5 | templateName = templateName || 'template'; 6 | return Function( 7 | 'pug', 8 | template + '\n' + 'return ' + templateName + ';' 9 | )(runtime); 10 | } 11 | -------------------------------------------------------------------------------- /packages/pug-strip-comments/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | This project adheres to [Semantic Versioning](http://semver.org/). 4 | 5 | ## 1.0.1 - 2016-08-10 6 | ### Changed 7 | - Project name is changed to Pug 8 | - Otherwise unchanged from 1.0.0 9 | 10 | ## 1.0.0 - 2015-08-10 11 | ### Added 12 | - Initial stable release – unchanged from 0.0.1 13 | 14 | ## 0.0.1 - 2015-08-10 15 | ### Added 16 | - Initial release 17 | -------------------------------------------------------------------------------- /packages/pug-strip-comments/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pug-strip-comments", 3 | "version": "1.0.4", 4 | "description": "Strip comments from a Pug token stream (from the lexer)", 5 | "keywords": [ 6 | "pug" 7 | ], 8 | "dependencies": { 9 | "pug-error": "^1.3.3" 10 | }, 11 | "devDependencies": { 12 | "line-json": "^2.0.0" 13 | }, 14 | "files": [ 15 | "index.js" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/pugjs/pug/tree/master/packages/pug-strip-comments" 20 | }, 21 | "author": "Timothy Gu ", 22 | "license": "MIT" 23 | } 24 | -------------------------------------------------------------------------------- /packages/pug-strip-comments/test/errors/comment-in-comment.input.json: -------------------------------------------------------------------------------- 1 | {"type":"comment","line":1,"val":"","buffer":false} 2 | {"type":"comment","line":2,"val":"","buffer":false} 3 | {"type":"eos","line":3} -------------------------------------------------------------------------------- /packages/pug-strip-comments/test/errors/end.input.json: -------------------------------------------------------------------------------- 1 | {"type":"comment","line":1,"val":"","buffer":false} 2 | {"type":"end-pipeless-text","line":4} 3 | {"type":"newline","line":4} 4 | {"type":"eos","line":5} -------------------------------------------------------------------------------- /packages/pug-strip-comments/test/errors/startstart.input.json: -------------------------------------------------------------------------------- 1 | {"type":"comment","line":1,"val":"","buffer":false} 2 | {"type":"start-pipeless-text","line":2} 3 | {"type":"start-pipeless-text","line":3} 4 | {"type":"end-pipeless-text","line":4} 5 | {"type":"newline","line":4} 6 | {"type":"eos","line":5} -------------------------------------------------------------------------------- /packages/pug-walk/.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | coverage 3 | *.seed 4 | *.log 5 | *.csv 6 | *.dat 7 | *.out 8 | *.pid 9 | *.gz 10 | pids 11 | logs 12 | results 13 | npm-debug.log 14 | node_modules 15 | -------------------------------------------------------------------------------- /packages/pug-walk/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | 4 | node_js: 5 | - "0.10" 6 | - "0.12" 7 | - "4" 8 | - "6" 9 | 10 | after_success: 11 | - npm run coverage 12 | - npm i codecov 13 | - codecov -f ./coverage/lcov.info 14 | 15 | notifications: 16 | email: 17 | on_success: never 18 | -------------------------------------------------------------------------------- /packages/pug-walk/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.0 / 2016-08-22 2 | ================== 3 | 4 | * Initial stable release 5 | -------------------------------------------------------------------------------- /packages/pug-walk/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pug-walk", 3 | "version": "1.1.8", 4 | "description": "Walk and transform a pug AST", 5 | "keywords": [ 6 | "pug" 7 | ], 8 | "devDependencies": { 9 | "pug-lexer": "^4.1.0", 10 | "pug-parser": "^5.0.1" 11 | }, 12 | "files": [ 13 | "index.js" 14 | ], 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/pugjs/pug/tree/master/packages/pug-walk" 18 | }, 19 | "author": "ForbesLindesay", 20 | "license": "MIT" 21 | } 22 | -------------------------------------------------------------------------------- /packages/pug/examples/README.md: -------------------------------------------------------------------------------- 1 | The examples in this directory can be run simply by something like. 2 | 3 | node attributes.js 4 | 5 | You can also open `browser.html` in a browser. 6 | -------------------------------------------------------------------------------- /packages/pug/examples/attributes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/attributes.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | console.log(fn({name: 'tj'})); 11 | -------------------------------------------------------------------------------- /packages/pug/examples/attributes.pug: -------------------------------------------------------------------------------- 1 | div#id.left.container(class='user user-' + name) 2 | h1.title= name 3 | form 4 | //- unbuffered comment :) 5 | // An example of attributes. 6 | input(type='text' name='user[name]' value=name) 7 | input(checked, type='checkbox', name='user[blocked]') 8 | input(type='submit', value='Update') -------------------------------------------------------------------------------- /packages/pug/examples/code.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/code.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | var users = { 11 | tj: {age: 23, email: 'tj@vision-media.ca', isA: 'human'}, 12 | tobi: {age: 1, email: 'tobi@is-amazing.com', isA: 'ferret'}, 13 | }; 14 | 15 | console.log(fn({users: users})); 16 | -------------------------------------------------------------------------------- /packages/pug/examples/code.pug: -------------------------------------------------------------------------------- 1 | 2 | - var title = "Things" 3 | 4 | - 5 | var subtitle = ["Really", "long", 6 | "list", "of", 7 | "words"] 8 | h1= title 9 | h2= subtitle.join(" ") 10 | 11 | ul#users 12 | each user, name in users 13 | // expands to if (user.isA == 'ferret') 14 | if user.isA == 'ferret' 15 | li(class='user-' + name) #{name} is just a ferret 16 | else 17 | li(class='user-' + name) #{name} #{user.email} -------------------------------------------------------------------------------- /packages/pug/examples/dynamicscript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'); 6 | 7 | var locals = { 8 | users: { 9 | tj: {age: 23, email: 'tj@vision-media.ca', isA: 'human'}, 10 | tobi: {age: 1, email: 'tobi@is-amazing.com', isA: 'ferret'}, 11 | }, 12 | }; 13 | 14 | var fn = pug.compileFile(__dirname + '/dynamicscript.pug'); 15 | console.log(fn(locals)); 16 | -------------------------------------------------------------------------------- /packages/pug/examples/dynamicscript.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title Dynamic Inline JavaScript 4 | script. 5 | var users = !{JSON.stringify(users).replace(/<\//g, "<\\/")} 6 | -------------------------------------------------------------------------------- /packages/pug/examples/each.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/each.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | var users = { 11 | tj: {age: 23, email: 'tj@vision-media.ca', isA: 'human'}, 12 | tobi: {age: 1, email: 'tobi@is-amazing.com', isA: 'ferret'}, 13 | }; 14 | 15 | console.log(fn({users: users})); 16 | -------------------------------------------------------------------------------- /packages/pug/examples/each.pug: -------------------------------------------------------------------------------- 1 | ul#users 2 | each user, name in users 3 | li(class='user-' + name) #{name} #{user.email} -------------------------------------------------------------------------------- /packages/pug/examples/extend-layout.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | h1 My Site - #{title} 4 | block scripts 5 | script(src='/jquery.js') 6 | body 7 | block content 8 | block foot 9 | #footer 10 | p some footer content -------------------------------------------------------------------------------- /packages/pug/examples/extend.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/extend.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | var tobi = {name: 'tobi', age: 2}; 11 | var loki = {name: 'loki', age: 1}; 12 | var jane = {name: 'jane', age: 5}; 13 | 14 | console.log( 15 | fn({ 16 | title: 'pets', 17 | pets: [tobi, loki, jane], 18 | }) 19 | ); 20 | -------------------------------------------------------------------------------- /packages/pug/examples/extend.pug: -------------------------------------------------------------------------------- 1 | 2 | extends extend-layout.pug 3 | 4 | block scripts 5 | script(src='/jquery.js') 6 | script(src='/pets.js') 7 | 8 | block content 9 | h1= title 10 | each pet in pets 11 | include pet.pug 12 | -------------------------------------------------------------------------------- /packages/pug/examples/form.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/form.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | var user = { 11 | name: 'TJ', 12 | email: 'tj@vision-media.ca', 13 | city: 'Victoria', 14 | province: 'BC', 15 | }; 16 | 17 | console.log(fn({user: user})); 18 | -------------------------------------------------------------------------------- /packages/pug/examples/includes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/includes.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | console.log(fn()); 11 | -------------------------------------------------------------------------------- /packages/pug/examples/includes.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | include includes/head.pug 4 | body 5 | h1 My Site 6 | p Welcome to my super lame site. 7 | include includes/foot.pug 8 | -------------------------------------------------------------------------------- /packages/pug/examples/includes/foot.pug: -------------------------------------------------------------------------------- 1 | #footer 2 | p Copyright (c) foobar -------------------------------------------------------------------------------- /packages/pug/examples/includes/head.pug: -------------------------------------------------------------------------------- 1 | head 2 | title My Site 3 | // including other pug works 4 | include scripts.pug 5 | // including .html, .css, etc works 6 | include style.css 7 | -------------------------------------------------------------------------------- /packages/pug/examples/includes/scripts.pug: -------------------------------------------------------------------------------- 1 | script(src='/javascripts/jquery.js') 2 | script(src='/javascripts/app.js') 3 | -------------------------------------------------------------------------------- /packages/pug/examples/includes/style.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/examples/layout-debug.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'); 6 | 7 | pug.renderFile(__dirname + '/layout.pug', {debug: true}, function(err, html) { 8 | if (err) throw err; 9 | console.log(html); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/pug/examples/layout.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/layout.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | console.log(fn()); 11 | -------------------------------------------------------------------------------- /packages/pug/examples/layout.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html(lang="en") 3 | head 4 | title Example 5 | script. 6 | if (foo) { 7 | bar(); 8 | } 9 | body 10 | h1 Pug - node template engine 11 | #container 12 | :markdown-it 13 | Pug is a _high performance_ template engine for [node](http://nodejs.org), 14 | inspired by [haml](http://haml-lang.com/), and written by [TJ Holowaychuk](http://github.com/visionmedia). 15 | -------------------------------------------------------------------------------- /packages/pug/examples/mixins.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/mixins.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | var user = { 11 | name: 'tj', 12 | pets: ['tobi', 'loki', 'jane', 'manny'], 13 | }; 14 | 15 | console.log(fn({user: user})); 16 | -------------------------------------------------------------------------------- /packages/pug/examples/mixins.pug: -------------------------------------------------------------------------------- 1 | include mixins/dialog.pug 2 | include mixins/profile.pug 3 | 4 | .one 5 | +dialog 6 | 7 | .two 8 | +dialog-title('Whoop') 9 | 10 | .three 11 | +dialog-title-desc('Whoop', 'Just a mixin') 12 | 13 | #profile 14 | +profile(user) 15 | -------------------------------------------------------------------------------- /packages/pug/examples/mixins/dialog.pug: -------------------------------------------------------------------------------- 1 | 2 | mixin dialog 3 | .dialog 4 | h1 Whoop 5 | p stuff 6 | 7 | mixin dialog-title(title) 8 | .dialog 9 | h1= title 10 | p stuff 11 | 12 | mixin dialog-title-desc(title, desc) 13 | .dialog 14 | h1= title 15 | p= desc 16 | -------------------------------------------------------------------------------- /packages/pug/examples/mixins/profile.pug: -------------------------------------------------------------------------------- 1 | 2 | mixin pets(pets) 3 | ul.pets 4 | each pet in pets 5 | li= pet 6 | 7 | mixin profile(user) 8 | .user 9 | h2= user.name 10 | +pets(user.pets) 11 | -------------------------------------------------------------------------------- /packages/pug/examples/pet.pug: -------------------------------------------------------------------------------- 1 | .pet 2 | h2= pet.name 3 | p #{pet.name} is #{pet.age} year(s) old. -------------------------------------------------------------------------------- /packages/pug/examples/rss.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/rss.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | var items = []; 11 | 12 | items.push({ 13 | title: 'Example', 14 | description: 'Something', 15 | link: 'http://google.com', 16 | }); 17 | items.push({ 18 | title: 'LearnBoost', 19 | description: 'Cool', 20 | link: 'http://learnboost.com', 21 | }); 22 | items.push({ 23 | title: 'Express', 24 | description: 'Cool', 25 | link: 'http://expressjs.com', 26 | }); 27 | 28 | console.log(fn({items: items})); 29 | -------------------------------------------------------------------------------- /packages/pug/examples/rss.pug: -------------------------------------------------------------------------------- 1 | doctype xml 2 | rss(version='2.0') 3 | channel 4 | title RSS Title 5 | description Some description here 6 | link http://google.com 7 | lastBuildDate Mon, 06 Sep 2010 00:01:00 +0000 8 | pubDate Mon, 06 Sep 2009 16:45:00 +0000 9 | 10 | each item in items 11 | item 12 | title= item.title 13 | description= item.description 14 | link= item.link 15 | -------------------------------------------------------------------------------- /packages/pug/examples/text.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/text.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | console.log(fn({name: 'tj', email: 'tj@vision-media.ca'})); 11 | -------------------------------------------------------------------------------- /packages/pug/examples/whitespace.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var pug = require('../'), 6 | path = __dirname + '/whitespace.pug', 7 | str = require('fs').readFileSync(path, 'utf8'), 8 | fn = pug.compile(str, {filename: path, pretty: true}); 9 | 10 | console.log(fn()); 11 | -------------------------------------------------------------------------------- /packages/pug/examples/whitespace.pug: -------------------------------------------------------------------------------- 1 | - var js = '' 2 | doctype html 3 | html 4 | 5 | head 6 | title= "Some " + "JavaScript" 7 | != js 8 | 9 | 10 | 11 | body -------------------------------------------------------------------------------- /packages/pug/register.js: -------------------------------------------------------------------------------- 1 | var pug = require('./'); 2 | var resolvedPug = JSON.stringify(require.resolve('./')); 3 | 4 | function compileTemplate(module, filename) { 5 | var template = pug.compileFileClient(filename, { 6 | inlineRuntimeFunctions: false, 7 | }); 8 | var body = 9 | 'var pug = require(' + 10 | resolvedPug + 11 | ').runtime;\n\n' + 12 | 'module.exports = ' + 13 | template + 14 | ';'; 15 | module._compile(body, filename); 16 | } 17 | 18 | if (require.extensions) { 19 | require.extensions['.pug'] = compileTemplate; 20 | } 21 | -------------------------------------------------------------------------------- /packages/pug/test/README.md: -------------------------------------------------------------------------------- 1 | # Running Tests 2 | 3 | To run tests (with node.js installed) you must complete 2 steps. 4 | 5 | ## 1 Install dependencies 6 | 7 | ``` 8 | npm install 9 | ``` 10 | 11 | ## 2 Run tests 12 | 13 | ``` 14 | npm test 15 | ``` 16 | -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/attrs.unescaped.pug: -------------------------------------------------------------------------------- 1 | script(type='text/x-template') 2 | #user(id!='user-<%= user.id %>') 3 | h1 <%= user.title %> -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/case-when.pug: -------------------------------------------------------------------------------- 1 | when 5 2 | .foo 3 | when 6 4 | .bar -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/case-without-with.pug: -------------------------------------------------------------------------------- 1 | case foo 2 | .div -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/else-condition.pug: -------------------------------------------------------------------------------- 1 | if foo 2 | div 3 | else bar 4 | article -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/else-without-if.pug: -------------------------------------------------------------------------------- 1 | else 2 | .foo -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/inlining-a-mixin-after-a-tag.pug: -------------------------------------------------------------------------------- 1 | foo()+bar() -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/key-char-ending-badly.pug: -------------------------------------------------------------------------------- 1 | div("foo"abc) 2 | -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/key-ending-badly.pug: -------------------------------------------------------------------------------- 1 | div(foo!~abc) 2 | -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/mismatched-inline-tag.pug: -------------------------------------------------------------------------------- 1 | //- #1871 2 | p #[strong a} 3 | -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/mixin-args-syntax-error.pug: -------------------------------------------------------------------------------- 1 | mixin foo(a, b) 2 | +foo('a'b'b') 3 | -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/mixins-blocks-with-bodies.pug: -------------------------------------------------------------------------------- 1 | mixin foo 2 | block 3 | bar -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/multiple-non-nested-tags-on-a-line.pug: -------------------------------------------------------------------------------- 1 | foo()bar -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/non-existant-filter.pug: -------------------------------------------------------------------------------- 1 | :not-a-valid-filter 2 | foo bar -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/non-mixin-block.pug: -------------------------------------------------------------------------------- 1 | div 2 | block -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/open-brace-in-attributes.pug: -------------------------------------------------------------------------------- 1 | div(title=[) -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/readme.md: -------------------------------------------------------------------------------- 1 | This folder collects examples of files that are not valid `pug`, but were at some point accepted by the parser without throwing an error. The tests ensure that all these cases now throw some form of error message (hopefully a helpful one). -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/self-closing-tag-with-block.pug: -------------------------------------------------------------------------------- 1 | input 2 | | Inputs cannot have content 3 | -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/self-closing-tag-with-body.pug: -------------------------------------------------------------------------------- 1 | input Input's can't have content -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/self-closing-tag-with-code.pug: -------------------------------------------------------------------------------- 1 | input= 'Inputs cannot have code' 2 | -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/tabs-and-spaces.pug: -------------------------------------------------------------------------------- 1 | div 2 | div 3 | article -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/unclosed-interpolated-call.pug: -------------------------------------------------------------------------------- 1 | +#{myMixin -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/unclosed-interpolated-tag.pug: -------------------------------------------------------------------------------- 1 | mixin item 2 | block 3 | 4 | +item( Contact -------------------------------------------------------------------------------- /packages/pug/test/anti-cases/unclosed-interpolation.pug: -------------------------------------------------------------------------------- 1 | #{myMixin -------------------------------------------------------------------------------- /packages/pug/test/browser/index.html: -------------------------------------------------------------------------------- 1 |
-------------------------------------------------------------------------------- /packages/pug/test/cases-es2015/attr.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /packages/pug/test/cases-es2015/attr.pug: -------------------------------------------------------------------------------- 1 | - var avatar = '219b77f9d21de75e81851b6b886057c7' 2 | 3 | div.avatar-div(style=`background-image: url(https://www.gravatar.com/avatar/${avatar})`) 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/attrs-data.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/attrs-data.pug: -------------------------------------------------------------------------------- 1 | - var user = { name: 'tobi' } 2 | foo(data-user=user) 3 | foo(data-items=[1,2,3]) 4 | foo(data-username='tobi') 5 | foo(data-escaped={message: "Let's rock!"}) 6 | foo(data-ampersand={message: "a quote: " this & that"}) 7 | foo(data-epoc=new Date(0)) 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/attrs.colon.html: -------------------------------------------------------------------------------- 1 |
Click Me! 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/attrs.colon.pug: -------------------------------------------------------------------------------- 1 | //- Tests for using a colon-prefexed attribute (typical when using short-cut for Vue.js `v-bind`) 2 | div(:my-var="model") 3 | span(v-for="item in items" :key="item.id" :value="item.name") 4 | span( 5 | v-for="item in items" 6 | :key="item.id" 7 | :value="item.name" 8 | ) 9 | a(:link="goHere" value="static" :my-value="dynamic" @click="onClick()" :another="more") Click Me! 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/attrs.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
-------------------------------------------------------------------------------- /packages/pug/test/cases/attrs.js.pug: -------------------------------------------------------------------------------- 1 | - var id = 5 2 | - function answer() { return 42; } 3 | a(href='/user/' + id, class='button') 4 | a(href = '/user/' + id, class = 'button') 5 | meta(key='answer', value=answer()) 6 | a(class = ['class1', 'class2']) 7 | a.tag-class(class = ['class1', 'class2']) 8 | 9 | a(href='/user/' + id class='button') 10 | a(href = '/user/' + id class = 'button') 11 | meta(key='answer' value=answer()) 12 | a(class = ['class1', 'class2']) 13 | a.tag-class(class = ['class1', 'class2']) 14 | 15 | div(id=id)&attributes({foo: 'bar'}) 16 | - var bar = null 17 | div(foo=null bar=bar)&attributes({baz: 'baz'}) 18 | -------------------------------------------------------------------------------- /packages/pug/test/cases/attrs.unescaped.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/attrs.unescaped.pug: -------------------------------------------------------------------------------- 1 | script(type='text/x-template') 2 | div(id!='user-<%= user.id %>') 3 | h1 <%= user.title %> -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/1794-extends.pug: -------------------------------------------------------------------------------- 1 | block content -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/1794-include.pug: -------------------------------------------------------------------------------- 1 | mixin test() 2 | .test&attributes(attributes) 3 | 4 | +test() -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/blocks-in-blocks-layout.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title Default title 5 | body 6 | block body 7 | .container 8 | block content 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/dialog.pug: -------------------------------------------------------------------------------- 1 | 2 | extends window.pug 3 | 4 | block window-content 5 | .dialog 6 | block content 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/empty-block.pug: -------------------------------------------------------------------------------- 1 | block test 2 | 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/escapes.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/extends-empty-block-1.pug: -------------------------------------------------------------------------------- 1 | extends empty-block.pug 2 | 3 | block test 4 | div test1 5 | 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/extends-empty-block-2.pug: -------------------------------------------------------------------------------- 1 | extends empty-block.pug 2 | 3 | block test 4 | div test2 5 | 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/extends-from-root.pug: -------------------------------------------------------------------------------- 1 | extends /auxiliary/layout.pug 2 | 3 | block content 4 | include /auxiliary/include-from-root.pug 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/extends-relative.pug: -------------------------------------------------------------------------------- 1 | extends ../../cases/auxiliary/layout 2 | 3 | block content 4 | include ../../cases/auxiliary/include-from-root 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/filter-in-include.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | style(type="text/css") 4 | :less 5 | @pad: 15px; 6 | body { 7 | padding: @pad; 8 | } 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/includable.js: -------------------------------------------------------------------------------- 1 | var STRING_SUBSTITUTIONS = { 2 | // table of character substitutions 3 | '\t': '\\t', 4 | '\r': '\\r', 5 | '\n': '\\n', 6 | '"': '\\"', 7 | '\\': '\\\\', 8 | }; 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/include-from-root.pug: -------------------------------------------------------------------------------- 1 | h1 hello -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/inheritance.extend.mixin.block.pug: -------------------------------------------------------------------------------- 1 | mixin article() 2 | article 3 | block 4 | 5 | html 6 | head 7 | title My Application 8 | block head 9 | body 10 | +article 11 | block content 12 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/inheritance.extend.recursive-grand-grandparent.pug: -------------------------------------------------------------------------------- 1 | h1 grand-grandparent 2 | block grand-grandparent -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/inheritance.extend.recursive-grandparent.pug: -------------------------------------------------------------------------------- 1 | extends inheritance.extend.recursive-grand-grandparent.pug 2 | 3 | block grand-grandparent 4 | h2 grandparent 5 | block grandparent 6 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/inheritance.extend.recursive-parent.pug: -------------------------------------------------------------------------------- 1 | extends inheritance.extend.recursive-grandparent.pug 2 | 3 | block grandparent 4 | h3 parent 5 | block parent -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/layout.include.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title My Application 4 | block head 5 | body 6 | block content 7 | include window.pug 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/layout.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title My Application 4 | block head 5 | body 6 | block content -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/mixin-at-end-of-file.pug: -------------------------------------------------------------------------------- 1 | mixin slide 2 | section.slide 3 | block -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/mixins.pug: -------------------------------------------------------------------------------- 1 | 2 | mixin foo() 3 | p bar -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/pet.pug: -------------------------------------------------------------------------------- 1 | .pet 2 | h1 {{name}} 3 | p {{name}} is a {{species}} that is {{age}} old -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/smile.html: -------------------------------------------------------------------------------- 1 |

:)

-------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/window.pug: -------------------------------------------------------------------------------- 1 | 2 | .window 3 | a(href='#').close Close 4 | block window-content -------------------------------------------------------------------------------- /packages/pug/test/cases/auxiliary/yield-nested.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title 4 | body 5 | h1 Page 6 | #content 7 | #content-wrapper 8 | yield 9 | #footer 10 | stuff -------------------------------------------------------------------------------- /packages/pug/test/cases/basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Title

4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/basic.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | h1 Title -------------------------------------------------------------------------------- /packages/pug/test/cases/blanks.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/blanks.pug: -------------------------------------------------------------------------------- 1 | 2 | 3 | ul 4 | li foo 5 | 6 | li bar 7 | 8 | li baz 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/block-code.html: -------------------------------------------------------------------------------- 1 | 2 |
  • Uno
  • 3 |
  • Dos
  • 4 |
  • Tres
  • 5 |
  • Cuatro
  • 6 |
  • Cinco
  • 7 |
  • Seis
  • 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/block-code.pug: -------------------------------------------------------------------------------- 1 | - 2 | list = ["uno", "dos", "tres", 3 | "cuatro", "cinco", "seis"]; 4 | //- Without a block, the element is accepted and no code is generated 5 | - 6 | each item in list 7 | - 8 | string = item.charAt(0) 9 | 10 | .toUpperCase() + 11 | item.slice(1); 12 | li= string 13 | -------------------------------------------------------------------------------- /packages/pug/test/cases/block-expansion.html: -------------------------------------------------------------------------------- 1 | 5 |

    baz

    -------------------------------------------------------------------------------- /packages/pug/test/cases/block-expansion.pug: -------------------------------------------------------------------------------- 1 | ul 2 | li: a(href='#') foo 3 | li: a(href='#') bar 4 | 5 | p baz -------------------------------------------------------------------------------- /packages/pug/test/cases/block-expansion.shorthands.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/block-expansion.shorthands.pug: -------------------------------------------------------------------------------- 1 | ul 2 | li.list-item: .foo: #bar baz -------------------------------------------------------------------------------- /packages/pug/test/cases/blockquote.html: -------------------------------------------------------------------------------- 1 |
    2 |
    Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that.
    3 |
    from @thefray at 1:43pm on May 10
    4 |
    -------------------------------------------------------------------------------- /packages/pug/test/cases/blockquote.pug: -------------------------------------------------------------------------------- 1 | figure 2 | blockquote 3 | | Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that. 4 | figcaption from @thefray at 1:43pm on May 10 -------------------------------------------------------------------------------- /packages/pug/test/cases/blocks-in-blocks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Default title 5 | 6 | 7 |

    Page 2

    8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/blocks-in-blocks.pug: -------------------------------------------------------------------------------- 1 | extends ./auxiliary/blocks-in-blocks-layout.pug 2 | 3 | block body 4 | h1 Page 2 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/blocks-in-if.html: -------------------------------------------------------------------------------- 1 |

    ajax contents

    2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/blocks-in-if.pug: -------------------------------------------------------------------------------- 1 | //- see https://github.com/pugjs/pug/issues/1589 2 | 3 | -var ajax = true 4 | 5 | -if( ajax ) 6 | //- return only contents if ajax requests 7 | block contents 8 | p ajax contents 9 | 10 | -else 11 | //- return all html 12 | doctype html 13 | html 14 | head 15 | meta( charset='utf8' ) 16 | title sample 17 | body 18 | block contents 19 | p all contetns 20 | -------------------------------------------------------------------------------- /packages/pug/test/cases/case-blocks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    you have a friend

    4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/case-blocks.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | - var friends = 1 4 | case friends 5 | when 0 6 | p you have no friends 7 | when 1 8 | p you have a friend 9 | default 10 | p you have #{friends} friends -------------------------------------------------------------------------------- /packages/pug/test/cases/case.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    you have a friend

    5 |

    you have very few friends

    6 |

    Friend is a string

    7 | 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/case.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | - var friends = 1 4 | case friends 5 | when 0: p you have no friends 6 | when 1: p you have a friend 7 | default: p you have #{friends} friends 8 | - var friends = 0 9 | case friends 10 | when 0 11 | when 1 12 | p you have very few friends 13 | default 14 | p you have #{friends} friends 15 | 16 | - var friend = 'Tim:G' 17 | case friend 18 | when 'Tim:G': p Friend is a string 19 | when {tim: 'g'}: p Friend is an object 20 | -------------------------------------------------------------------------------- /packages/pug/test/cases/classes-empty.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/classes-empty.pug: -------------------------------------------------------------------------------- 1 | a(class='') 2 | a(class=null) 3 | a(class=undefined) -------------------------------------------------------------------------------- /packages/pug/test/cases/classes.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/classes.pug: -------------------------------------------------------------------------------- 1 | a(class=['foo', 'bar', 'baz']) 2 | 3 | 4 | 5 | a.foo(class='bar').baz 6 | 7 | 8 | 9 | a.foo-bar_baz 10 | 11 | a(class={foo: true, bar: false, baz: true}) 12 | -------------------------------------------------------------------------------- /packages/pug/test/cases/code.conditionals.html: -------------------------------------------------------------------------------- 1 |

    foo

    2 |

    foo

    3 |

    foo

    4 |

    bar

    5 |

    baz

    6 |

    bar

    7 |

    yay

    8 |
    9 |
    10 |
    11 |
    12 | -------------------------------------------------------------------------------- /packages/pug/test/cases/code.conditionals.pug: -------------------------------------------------------------------------------- 1 | 2 | - if (true) 3 | p foo 4 | - else 5 | p bar 6 | 7 | - if (true) { 8 | p foo 9 | - } else { 10 | p bar 11 | - } 12 | 13 | if true 14 | p foo 15 | p bar 16 | p baz 17 | else 18 | p bar 19 | 20 | unless true 21 | p foo 22 | else 23 | p bar 24 | 25 | if 'nested' 26 | if 'works' 27 | p yay 28 | 29 | //- allow empty blocks 30 | if false 31 | else 32 | .bar 33 | if true 34 | .bar 35 | else 36 | .bing 37 | 38 | if false 39 | .bing 40 | else if false 41 | .bar 42 | else 43 | .foo -------------------------------------------------------------------------------- /packages/pug/test/cases/code.escape.html: -------------------------------------------------------------------------------- 1 |

    <script>

    2 |

    -------------------------------------------------------------------------------- /packages/pug/test/cases/escape-chars.pug: -------------------------------------------------------------------------------- 1 | script. 2 | var re = /\d+/; -------------------------------------------------------------------------------- /packages/pug/test/cases/escape-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | escape-test 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/escape-test.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title escape-test 5 | body 6 | textarea 7 | - var txt = '' 8 | | #{txt} 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/escaping-class-attribute.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/escaping-class-attribute.pug: -------------------------------------------------------------------------------- 1 | foo(attr="<%= bar %>") 2 | foo(class="<%= bar %>") 3 | foo(attr!="<%= bar %>") 4 | foo(class!="<%= bar %>") 5 | foo(class!="<%= bar %> lol rofl") 6 | foo(class!="<%= bar %> lol rofl <%= lmao %>") 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filter-in-include.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filter-in-include.pug: -------------------------------------------------------------------------------- 1 | include ./auxiliary/filter-in-include.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters-empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters-empty.pug: -------------------------------------------------------------------------------- 1 | - var users = [{ name: 'tobi', age: 2 }] 2 | 3 | fb:users 4 | for user in users 5 | fb:user(age=user.age) 6 | :cdata 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.coffeescript.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.coffeescript.pug: -------------------------------------------------------------------------------- 1 | script(type='text/javascript') 2 | :coffee-script 3 | regexp = /\n/ 4 | :coffee-script(minify=true) 5 | math = 6 | square: (value) -> value * value 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.custom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | BEGINLine 1 4 | Line 2 5 | 6 | Line 4END 7 | 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.custom.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | :custom(opt='val' num=2) 4 | Line 1 5 | Line 2 6 | 7 | Line 4 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.include.custom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    BEGINhtml
     5 |   body
     6 |     pre
     7 |       include:custom(opt='val' num=2) filters.include.custom.pug
     8 | END
    9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.include.custom.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | pre 4 | include:custom(opt='val' num=2) filters.include.custom.pug 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.include.html: -------------------------------------------------------------------------------- 1 | 2 |

    Just some markdown tests.

    3 |

    With new line.

    4 | 5 | 6 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.include.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | include:markdown-it some.md 4 | script 5 | include:coffee-script(minify=true) include-filter-coffee.coffee 6 | script 7 | include:coffee-script(minify=false) include-filter-coffee.coffee 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.inline.html: -------------------------------------------------------------------------------- 1 | 2 |

    3 | before after

    -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.inline.pug: -------------------------------------------------------------------------------- 1 | p before #[:cdata inside] after -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.less.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.less.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | style(type="text/css") 4 | :less 5 | @pad: 15px; 6 | body { 7 | padding: @pad; 8 | } 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.markdown.html: -------------------------------------------------------------------------------- 1 | 2 |

    This is some awesome markdown 3 | whoop.

    4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.markdown.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | :markdown 4 | This is _some_ awesome **markdown** 5 | whoop. 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.nested.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.nested.pug: -------------------------------------------------------------------------------- 1 | script 2 | :cdata:uglify-js 3 | (function() { 4 | console.log('test') 5 | })() 6 | script 7 | :cdata:uglify-js:coffee-script 8 | (-> 9 | console.log 'test' 10 | )() 11 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.stylus.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/filters.stylus.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | style(type="text/css") 4 | :stylus 5 | body 6 | padding: 50px 7 | body 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/html.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 |

    You can embed html as well.

    9 |

    Even as the body of a block expansion.

    -------------------------------------------------------------------------------- /packages/pug/test/cases/html.pug: -------------------------------------------------------------------------------- 1 | - var version = 1449104952939 2 | 3 | 8 | 9 | 10 | 11 | 12 | p You can embed html as well. 13 | p: Even as the body of a block expansion. 14 | -------------------------------------------------------------------------------- /packages/pug/test/cases/html5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/html5.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | input(type='checkbox', checked) 3 | input(type='checkbox', checked=true) 4 | input(type='checkbox', checked=false) -------------------------------------------------------------------------------- /packages/pug/test/cases/include-extends-from-root.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 |

    hello

    7 | 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-extends-from-root.pug: -------------------------------------------------------------------------------- 1 | include /auxiliary/extends-from-root.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-extends-of-common-template.html: -------------------------------------------------------------------------------- 1 |
    test1
    2 |
    test2
    3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-extends-of-common-template.pug: -------------------------------------------------------------------------------- 1 | include auxiliary/extends-empty-block-1.pug 2 | include auxiliary/extends-empty-block-2.pug 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-extends-relative.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 |

    hello

    7 | 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-extends-relative.pug: -------------------------------------------------------------------------------- 1 | include ../cases/auxiliary/extends-relative.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-filter-coffee.coffee: -------------------------------------------------------------------------------- 1 | math = 2 | square: (value) -> value * value 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-only-text-body.html: -------------------------------------------------------------------------------- 1 | The message is "" -------------------------------------------------------------------------------- /packages/pug/test/cases/include-only-text-body.pug: -------------------------------------------------------------------------------- 1 | | The message is " 2 | yield 3 | | " 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-only-text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    The message is "hello world"

    4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-only-text.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | p 4 | include include-only-text-body.pug 5 | em hello world 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-with-text-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-with-text-head.pug: -------------------------------------------------------------------------------- 1 | head 2 | script(type='text/javascript'). 3 | alert('hello world'); 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-with-text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include-with-text.pug: -------------------------------------------------------------------------------- 1 | html 2 | include include-with-text-head.pug 3 | script(src='/caustic.js') 4 | script(src='/app.js') 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include.script.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include.script.pug: -------------------------------------------------------------------------------- 1 | script#pet-template(type='text/x-template') 2 | include auxiliary/pet.pug 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include.yield.nested.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

    Page

    7 |
    8 |
    9 |

    some content

    10 |

    and some more

    11 |
    12 |
    13 | 16 | 17 | -------------------------------------------------------------------------------- /packages/pug/test/cases/include.yield.nested.pug: -------------------------------------------------------------------------------- 1 | 2 | include auxiliary/yield-nested.pug 3 | p some content 4 | p and some more 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/includes-with-ext-js.html: -------------------------------------------------------------------------------- 1 |
    var x = '\n here is some \n new lined text';
    2 | 
    3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/includes-with-ext-js.pug: -------------------------------------------------------------------------------- 1 | pre 2 | code 3 | include javascript-new-lines.js 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/includes.html: -------------------------------------------------------------------------------- 1 |

    bar

    2 | 3 |

    :)

    6 | 18 | -------------------------------------------------------------------------------- /packages/pug/test/cases/includes.pug: -------------------------------------------------------------------------------- 1 | 2 | include auxiliary/mixins.pug 3 | 4 | +foo 5 | 6 | body 7 | include auxiliary/smile.html 8 | include auxiliary/escapes.html 9 | script(type="text/javascript") 10 | include:verbatim auxiliary/includable.js 11 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.alert-dialog.html: -------------------------------------------------------------------------------- 1 |
    Close 2 |
    3 |

    Alert!

    4 |

    I'm an alert!

    5 |
    6 |
    7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.alert-dialog.pug: -------------------------------------------------------------------------------- 1 | 2 | extends auxiliary/dialog.pug 3 | 4 | block content 5 | h1 Alert! 6 | p I'm an alert! 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.defaults.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.defaults.pug: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | block head 4 | script(src='jquery.js') 5 | script(src='keymaster.js') 6 | script(src='caustic.js') -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 | 7 |

    Page

    8 |

    Some content

    9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.include.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 | 7 |

    Page

    8 |

    Some content

    9 |
    Close 10 |

    Awesome

    11 |

    Now we can extend included blocks!

    12 |
    13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.include.pug: -------------------------------------------------------------------------------- 1 | 2 | extend auxiliary/layout.include.pug 3 | 4 | block head 5 | script(src='jquery.js') 6 | 7 | block content 8 | h2 Page 9 | p Some content 10 | 11 | block window-content 12 | h2 Awesome 13 | p Now we can extend included blocks! 14 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.mixins.block.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 |
    7 |

    Hello World!

    8 |
    9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.mixins.block.pug: -------------------------------------------------------------------------------- 1 | extend auxiliary/inheritance.extend.mixin.block.pug 2 | 3 | block content 4 | p Hello World! 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.mixins.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 |

    The meaning of life

    7 |

    Foo bar baz!

    8 | 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.mixins.pug: -------------------------------------------------------------------------------- 1 | 2 | extend auxiliary/layout.pug 3 | 4 | mixin article(title) 5 | if title 6 | h1= title 7 | block 8 | 9 | block content 10 | +article("The meaning of life") 11 | p Foo bar baz! 12 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.pug: -------------------------------------------------------------------------------- 1 | 2 | extend auxiliary/layout.pug 3 | 4 | block head 5 | script(src='jquery.js') 6 | 7 | block content 8 | h2 Page 9 | p Some content 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.recursive.html: -------------------------------------------------------------------------------- 1 |

    grand-grandparent

    2 |

    grandparent

    3 |

    parent

    4 |

    child

    -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.recursive.pug: -------------------------------------------------------------------------------- 1 | extends /auxiliary/inheritance.extend.recursive-parent.pug 2 | 3 | block parent 4 | h4 child -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.whitespace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 | 7 |

    Page

    8 |

    Some content

    9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.extend.whitespace.pug: -------------------------------------------------------------------------------- 1 | 2 | extend auxiliary/layout.pug 3 | 4 | block head 5 | 6 | script(src='jquery.js') 7 | 8 | block content 9 | 10 | 11 | 12 | h2 Page 13 | p Some content 14 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | My Application 4 | 5 | 6 | 7 |

    Page

    8 |

    Some content

    9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inheritance.pug: -------------------------------------------------------------------------------- 1 | 2 | extends auxiliary/layout.pug 3 | 4 | block head 5 | script(src='jquery.js') 6 | 7 | block content 8 | h2 Page 9 | p Some content 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/inline-tag.html: -------------------------------------------------------------------------------- 1 | 2 |

    bing foo bong

    3 |

    4 | bing 5 | foo 6 | [foo] 7 | 8 | bong 9 | 10 |

    11 |

    12 | bing 13 | foo 14 | [foo] 15 | 16 | bong 17 |

    18 |

    19 | #[strong escaped] 20 | #[escaped 21 |

    -------------------------------------------------------------------------------- /packages/pug/test/cases/inline-tag.pug: -------------------------------------------------------------------------------- 1 | p bing #[strong foo] bong 2 | 3 | p. 4 | bing 5 | #[strong foo] 6 | #[strong= '[foo]'] 7 | #[- var foo = 'foo]'] 8 | bong 9 | 10 | p 11 | | bing 12 | | #[strong foo] 13 | | #[strong= '[foo]'] 14 | | #[- var foo = 'foo]'] 15 | | bong 16 | 17 | p. 18 | \#[strong escaped] 19 | \#[#[strong escaped] 20 | -------------------------------------------------------------------------------- /packages/pug/test/cases/intepolated-elements.html: -------------------------------------------------------------------------------- 1 | 2 |

    with inline link

    3 |

    Some text

    4 |

    Some text with inline link

    -------------------------------------------------------------------------------- /packages/pug/test/cases/intepolated-elements.pug: -------------------------------------------------------------------------------- 1 | p #[a.rho(href='#', class='rho--modifier') with inline link] 2 | p Some text #[a.rho(href='#', class='rho--modifier')] 3 | p Some text #[a.rho(href='#', class='rho--modifier') with inline link] -------------------------------------------------------------------------------- /packages/pug/test/cases/interpolated-mixin.html: -------------------------------------------------------------------------------- 1 | 2 |

    This also works http://www.bing.com so hurrah for Pug 3 |

    -------------------------------------------------------------------------------- /packages/pug/test/cases/interpolated-mixin.pug: -------------------------------------------------------------------------------- 1 | mixin linkit(url) 2 | a(href=url)= url 3 | 4 | p This also works #[+linkit('http://www.bing.com')] so hurrah for Pug -------------------------------------------------------------------------------- /packages/pug/test/cases/interpolation.escape.html: -------------------------------------------------------------------------------- 1 | 2 | some 3 | #{text} 4 | here 5 | My ID is {42} 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/interpolation.escape.pug: -------------------------------------------------------------------------------- 1 | 2 | - var id = 42; 3 | foo 4 | | some 5 | | \#{text} 6 | | here 7 | | My ID #{"is {" + id + "}"} -------------------------------------------------------------------------------- /packages/pug/test/cases/javascript-new-lines.js: -------------------------------------------------------------------------------- 1 | var x = '\n here is some \n new lined text'; 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.append.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.append.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/append/app-layout.pug 3 | 4 | block append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.append.without-block.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.append.without-block.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/append-without-block/app-layout.pug 3 | 4 | append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.multi.append.prepend.block.html: -------------------------------------------------------------------------------- 1 |

    Last prepend must appear at top

    2 |

    Something prepended to content

    3 |
    Defined content
    4 |

    Something appended to content

    5 |

    Last append must be most last

    6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.multi.append.prepend.block.pug: -------------------------------------------------------------------------------- 1 | extends ../fixtures/multi-append-prepend-block/redefine.pug 2 | 3 | append content 4 | p.first.append Something appended to content 5 | 6 | prepend content 7 | p.first.prepend Something prepended to content 8 | 9 | append content 10 | p.last.append Last append must be most last 11 | 12 | prepend content 13 | p.last.prepend Last prepend must appear at top 14 | 15 | append head 16 | script(src='jquery.js') 17 | 18 | prepend head 19 | script(src='foo.js') 20 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.prepend.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.prepend.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/prepend/app-layout.pug 3 | 4 | block prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.prepend.without-block.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/layout.prepend.without-block.pug: -------------------------------------------------------------------------------- 1 | 2 | extends ../fixtures/prepend-without-block/app-layout.pug 3 | 4 | prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-at-end-of-file.html: -------------------------------------------------------------------------------- 1 |
    2 |

    some awesome content

    3 |
    4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-at-end-of-file.pug: -------------------------------------------------------------------------------- 1 | include ./auxiliary/mixin-at-end-of-file.pug 2 | 3 | +slide() 4 | p some awesome content 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-block-with-space.html: -------------------------------------------------------------------------------- 1 | 2 |
    This text should appear 3 |
    -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-block-with-space.pug: -------------------------------------------------------------------------------- 1 | mixin m(id) 2 | div 3 | block 4 | 5 | +m() 6 | | This text should appear -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-hoist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    Pug

    4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-hoist.pug: -------------------------------------------------------------------------------- 1 | 2 | mixin foo() 3 | h1= title 4 | 5 | html 6 | body 7 | +foo 8 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-via-include.html: -------------------------------------------------------------------------------- 1 |

    bar

    -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin-via-include.pug: -------------------------------------------------------------------------------- 1 | //- regression test for https://github.com/pugjs/pug/issues/1435 2 | 3 | include ../fixtures/mixin-include.pug 4 | 5 | +bang -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin.block-tag-behaviour.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 |

    Foo

    5 |

    I'm article foo

    6 |
    7 | 8 | 9 | 10 | 11 |
    12 |

    Something

    13 |

    14 | I'm a much longer 15 | text-only article, 16 | but you can still 17 | inline html tags 18 | in me if you want. 19 |

    20 |
    21 | 22 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin.block-tag-behaviour.pug: -------------------------------------------------------------------------------- 1 | 2 | mixin article(name) 3 | section.article 4 | h1= name 5 | block 6 | 7 | html 8 | body 9 | +article('Foo'): p I'm article foo 10 | 11 | mixin article(name) 12 | section.article 13 | h1= name 14 | p 15 | block 16 | 17 | html 18 | body 19 | +article('Something'). 20 | I'm a much longer 21 | text-only article, 22 | but you can still 23 | inline html tags 24 | in me if you want. -------------------------------------------------------------------------------- /packages/pug/test/cases/mixin.merge.pug: -------------------------------------------------------------------------------- 1 | mixin foo 2 | p.bar&attributes(attributes) One 3 | p.baz.quux&attributes(attributes) Two 4 | p&attributes(attributes) Three 5 | p.bar&attributes(attributes)(class="baz") Four 6 | 7 | body 8 | +foo.hello 9 | +foo#world 10 | +foo.hello#world 11 | +foo.hello.world 12 | +foo(class="hello") 13 | +foo.hello(class="world") 14 | +foo 15 | +foo&attributes({class: "hello"}) -------------------------------------------------------------------------------- /packages/pug/test/cases/mixins-unused.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixins-unused.pug: -------------------------------------------------------------------------------- 1 | mixin never-called 2 | .wtf This isn't something we ever want to output 3 | body -------------------------------------------------------------------------------- /packages/pug/test/cases/mixins.html: -------------------------------------------------------------------------------- 1 | 2 |
    3 |

    Tobi

    4 |
    5 |
    6 |

    This

    7 |

    is regular, javascript

    8 |
    9 |
    10 |
    11 | 12 | 17 | 22 | 23 |
    This is interpolated
    -------------------------------------------------------------------------------- /packages/pug/test/cases/mixins.pug: -------------------------------------------------------------------------------- 1 | mixin comment(title, str) 2 | .comment 3 | h2= title 4 | p.body= str 5 | 6 | 7 | mixin comment (title, str) 8 | .comment 9 | h2= title 10 | p.body= str 11 | 12 | #user 13 | h1 Tobi 14 | .comments 15 | +comment('This', 16 | (('is regular, javascript'))) 17 | 18 | mixin list 19 | ul 20 | li foo 21 | li bar 22 | li baz 23 | 24 | body 25 | +list() 26 | + list() 27 | 28 | mixin foobar(str) 29 | div#interpolation= str + 'interpolated' 30 | 31 | - var suffix = "bar" 32 | +#{'foo' + suffix}('This is ') 33 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixins.rest-args.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/mixins.rest-args.pug: -------------------------------------------------------------------------------- 1 | mixin list(tag, ...items) 2 | #{tag} 3 | each item in items 4 | li= item 5 | 6 | +list('ul', 1, 2, 3, 4) 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/namespaces.html: -------------------------------------------------------------------------------- 1 | Something 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/namespaces.pug: -------------------------------------------------------------------------------- 1 | fb:user:role Something 2 | foo(fb:foo='bar') -------------------------------------------------------------------------------- /packages/pug/test/cases/nesting.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/nesting.pug: -------------------------------------------------------------------------------- 1 | ul 2 | li a 3 | li b 4 | li 5 | ul 6 | li c 7 | li d 8 | li e -------------------------------------------------------------------------------- /packages/pug/test/cases/pipeless-comments.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/pipeless-comments.pug: -------------------------------------------------------------------------------- 1 | // 2 | .foo 3 | .bar 4 | .hey 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/pipeless-filters.html: -------------------------------------------------------------------------------- 1 |
    code sample
    2 | 

    Heading

    3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/pipeless-filters.pug: -------------------------------------------------------------------------------- 1 | :markdown-it 2 | code sample 3 | 4 | # Heading 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/pipeless-tag.html: -------------------------------------------------------------------------------- 1 | 2 |
      what
    3 | is going on
    -------------------------------------------------------------------------------- /packages/pug/test/cases/pipeless-tag.pug: -------------------------------------------------------------------------------- 1 | pre. 2 | what 3 | is #{'going'} #[| #{'on'}] 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/pre.html: -------------------------------------------------------------------------------- 1 |
    foo
    2 | bar
    3 | baz
    4 | 
    5 |
    foo
    6 | bar
    7 | baz
    -------------------------------------------------------------------------------- /packages/pug/test/cases/pre.pug: -------------------------------------------------------------------------------- 1 | pre. 2 | foo 3 | bar 4 | baz 5 | 6 | pre 7 | code. 8 | foo 9 | bar 10 | baz -------------------------------------------------------------------------------- /packages/pug/test/cases/quotes.html: -------------------------------------------------------------------------------- 1 |

    "foo"

    2 |

    'foo'

    -------------------------------------------------------------------------------- /packages/pug/test/cases/quotes.pug: -------------------------------------------------------------------------------- 1 | p "foo" 2 | p 'foo' -------------------------------------------------------------------------------- /packages/pug/test/cases/regression.1794.html: -------------------------------------------------------------------------------- 1 |
    -------------------------------------------------------------------------------- /packages/pug/test/cases/regression.1794.pug: -------------------------------------------------------------------------------- 1 | extends ./auxiliary/1794-extends.pug 2 | 3 | block content 4 | include ./auxiliary/1794-include.pug -------------------------------------------------------------------------------- /packages/pug/test/cases/regression.784.html: -------------------------------------------------------------------------------- 1 |
    google.com
    -------------------------------------------------------------------------------- /packages/pug/test/cases/regression.784.pug: -------------------------------------------------------------------------------- 1 | - var url = 'http://www.google.com' 2 | .url #{url.replace('http://', '').replace(/^www\./, '')} -------------------------------------------------------------------------------- /packages/pug/test/cases/script.whitespace.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/script.whitespace.pug: -------------------------------------------------------------------------------- 1 | script. 2 | if (foo) { 3 | 4 | bar(); 5 | 6 | } -------------------------------------------------------------------------------- /packages/pug/test/cases/scripts.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 |
    -------------------------------------------------------------------------------- /packages/pug/test/cases/scripts.non-js.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/scripts.non-js.pug: -------------------------------------------------------------------------------- 1 | script#user-template(type='text/template') 2 | #user 3 | h1 <%= user.name %> 4 | p <%= user.description %> 5 | 6 | script#user-template(type='text/template'). 7 | if (foo) { 8 | bar(); 9 | } -------------------------------------------------------------------------------- /packages/pug/test/cases/scripts.pug: -------------------------------------------------------------------------------- 1 | script. 2 | if (foo) { 3 | bar(); 4 | } 5 | script!= 'foo()' 6 | script foo() 7 | script 8 | div -------------------------------------------------------------------------------- /packages/pug/test/cases/self-closing-html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/self-closing-html.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | body 4 | br/ 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/single-period.html: -------------------------------------------------------------------------------- 1 | . -------------------------------------------------------------------------------- /packages/pug/test/cases/single-period.pug: -------------------------------------------------------------------------------- 1 | span . -------------------------------------------------------------------------------- /packages/pug/test/cases/some-included.styl: -------------------------------------------------------------------------------- 1 | body 2 | padding 10px 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/some.md: -------------------------------------------------------------------------------- 1 | Just _some_ markdown **tests**. 2 | 3 | With new line. 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/some.styl: -------------------------------------------------------------------------------- 1 | @import "some-included" 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/source.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/source.pug: -------------------------------------------------------------------------------- 1 | html 2 | audio(preload='auto', autobuffer, controls) 3 | source(src='foo') 4 | source(src='bar') -------------------------------------------------------------------------------- /packages/pug/test/cases/tag.interpolation.html: -------------------------------------------------------------------------------- 1 |

    value

    2 |

    value

    3 | here 4 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/tag.interpolation.pug: -------------------------------------------------------------------------------- 1 | 2 | - var tag = 'p' 3 | - var foo = 'bar' 4 | 5 | #{tag} value 6 | #{tag}(foo='bar') value 7 | #{foo ? 'a' : 'li'}(something) here 8 | 9 | mixin item(icon) 10 | li 11 | if attributes.href 12 | a&attributes(attributes) 13 | img.icon(src=icon) 14 | block 15 | else 16 | span&attributes(attributes) 17 | img.icon(src=icon) 18 | block 19 | 20 | ul 21 | +item('contact') Contact 22 | +item(href='/contact') Contact 23 | -------------------------------------------------------------------------------- /packages/pug/test/cases/tags.self-closing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | / 8 | / 9 | 10 | 11 | / 12 | / 13 | 14 | -------------------------------------------------------------------------------- /packages/pug/test/cases/tags.self-closing.pug: -------------------------------------------------------------------------------- 1 | 2 | body 3 | foo 4 | foo(bar='baz') 5 | foo/ 6 | foo(bar='baz')/ 7 | foo / 8 | foo(bar='baz') / 9 | #{'foo'}/ 10 | #{'foo'}(bar='baz')/ 11 | #{'foo'} / 12 | #{'foo'}(bar='baz') / 13 | //- can have a single space after them 14 | img 15 | //- can have lots of white space after them 16 | img 17 | #{ 18 | 'foo' 19 | }/ 20 | -------------------------------------------------------------------------------- /packages/pug/test/cases/template.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /packages/pug/test/cases/template.pug: -------------------------------------------------------------------------------- 1 | script(type='text/x-template') 2 | article 3 | h2 {{title}} 4 | p {{description}} 5 | 6 | script(type='text/x-template'). 7 | article 8 | h2 {{title}} 9 | p {{description}} 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/text-block.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/text-block.pug: -------------------------------------------------------------------------------- 1 | 2 | label Username: 3 | input(type='text', name='user[name]') 4 | 5 | label Password: 6 | input(type='text', name='user[pass]') -------------------------------------------------------------------------------- /packages/pug/test/cases/text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    4 |

    5 |

    6 | foo 7 | bar 8 | 9 | 10 | baz 11 |

    12 |

    13 | foo 14 | 15 | 16 | bar 17 | baz 18 | 19 |

    foo 20 | 21 | 22 | bar 23 | baz 24 | 25 |
    foo
    26 |   bar
    27 |     baz
    28 | .
    29 |
    foo
    30 |   bar
    31 |     baz
    32 | .
    33 | 
    foo 34 | bar 35 | baz 36 | . 37 | -------------------------------------------------------------------------------- /packages/pug/test/cases/text.pug: -------------------------------------------------------------------------------- 1 | option(value='') -- (selected) -- 2 | 3 | p 4 | 5 | p. 6 | 7 | p 8 | | foo 9 | | bar 10 | | 11 | | 12 | | baz 13 | 14 | p. 15 | foo 16 | 17 | 18 | bar 19 | baz 20 | 21 | . 22 | 23 | . 24 | foo 25 | 26 | 27 | bar 28 | baz 29 | 30 | pre 31 | | foo 32 | | bar 33 | | baz 34 | | . 35 | 36 | pre. 37 | foo 38 | bar 39 | baz 40 | . 41 | 42 | . 43 | foo 44 | bar 45 | baz 46 | . 47 | -------------------------------------------------------------------------------- /packages/pug/test/cases/utf8bom.html: -------------------------------------------------------------------------------- 1 |

    "foo"

    2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/utf8bom.pug: -------------------------------------------------------------------------------- 1 | p "foo" 2 | -------------------------------------------------------------------------------- /packages/pug/test/cases/vars.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/pug/test/cases/vars.pug: -------------------------------------------------------------------------------- 1 | - var foo = 'bar' 2 | - var list = [1,2,3] 3 | a(class=list, id=foo) -------------------------------------------------------------------------------- /packages/pug/test/cases/while.html: -------------------------------------------------------------------------------- 1 |
      2 |
    • 2
    • 3 |
    • 3
    • 4 |
    • 4
    • 5 |
    • 5
    • 6 |
    • 6
    • 7 |
    • 7
    • 8 |
    • 8
    • 9 |
    • 9
    • 10 |
    • 10
    • 11 |
    12 | -------------------------------------------------------------------------------- /packages/pug/test/cases/while.pug: -------------------------------------------------------------------------------- 1 | - var x = 1; 2 | ul 3 | while x < 10 4 | - x++; 5 | li= x 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/xml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | http://google.com -------------------------------------------------------------------------------- /packages/pug/test/cases/xml.pug: -------------------------------------------------------------------------------- 1 | doctype xml 2 | category(term='some term')/ 3 | link http://google.com -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-before-conditional-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-before-conditional-head.pug: -------------------------------------------------------------------------------- 1 | head 2 | script(src='/jquery.js') 3 | yield 4 | if false 5 | script(src='/jquery.ui.js') 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-before-conditional.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-before-conditional.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | include yield-before-conditional-head.pug 4 | script(src='/caustic.js') 5 | script(src='/app.js') 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-head.pug: -------------------------------------------------------------------------------- 1 | head 2 | script(src='/jquery.js') 3 | yield 4 | script(src='/jquery.ui.js') 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-title-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-title-head.pug: -------------------------------------------------------------------------------- 1 | head 2 | title 3 | yield 4 | script(src='/jquery.js') 5 | script(src='/jquery.ui.js') 6 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-title.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My Title 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield-title.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | include yield-title-head.pug 4 | | My Title 5 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/cases/yield.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | include yield-head.pug 4 | script(src='/caustic.js') 5 | script(src='/app.js') 6 | -------------------------------------------------------------------------------- /packages/pug/test/dependencies/dependency1.pug: -------------------------------------------------------------------------------- 1 | strong dependency1 2 | -------------------------------------------------------------------------------- /packages/pug/test/dependencies/dependency2.pug: -------------------------------------------------------------------------------- 1 | include dependency3.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/dependencies/dependency3.pug: -------------------------------------------------------------------------------- 1 | strong dependency3 2 | -------------------------------------------------------------------------------- /packages/pug/test/dependencies/extends1.pug: -------------------------------------------------------------------------------- 1 | extends dependency1.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/dependencies/extends2.pug: -------------------------------------------------------------------------------- 1 | extends dependency2.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/dependencies/include1.pug: -------------------------------------------------------------------------------- 1 | include dependency1.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/dependencies/include2.pug: -------------------------------------------------------------------------------- 1 | include dependency2.pug 2 | -------------------------------------------------------------------------------- /packages/pug/test/duplicate-block/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`layout with duplicate block 1`] = `"
    Hello World
    "`; 4 | 5 | exports[`layout with duplicate block 2`] = `"
    Hello World
    "`; 6 | -------------------------------------------------------------------------------- /packages/pug/test/duplicate-block/index.pug: -------------------------------------------------------------------------------- 1 | extends ./layout-with-duplicate-block.pug 2 | 3 | block content 4 | div Hello World 5 | -------------------------------------------------------------------------------- /packages/pug/test/duplicate-block/index.test.js: -------------------------------------------------------------------------------- 1 | const pug = require('../../'); 2 | 3 | test('layout with duplicate block', () => { 4 | const outputWithAjax = pug.renderFile(__dirname + '/index.pug', {ajax: true}); 5 | const outputWithoutAjax = pug.renderFile(__dirname + '/index.pug', { 6 | ajax: false, 7 | }); 8 | expect(outputWithAjax).toMatchSnapshot(); 9 | expect(outputWithoutAjax).toMatchSnapshot(); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/pug/test/duplicate-block/layout-with-duplicate-block.pug: -------------------------------------------------------------------------------- 1 | if ajax 2 | block content 3 | else 4 | doctype html 5 | html 6 | head 7 | body 8 | block content 9 | -------------------------------------------------------------------------------- /packages/pug/test/eachOf/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Proper Usage Brackets 1`] = `"
  • a
  • b
  • foo
  • bar
  • "`; 4 | 5 | exports[`Proper Usage No Brackets 1`] = `"
  • a
  • b
  • foo
  • bar
  • "`; 6 | -------------------------------------------------------------------------------- /packages/pug/test/eachOf/error/left-side.pug: -------------------------------------------------------------------------------- 1 | each [key, val of users 2 | li= key 3 | li= val 4 | -------------------------------------------------------------------------------- /packages/pug/test/eachOf/error/no-brackets.pug: -------------------------------------------------------------------------------- 1 | each key, val of users 2 | li= key 3 | li= val 4 | -------------------------------------------------------------------------------- /packages/pug/test/eachOf/error/one-val.pug: -------------------------------------------------------------------------------- 1 | each [key] of users 2 | li= key 3 | li= val 4 | -------------------------------------------------------------------------------- /packages/pug/test/eachOf/error/right-side.pug: -------------------------------------------------------------------------------- 1 | each key, val] of users 2 | li= key 3 | li= val 4 | -------------------------------------------------------------------------------- /packages/pug/test/eachOf/passing/brackets.pug: -------------------------------------------------------------------------------- 1 | each [key, val] of users 2 | li= key 3 | li= val 4 | -------------------------------------------------------------------------------- /packages/pug/test/eachOf/passing/no-brackets.pug: -------------------------------------------------------------------------------- 1 | each data of users 2 | li= data[0] 3 | li= data[1] 4 | -------------------------------------------------------------------------------- /packages/pug/test/extends-not-top-level/default.pug: -------------------------------------------------------------------------------- 1 | body 2 | block content 3 | -------------------------------------------------------------------------------- /packages/pug/test/extends-not-top-level/duplicate.pug: -------------------------------------------------------------------------------- 1 | extends default 2 | extends default 3 | -------------------------------------------------------------------------------- /packages/pug/test/extends-not-top-level/index.pug: -------------------------------------------------------------------------------- 1 | mixin content 2 | if bar 3 | extends default 4 | block content 5 | block 6 | else 7 | block 8 | 9 | +content 10 | h1 Hello! 11 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/append-without-block/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout.pug 3 | 4 | append head 5 | script(src='app.js') 6 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/append-without-block/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug/test/fixtures/append-without-block/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout.pug 3 | 4 | append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/append/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout 3 | 4 | block append head 5 | script(src='app.js') -------------------------------------------------------------------------------- /packages/pug/test/fixtures/append/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug/test/fixtures/append/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/append/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout 3 | 4 | block append head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/compile.with.include.locals.error.pug: -------------------------------------------------------------------------------- 1 | include include.locals.error.pug -------------------------------------------------------------------------------- /packages/pug/test/fixtures/compile.with.include.syntax.error.pug: -------------------------------------------------------------------------------- 1 | include include.syntax.error.pug -------------------------------------------------------------------------------- /packages/pug/test/fixtures/compile.with.layout.locals.error.pug: -------------------------------------------------------------------------------- 1 | extends layout.locals.error.pug -------------------------------------------------------------------------------- /packages/pug/test/fixtures/compile.with.layout.syntax.error.pug: -------------------------------------------------------------------------------- 1 | extends layout.syntax.error.pug -------------------------------------------------------------------------------- /packages/pug/test/fixtures/compile.with.layout.with.include.locals.error.pug: -------------------------------------------------------------------------------- 1 | extends compile.with.include.locals.error.pug -------------------------------------------------------------------------------- /packages/pug/test/fixtures/compile.with.layout.with.include.syntax.error.pug: -------------------------------------------------------------------------------- 1 | extends compile.with.include.syntax.error.pug -------------------------------------------------------------------------------- /packages/pug/test/fixtures/element-with-multiple-attributes.pug: -------------------------------------------------------------------------------- 1 | div(attr='val')(foo='bar') -------------------------------------------------------------------------------- /packages/pug/test/fixtures/include.locals.error.pug: -------------------------------------------------------------------------------- 1 | 2 | = foo() -------------------------------------------------------------------------------- /packages/pug/test/fixtures/include.syntax.error.pug: -------------------------------------------------------------------------------- 1 | 2 | = foo( -------------------------------------------------------------------------------- /packages/pug/test/fixtures/invalid-block-in-extends.pug: -------------------------------------------------------------------------------- 1 | extends ./layout.pug 2 | 3 | block title 4 | title My Article 5 | 6 | block contents 7 | // oops, that's not a block -------------------------------------------------------------------------------- /packages/pug/test/fixtures/issue-1593/include-layout.pug: -------------------------------------------------------------------------------- 1 | .included-layout 2 | block include-body 3 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/issue-1593/include.pug: -------------------------------------------------------------------------------- 1 | extends ./include-layout.pug 2 | 3 | block include-body 4 | .include-body 5 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/issue-1593/index.pug: -------------------------------------------------------------------------------- 1 | extends ./layout.pug 2 | 3 | block body-a 4 | .body-a 5 | block body-b 6 | .body-b 7 | include ./include.pug 8 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/issue-1593/layout.pug: -------------------------------------------------------------------------------- 1 | .layout-body 2 | block body-a 3 | block body-b 4 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/layout.locals.error.pug: -------------------------------------------------------------------------------- 1 | 2 | = foo() -------------------------------------------------------------------------------- /packages/pug/test/fixtures/layout.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | block title 5 | body 6 | block body -------------------------------------------------------------------------------- /packages/pug/test/fixtures/layout.syntax.error.pug: -------------------------------------------------------------------------------- 1 | 2 | = foo( -------------------------------------------------------------------------------- /packages/pug/test/fixtures/layout.with.runtime.error.pug: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | = foo.length 4 | block content 5 | 6 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/mixin-include.pug: -------------------------------------------------------------------------------- 1 | mixin bang 2 | +foo 3 | 4 | mixin foo 5 | p bar -------------------------------------------------------------------------------- /packages/pug/test/fixtures/mixin.error.pug: -------------------------------------------------------------------------------- 1 | mixin mixin-with-error(foo) 2 | - foo.length 3 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/multi-append-prepend-block/redefine.pug: -------------------------------------------------------------------------------- 1 | extends root.pug 2 | 3 | block content 4 | .content 5 | | Defined content 6 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/multi-append-prepend-block/root.pug: -------------------------------------------------------------------------------- 1 | block content 2 | | default content 3 | 4 | block head 5 | script(src='/app.js') -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend-without-block/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout.pug 3 | 4 | prepend head 5 | script(src='app.js') 6 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend-without-block/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend-without-block/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend-without-block/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout.pug 3 | 4 | prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend/app-layout.pug: -------------------------------------------------------------------------------- 1 | 2 | extends layout.pug 3 | 4 | block prepend head 5 | script(src='app.js') 6 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend/layout.pug: -------------------------------------------------------------------------------- 1 | 2 | html 3 | block head 4 | script(src='vendor/jquery.js') 5 | script(src='vendor/caustic.js') 6 | body 7 | block body -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/prepend/page.pug: -------------------------------------------------------------------------------- 1 | 2 | extends app-layout.pug 3 | 4 | block prepend head 5 | script(src='foo.js') 6 | script(src='bar.js') 7 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/runtime.error.pug: -------------------------------------------------------------------------------- 1 | -foo() -------------------------------------------------------------------------------- /packages/pug/test/fixtures/runtime.layout.error.pug: -------------------------------------------------------------------------------- 1 | extends layout.with.runtime.error.pug 2 | block content 3 | | some content 4 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/runtime.with.mixin.error.pug: -------------------------------------------------------------------------------- 1 | include mixin.error.pug 2 | 3 | +mixin-with-error(null) 4 | -------------------------------------------------------------------------------- /packages/pug/test/fixtures/scripts.pug: -------------------------------------------------------------------------------- 1 | script(src='/jquery.js') 2 | script(src='/caustic.js') -------------------------------------------------------------------------------- /packages/pug/test/markdown-it/comment.md: -------------------------------------------------------------------------------- 1 |

    Hello World!

    -------------------------------------------------------------------------------- /packages/pug/test/markdown-it/index.test.js: -------------------------------------------------------------------------------- 1 | const pug = require('../../'); 2 | 3 | test('inline and include markdow-it should match ', () => { 4 | const outputMarkdownInline = pug.renderFile( 5 | __dirname + '/layout-markdown-inline.pug' 6 | ); 7 | 8 | const outputMarkdownIncludes = pug.renderFile( 9 | __dirname + '/layout-markdown-include.pug' 10 | ); 11 | 12 | expect(outputMarkdownIncludes).toEqual(outputMarkdownInline); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/pug/test/markdown-it/layout-markdown-include.pug: -------------------------------------------------------------------------------- 1 | include:markdown-it(html=true) comment.md -------------------------------------------------------------------------------- /packages/pug/test/markdown-it/layout-markdown-inline.pug: -------------------------------------------------------------------------------- 1 | :markdown-it(html=true) 2 |

    Hello World!

    -------------------------------------------------------------------------------- /packages/pug/test/output-es2015/attr.html: -------------------------------------------------------------------------------- 1 | 2 |
    -------------------------------------------------------------------------------- /packages/pug/test/plugins.test.js: -------------------------------------------------------------------------------- 1 | const pug = require('../'); 2 | 3 | test('#3295 - lexer plugins should be used in tag interpolation', () => { 4 | const lex = { 5 | advance(lexer) { 6 | if ('~' === lexer.input.charAt(0)) { 7 | lexer.tokens.push(lexer.tok('text', 'twiddle-dee-dee')); 8 | lexer.consume(1); 9 | lexer.incrementColumn(1); 10 | return true; 11 | } 12 | }, 13 | }; 14 | const input = 'p Look at #[~]'; 15 | const expected = '

    Look at twiddle-dee-dee

    '; 16 | const output = pug.render(input, {plugins: [{lex}]}); 17 | expect(output).toEqual(expected); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`#2436 - block with a same name extends from different layout in nesting 1`] = ` 4 | " 5 |

    layout

    6 |

    Main A

    7 |

    other layout

    8 |

    Other A

    " 9 | `; 10 | 11 | exports[`#2436 - block with a same name extends from the same layout in nesting 1`] = ` 12 | " 13 |

    layout

    14 |

    Main A

    15 |

    layout

    16 |

    Other A

    " 17 | `; 18 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/index.test.js: -------------------------------------------------------------------------------- 1 | const pug = require('../../'); 2 | 3 | test('#2436 - block with a same name extends from the same layout in nesting', () => { 4 | const output = pug.renderFile(__dirname + '/issue1.pug', {pretty: true}); 5 | expect(output).toMatchSnapshot(); 6 | }); 7 | 8 | test('#2436 - block with a same name extends from different layout in nesting', () => { 9 | const output = pug.renderFile(__dirname + '/issue2.pug', {pretty: true}); 10 | expect(output).toMatchSnapshot(); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/issue1.pug: -------------------------------------------------------------------------------- 1 | extends layout.pug 2 | 3 | block a 4 | p Main A 5 | 6 | block b 7 | include other1.pug 8 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/issue2.pug: -------------------------------------------------------------------------------- 1 | extends layout.pug 2 | 3 | block a 4 | p Main A 5 | 6 | block b 7 | include other2.pug 8 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/layout.pug: -------------------------------------------------------------------------------- 1 | h1 layout 2 | 3 | block a 4 | p block in layout 5 | 6 | block b 7 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/other1.pug: -------------------------------------------------------------------------------- 1 | extends layout.pug 2 | 3 | block a 4 | p Other A 5 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/other2.pug: -------------------------------------------------------------------------------- 1 | extends other_layout.pug 2 | 3 | block a 4 | p Other A 5 | -------------------------------------------------------------------------------- /packages/pug/test/regression-2436/other_layout.pug: -------------------------------------------------------------------------------- 1 | h1 other layout 2 | 3 | block a 4 | p block in other layout 5 | -------------------------------------------------------------------------------- /packages/pug/test/run.test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // even and odd tests are arbitrarily split because jest is faster that way 4 | 5 | const fs = require('fs'); 6 | const assert = require('assert'); 7 | const mkdirp = require('mkdirp').sync; 8 | const runUtils = require('./run-utils'); 9 | const pug = require('../'); 10 | 11 | var cases = runUtils.findCases(__dirname + '/cases'); 12 | var es2015 = runUtils.findCases(__dirname + '/cases-es2015'); 13 | 14 | mkdirp(__dirname + '/output'); 15 | 16 | describe('test cases', function() { 17 | cases.forEach((test, i) => { 18 | runUtils.testSingle(it, '', test); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/pug/test/shadowed-block/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`layout with shadowed block 1`] = `""`; 4 | 5 | exports[`layout with shadowed block 2`] = `""`; 6 | -------------------------------------------------------------------------------- /packages/pug/test/shadowed-block/base.pug: -------------------------------------------------------------------------------- 1 | block root 2 | // base.pug: root 3 | block shadowed 4 | // base.pug: shadowed 5 | -------------------------------------------------------------------------------- /packages/pug/test/shadowed-block/index.pug: -------------------------------------------------------------------------------- 1 | extends ./layout.pug 2 | 3 | block shadowed 4 | // index.pug: shadowed 5 | -------------------------------------------------------------------------------- /packages/pug/test/shadowed-block/index.test.js: -------------------------------------------------------------------------------- 1 | const pug = require('../../'); 2 | 3 | test('layout with shadowed block', () => { 4 | const outputWithAjax = pug.renderFile(__dirname + '/index.pug', {ajax: true}); 5 | const outputWithoutAjax = pug.renderFile(__dirname + '/index.pug', { 6 | ajax: false, 7 | }); 8 | expect(outputWithAjax).toMatchSnapshot(); 9 | expect(outputWithoutAjax).toMatchSnapshot(); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/pug/test/shadowed-block/layout.pug: -------------------------------------------------------------------------------- 1 | extends ./base.pug 2 | 3 | block root 4 | // layout.pug: root 5 | block shadowed 6 | // layout.pug: shadowed 7 | -------------------------------------------------------------------------------- /packages/pug/test/temp/input-compileFile.pug: -------------------------------------------------------------------------------- 1 | .big fat hen -------------------------------------------------------------------------------- /packages/pug/test/temp/input-compileFileClient.pug: -------------------------------------------------------------------------------- 1 | .big fat hen -------------------------------------------------------------------------------- /packages/pug/test/temp/input-renderFile.pug: -------------------------------------------------------------------------------- 1 | .big fat hen -------------------------------------------------------------------------------- /scripts/buffer-serializer.js: -------------------------------------------------------------------------------- 1 | const crypto = require('crypto'); 2 | 3 | // Buffer serializer to reduce snapshot gore for Node Buffer type 4 | module.exports = { 5 | test: function(val) { 6 | return val && Buffer.isBuffer(val); 7 | }, 8 | print: function(val, serialize, indent) { 9 | const output = { 10 | type: 'Buffer', 11 | size: val.length, 12 | hash: crypto 13 | .createHash('md5') 14 | .update(val) 15 | .digest('hex'), 16 | }; 17 | return serialize(output); 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /scripts/prettier-javascript-serializer.js: -------------------------------------------------------------------------------- 1 | const prettier = require('prettier'); 2 | 3 | const prettierOptions = {parser: 'babel'}; 4 | 5 | // filename serializer that removes the basedir 6 | module.exports = { 7 | test: function(val) { 8 | try { 9 | return ( 10 | typeof val === 'string' && 11 | /function /.test(val) && 12 | val !== prettier.format(val, prettierOptions) 13 | ); 14 | } catch (ex) { 15 | return false; 16 | } 17 | }, 18 | print: function(val, serialize, indent) { 19 | return serialize(prettier.format(val, prettierOptions)); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "sourceMap": true, 7 | "strict": true, 8 | "noUnusedLocals": true, 9 | "noUnusedParameters": false, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "lib": ["es2016", "dom"], 13 | "pretty": true 14 | } 15 | } --------------------------------------------------------------------------------