Full Code of janl/mustache.js for AI

master 972fd2b27a03 cached
247 files
146.9 KB
48.1k tokens
36 symbols
1 requests
Download .txt
Repository: janl/mustache.js
Branch: master
Commit: 972fd2b27a03
Files: 247
Total size: 146.9 KB

Directory structure:
gitextract_6pju20il/

├── .eslintrc
├── .esmrc
├── .github/
│   └── workflows/
│       ├── usage.yml
│       └── verify.yml
├── .gitignore
├── .gitmodules
├── .travis.yml
├── .zuul.yml
├── CHANGELOG.md
├── LICENSE
├── MIGRATING.md
├── README.md
├── Rakefile
├── bin/
│   └── mustache
├── mustache.js
├── package.json
├── scripts/
│   └── bump-version-in-source
├── spec/
│   └── _files/
│       ├── bom_as_whitespace.js
│       ├── bom_as_whitespace.mustache
│       └── bom_as_whitespace.txt
├── test/
│   ├── .eslintrc
│   ├── _files/
│   │   ├── ampersand_escape.js
│   │   ├── ampersand_escape.mustache
│   │   ├── ampersand_escape.txt
│   │   ├── apostrophe.js
│   │   ├── apostrophe.mustache
│   │   ├── apostrophe.txt
│   │   ├── array_of_strings.js
│   │   ├── array_of_strings.mustache
│   │   ├── array_of_strings.txt
│   │   ├── avoids_obj_prototype_in_view_cache.js
│   │   ├── avoids_obj_prototype_in_view_cache.mustache
│   │   ├── avoids_obj_prototype_in_view_cache.txt
│   │   ├── backslashes.js
│   │   ├── backslashes.mustache
│   │   ├── backslashes.txt
│   │   ├── bug_11_eating_whitespace.js
│   │   ├── bug_11_eating_whitespace.mustache
│   │   ├── bug_11_eating_whitespace.txt
│   │   ├── bug_length_property.js
│   │   ├── bug_length_property.mustache
│   │   ├── bug_length_property.txt
│   │   ├── changing_delimiters.js
│   │   ├── changing_delimiters.mustache
│   │   ├── changing_delimiters.txt
│   │   ├── check_falsy.js
│   │   ├── check_falsy.mustache
│   │   ├── check_falsy.txt
│   │   ├── cli.cjs
│   │   ├── cli.js
│   │   ├── cli.json
│   │   ├── cli.mustache
│   │   ├── cli.txt
│   │   ├── cli_js_view_with_function.js
│   │   ├── cli_js_view_with_function.mustache
│   │   ├── cli_js_view_with_function.txt
│   │   ├── cli_with_partials.json
│   │   ├── cli_with_partials.mustache
│   │   ├── cli_with_partials.txt
│   │   ├── comments.js
│   │   ├── comments.mustache
│   │   ├── comments.txt
│   │   ├── complex.js
│   │   ├── complex.mustache
│   │   ├── complex.txt
│   │   ├── context_lookup.js
│   │   ├── context_lookup.mustache
│   │   ├── context_lookup.txt
│   │   ├── delimiters.js
│   │   ├── delimiters.mustache
│   │   ├── delimiters.txt
│   │   ├── disappearing_whitespace.js
│   │   ├── disappearing_whitespace.mustache
│   │   ├── disappearing_whitespace.txt
│   │   ├── dot_notation.js
│   │   ├── dot_notation.mustache
│   │   ├── dot_notation.txt
│   │   ├── double_render.js
│   │   ├── double_render.mustache
│   │   ├── double_render.txt
│   │   ├── empty_list.js
│   │   ├── empty_list.mustache
│   │   ├── empty_list.txt
│   │   ├── empty_sections.js
│   │   ├── empty_sections.mustache
│   │   ├── empty_sections.txt
│   │   ├── empty_string.js
│   │   ├── empty_string.mustache
│   │   ├── empty_string.txt
│   │   ├── empty_template.js
│   │   ├── empty_template.mustache
│   │   ├── empty_template.txt
│   │   ├── error_not_found.js
│   │   ├── error_not_found.mustache
│   │   ├── error_not_found.txt
│   │   ├── escaped.js
│   │   ├── escaped.mustache
│   │   ├── escaped.txt
│   │   ├── falsy.js
│   │   ├── falsy.mustache
│   │   ├── falsy.txt
│   │   ├── falsy_array.js
│   │   ├── falsy_array.mustache
│   │   ├── falsy_array.txt
│   │   ├── grandparent_context.js
│   │   ├── grandparent_context.mustache
│   │   ├── grandparent_context.txt
│   │   ├── higher_order_sections.js
│   │   ├── higher_order_sections.mustache
│   │   ├── higher_order_sections.txt
│   │   ├── implicit_iterator.js
│   │   ├── implicit_iterator.mustache
│   │   ├── implicit_iterator.txt
│   │   ├── included_tag.js
│   │   ├── included_tag.mustache
│   │   ├── included_tag.txt
│   │   ├── inverted_section.js
│   │   ├── inverted_section.mustache
│   │   ├── inverted_section.txt
│   │   ├── keys_with_questionmarks.js
│   │   ├── keys_with_questionmarks.mustache
│   │   ├── keys_with_questionmarks.txt
│   │   ├── malicious_template.js
│   │   ├── malicious_template.mustache
│   │   ├── malicious_template.txt
│   │   ├── multiline_comment.js
│   │   ├── multiline_comment.mustache
│   │   ├── multiline_comment.txt
│   │   ├── nested_dot.js
│   │   ├── nested_dot.mustache
│   │   ├── nested_dot.txt
│   │   ├── nested_higher_order_sections.js
│   │   ├── nested_higher_order_sections.mustache
│   │   ├── nested_higher_order_sections.txt
│   │   ├── nested_iterating.js
│   │   ├── nested_iterating.mustache
│   │   ├── nested_iterating.txt
│   │   ├── nesting.js
│   │   ├── nesting.mustache
│   │   ├── nesting.txt
│   │   ├── nesting_same_name.js
│   │   ├── nesting_same_name.mustache
│   │   ├── nesting_same_name.txt
│   │   ├── null_lookup_array.js
│   │   ├── null_lookup_array.mustache
│   │   ├── null_lookup_array.txt
│   │   ├── null_lookup_object.js
│   │   ├── null_lookup_object.mustache
│   │   ├── null_lookup_object.txt
│   │   ├── null_string.js
│   │   ├── null_string.mustache
│   │   ├── null_string.txt
│   │   ├── null_view.js
│   │   ├── null_view.mustache
│   │   ├── null_view.txt
│   │   ├── partial_array.js
│   │   ├── partial_array.mustache
│   │   ├── partial_array.partial
│   │   ├── partial_array.txt
│   │   ├── partial_array_of_partials.js
│   │   ├── partial_array_of_partials.mustache
│   │   ├── partial_array_of_partials.partial
│   │   ├── partial_array_of_partials.txt
│   │   ├── partial_array_of_partials_implicit.js
│   │   ├── partial_array_of_partials_implicit.mustache
│   │   ├── partial_array_of_partials_implicit.partial
│   │   ├── partial_array_of_partials_implicit.txt
│   │   ├── partial_empty.js
│   │   ├── partial_empty.mustache
│   │   ├── partial_empty.partial
│   │   ├── partial_empty.txt
│   │   ├── partial_template.js
│   │   ├── partial_template.mustache
│   │   ├── partial_template.partial
│   │   ├── partial_template.txt
│   │   ├── partial_view.js
│   │   ├── partial_view.mustache
│   │   ├── partial_view.partial
│   │   ├── partial_view.txt
│   │   ├── partial_whitespace.js
│   │   ├── partial_whitespace.mustache
│   │   ├── partial_whitespace.partial
│   │   ├── partial_whitespace.txt
│   │   ├── recursion_with_same_names.js
│   │   ├── recursion_with_same_names.mustache
│   │   ├── recursion_with_same_names.txt
│   │   ├── reuse_of_enumerables.js
│   │   ├── reuse_of_enumerables.mustache
│   │   ├── reuse_of_enumerables.txt
│   │   ├── section_as_context.js
│   │   ├── section_as_context.mustache
│   │   ├── section_as_context.txt
│   │   ├── section_functions_in_partials.js
│   │   ├── section_functions_in_partials.mustache
│   │   ├── section_functions_in_partials.partial
│   │   ├── section_functions_in_partials.txt
│   │   ├── simple.js
│   │   ├── simple.mustache
│   │   ├── simple.txt
│   │   ├── string_as_context.js
│   │   ├── string_as_context.mustache
│   │   ├── string_as_context.txt
│   │   ├── two_in_a_row.js
│   │   ├── two_in_a_row.mustache
│   │   ├── two_in_a_row.txt
│   │   ├── two_sections.js
│   │   ├── two_sections.mustache
│   │   ├── two_sections.txt
│   │   ├── unescaped.js
│   │   ├── unescaped.mustache
│   │   ├── unescaped.txt
│   │   ├── uses_props_from_view_prototype.js
│   │   ├── uses_props_from_view_prototype.mustache
│   │   ├── uses_props_from_view_prototype.txt
│   │   ├── whitespace.js
│   │   ├── whitespace.mustache
│   │   ├── whitespace.txt
│   │   ├── zero_view.js
│   │   ├── zero_view.mustache
│   │   └── zero_view.txt
│   ├── cli-test.js
│   ├── context-test.js
│   ├── create-browser-suite.js
│   ├── helper.js
│   ├── module-systems/
│   │   ├── .eslintrc
│   │   ├── _fixtures/
│   │   │   ├── amd.html
│   │   │   └── global-scope.html
│   │   ├── browser-test.js
│   │   ├── commonjs-test.js
│   │   ├── deno-test.ts
│   │   ├── esm-test-exports.mjs
│   │   └── esm-test.mjs
│   ├── mustache-spec-test.js
│   ├── parse-test.js
│   ├── partial-test.js
│   ├── render-helper.js
│   ├── render-test-browser-tmpl.mustache
│   ├── render-test.js
│   └── scanner-test.js
└── wrappers/
    ├── dojo/
    │   ├── mustache.js.post
    │   └── mustache.js.pre
    ├── jquery/
    │   ├── mustache.js.post
    │   └── mustache.js.pre
    ├── mootools/
    │   ├── mustache.js.post
    │   └── mustache.js.pre
    └── qooxdoo/
        ├── mustache.js.post
        └── mustache.js.pre

================================================
FILE CONTENTS
================================================

================================================
FILE: .eslintrc
================================================
{
  "env": {
    "browser": true,
    "node": true
  },
  "rules": {
    "func-names": 2,
    "no-mixed-spaces-and-tabs": 2,
    "quotes": [2, "single", "avoid-escape"],
    "semi": 2,
    "keyword-spacing": 2,
    "space-before-function-paren": 2,

    "curly": 0,
    "consistent-return": 0,
    "no-use-before-define": 0,
    "no-process-exit": 0,
    "strict": 0
  },
  "overrides": [
    {
      "files": ["mustache.js"],
      "parserOptions": {
        "sourceType": "module",
        "ecmaVersion": 2015
      }
    }
  ]
}

================================================
FILE: .esmrc
================================================
{
  cjs: {
    // Ensure ESM `export default` ends up as the root, e.g. `module.exports` when
    // being `require()`d from CJS code. This is not spec compliant, but that does
    // not matter because only use this `esm` package trickery locally while testing
    dedefault: true
  }
}


================================================
FILE: .github/workflows/usage.yml
================================================
name: Package usage

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - name: npm install and build
        run: |
          npm install
          npm run build
      - name: Store build-output for later
        uses: actions/upload-artifact@v2
        with:
          name: build-output
          path: |
            mustache.js
            mustache.mjs

  package:
    runs-on: ubuntu-latest

    needs: build
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - name: Get build-output from build step
        uses: actions/download-artifact@v2
        with:
          name: build-output
      - name: Create package tarball
        run: |
          export ARCHIVE_FILENAME=$(npm pack | tail -n 1)
          mv $ARCHIVE_FILENAME mustache.tgz
      - name: Store package tarball for later
        uses: actions/upload-artifact@v2
        with:
          name: package-output
          path: mustache.tgz

  common-js-usage:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x, 15.x]

    needs: package
    steps:
      - uses: actions/checkout@v1
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Get package tarball from package step
        uses: actions/download-artifact@v2
        with:
          name: package-output
      - name: Package, install and test
        run: |
          export UNPACK_DESTINATION=$(mktemp -d)
          mv mustache.tgz $UNPACK_DESTINATION
          cp test/module-systems/commonjs-test.js $UNPACK_DESTINATION
          cd $UNPACK_DESTINATION
          npm install mustache.tgz
          node commonjs-test.js

  esm-usage:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x, 15.x]

    needs: package
    steps:
      - uses: actions/checkout@v1
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Get package tarball from package step
        uses: actions/download-artifact@v2
        with:
          name: package-output
      - name: Package, install and test
        run: |
          export UNPACK_DESTINATION=$(mktemp -d)
          mv mustache.tgz $UNPACK_DESTINATION
          cp test/module-systems/esm-test.mjs $UNPACK_DESTINATION
          cp test/module-systems/esm-test-exports.mjs $UNPACK_DESTINATION
          cd $UNPACK_DESTINATION
          npm install mustache.tgz
          node esm-test.mjs
          node esm-test-exports.mjs

  browser-usage:
    runs-on: ubuntu-latest

    needs: build
    steps:
      - uses: actions/checkout@v1
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 12.x
      - name: Get build-output from build step
        uses: actions/download-artifact@v2
        with:
          name: build-output
      - name: Install and test
        run: |
          npm ci
          npx mocha test/module-systems/browser-test.js

  deno-usage:
    runs-on: ubuntu-latest

    needs: build
    steps:
      - uses: actions/checkout@v1
      - uses: denolib/setup-deno@master
        with:
          deno-version: 'v1.0.0'
      - name: Get build-output from build step
        uses: actions/download-artifact@v2
        with:
          name: build-output
      - run: deno --version
      - run: deno test --allow-net=deno.land test/module-systems/deno-test.ts


================================================
FILE: .github/workflows/verify.yml
================================================
name: Verify changes

on: [push, pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - run: npm install
      - run: npm run test-lint

  tests:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x, 15.x]

    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install and test
        run: |
          npm install
          npm run test-unit

  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - name: npm install and build
        run: |
          npm install
          npm run build
      - name: Store build-output for later
        uses: actions/upload-artifact@v2
        with:
          name: build-output
          path: |
            mustache.js
            mustache.mjs

  tests-on-legacy:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [0.10.x, 0.12.x, 4.x, 6.x, 8.x]

    needs: build
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Get build-output from build step
        uses: actions/download-artifact@v2
        with:
          name: build-output
      - name: npm install and test
        run: |
          npm install mocha@3 chai@3
          npm run test-unit


================================================
FILE: .gitignore
================================================
node_modules
jquery.mustache.js
mootools.mustache.js
dojox
yui3
qooxdoo.mustache.js
test/render-test-browser.js
npm-debug.log
.DS_Store
test/render-test-browser.js
.idea/
mustache.mjs
mustache.min.js


================================================
FILE: .gitmodules
================================================
[submodule "test/spec"]
	path = test/spec
	url = https://github.com/mustache/spec


================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
  - 8
script:
  - npm run build
  - "test $TRAVIS_PULL_REQUEST != 'false' || test $TRAVIS_NODE_VERSION != '8' || npm run test-browser"
env:
  global:
  - secure: L0dg0jr2fwkc2tPwP5svybILPBn2qdLzMrWc5tEXg3MPcy8D59Gvf+ri7INqo+ETPM20o5CsaDCH+LHUNS/V0G4VG1ajvsy7d8uh3hnb/K6VfVui/CjsHIqOcOZrbxVxgyX+iMXEXAj0+Syow9uDQHVhrz1qqad1n79likNCXa4=
  - secure: J4vbGKivULEHWRWExAWDLkFk9EDU7E6Ny+iRc/oKxXHnBYn9oL2Hfc1J92fOttaFtUzpz7r5FaNa3DGlyAI0wimq5GY8KJQGcquoskerXucd8iJbLCs3nxDeShl4UwHpDIXF8xbH/rUIkrGSKnktf0McMRIyeN95hzug0nxOwAw=


================================================
FILE: .zuul.yml
================================================
ui: mocha-bdd
browsers:
  - name: chrome
    version: latest
  - name: firefox
    version: latest
  - name: ie
    version: 11..latest
concurrency: 1
tunnel:
  type: ngrok
  bind_tls: false


================================================
FILE: CHANGELOG.md
================================================
# Change Log

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.2.0] / 28 March 2021

### Added

* [#773]: Add package.json `exports` field, by [@manzt].

## [4.1.0] / 6 December 2020

### Added

* [#764]: `render()` now recognizes a config object argument, by [@pineapplemachine].

### Fixed

* [#764]: Ask custom `escape` functions to escape all types of values (including `number`s), by [@pineapplemachine].

## [4.0.1] / 15 March 2020

### Fixed

 * [#739]: Fix custom delimiters in nested partials, by [@aielo].

## [4.0.0] / 16 January 2020

Majority of using projects don't have to worry by this being a new major version.

**TLDR;** if your project manipulates `Writer.prototype.parse | Writer.cache` directly or uses `.to_html()`, you probably have to change that code.

This release allows the internal template cache to be customised, either by disabling it completely
or provide a custom strategy deciding how the cache should behave when mustache.js parses templates.

```js
const mustache = require('mustache');

// disable caching
Mustache.templateCache = undefined;

// or use a built-in Map in modern environments
Mustache.templateCache = new Map();
```

Projects that wanted to customise the caching behaviour in earlier versions of mustache.js were forced to
override internal method responsible for parsing templates; `Writer.prototype.parse`. In short, that was unfortunate
because there is more than caching happening in that method.

We've improved that now by introducing a first class API that only affects template caching.

The default template cache behaves as before and is still compatible with older JavaScript environments.
For those who wants to provide a custom more sopisiticated caching strategy, one can do that with an object that adheres to the following requirements:

```ts
{
  set(cacheKey: string, value: string): void
  get(cacheKey: string): string | undefined
  clear(): void
}
```

### Added

* [#731]: Allow template caching to be customised, by [@AndrewLeedham].

### Removed

* [#735]: Remove `.to_html()`, by [@phillipj].

## [3.2.1] / 30 December 2019

### Fixed

 * [#733]: Allow the CLI to use JavaScript views when the project has ES6 modules enabled, by [@eobrain].

## [3.2.0] / 18 December 2019

### Added

* [#728]: Expose ECMAScript Module in addition to UMD (CommonJS, AMD & global scope), by [@phillipj] and [@zekth].

### Using mustache.js as an ES module

To stay backwards compatible with already using projects, the default exposed module format is still UMD.
That means projects using mustache.js as an CommonJS, AMD or global scope module, from npm or directly from github.com
can keep on doing that for now.

For those projects who would rather want to use mustache.js as an ES module, the `mustache/mustache.mjs` file has to
be `import`ed directly.

Below are some usage scenarios for different runtimes.

#### Modern browser with ES module support

```html
<!-- index.html -->
<script type="module">
  import mustache from "https://unpkg.com/mustache@3.2.0/mustache.mjs"

  console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
  // Hello Santa!
</script>
```

#### [Node.js](https://nodejs.org) (>= v13.2.0 or using --experimental-modules flag)

```js
// index.mjs
import mustache from 'mustache/mustache.mjs'

console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
// Hello Santa!
```

ES Module support for Node.js will be improved in the future when [Conditional Exports](https://nodejs.org/api/esm.html#esm_conditional_exports)
is enabled by default rather than being behind an experimental flag.

More info in [Node.js ECMAScript Modules docs](https://nodejs.org/api/esm.html).

#### [Deno](https://deno.land/)

```js
// index.ts
import mustache from 'https://unpkg.com/mustache@3.2.0/mustache.mjs'

console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
// Hello Santa!
```

## [3.1.0] / 13 September 2019

### Added

 * [#717]: Added support .js files as views in command line tool, by [@JEStaubach].

### Fixed

 * [#716]: Bugfix for indentation of inline partials, by [@yotammadem].

## [3.0.3] / 27 August 2019

### Added

 * [#713]: Add test cases for custom functions in partials, by [@wol-soft].

### Fixed

 * [#714]: Bugfix for wrong function output in partials with indentation, by [@phillipj].

## [3.0.2] / 21 August 2019

### Fixed

 * [#705]: Fix indentation of partials, by [@kevindew] and [@yotammadem].

### Dev

 * [#701]: Fix test failure for Node 10 and above, by [@andersk].
 * [#704]: Lint all test files just like the source files, by [@phillipj].
 * Start experimenting & comparing GitHub Actions vs Travis CI, by [@phillipj].

## [3.0.1] / 11 November 2018

 * [#679]: Fix partials not rendering tokens when using custom tags, by [@stackchain].

## [3.0.0] / 16 September 2018

We are very happy to announce a new major version of mustache.js. We want to be very careful not to break projects
out in the wild, and adhering to [Semantic Versioning](http://semver.org/) we have therefore cut this new major version.

The changes introduced will likely not require any actions for most using projects. The things to look out for that
might cause unexpected rendering results are described in the migration guide below.

A big shout out and thanks to [@raymond-lam] for this release! Without his contributions with code and issue triaging,
this release would never have happened.

### Major

* [#618]: Allow rendering properties of primitive types that are not objects, by [@raymond-lam].
* [#643]: `Writer.prototype.parse` to cache by tags in addition to template string, by [@raymond-lam].
* [#664]: Fix `Writer.prototype.parse` cache, by [@seminaoki].

### Minor

* [#673]: Add `tags` parameter to `Mustache.render()`, by [@raymond-lam].

### Migrating from mustache.js v2.x to v3.x

#### Rendering properties of primitive types

We have ensured properties of primitive types can be rendered at all times. That means `Array.length`, `String.length`
and similar. A corner case where this could cause unexpected output follows:

View:
```
{
  stooges: [
    { name: "Moe" },
    { name: "Larry" },
    { name: "Curly" }
  ]
}
```

Template:
```
{{#stooges}}
  {{name}}: {{name.length}} characters
{{/stooges}}
```

Output with v3.0:
```
  Moe: 3 characters
  Larry: 5 characters
  Curly: 5 characters
```

Output with v2.x:
```
  Moe:  characters
  Larry:  characters
  Curly:  characters
```

#### Caching for templates with custom delimiters

We have improved the templates cache to ensure custom delimiters are taken into consideration for the cache.
This improvement might cause unexpected rendering behaviour for using projects actively using the custom delimiters functionality.

Previously it was possible to use `Mustache.parse()` as a means to set global custom delimiters. If custom
delimiters were provided as an argument, it would affect all following calls to `Mustache.render()`.
Consider the following:

```js
const template = "[[item.title]] [[item.value]]";
mustache.parse(template, ["[[", "]]"]);

console.log(
  mustache.render(template, {
    item: {
      title: "TEST",
      value: 1
    }
  })
);

>> TEST 1
```

The above illustrates the fact that `Mustache.parse()` made mustache.js cache the template without considering
the custom delimiters provided. This is no longer true.

We no longer encourage using `Mustache.parse()` for this purpose, but have rather added a fourth argument to
`Mustache.render()` letting you provide custom delimiters when rendering.

If you still need the pre-parse the template and use custom delimiters at the same time, ensure to provide
the custom delimiters as argument to `Mustache.render()` as well.

## [2.3.2] / 17 August 2018

This release is made to revert changes introduced in [2.3.1] that caused unexpected behaviour for several users.

### Minor

 * [#670]: Rollback template cache causing unexpected behaviour, by [@raymond-lam].

## [2.3.1] / 7 August 2018

### Minor

 * [#643]: `Writer.prototype.parse` to cache by tags in addition to template string, by [@raymond-lam].
 * [#664]: Fix `Writer.prototype.parse` cache, by [@seminaoki].

### Dev

 * [#666]: Install release tools with npm rather than pre-commit hook & `Rakefile`, by [@phillipj].
 * [#667], [#668]: Stabilize browser test suite, by [@phillipj].

### Docs

 * [#644]: Document global Mustache.escape overriding capacity, by [@paultopia].
 * [#657]: Correct `Mustache.parse()` return type documentation, by [@bbrooks].

## [2.3.0] / 8 November 2016

### Minor

 * [#540]: Add optional `output` argument to mustache CLI, by [@wizawu].
 * [#597]: Add compatibility with amdclean, by [@mightyplow].

### Dev

 * [#553]: Assert `null` lookup when rendering an unescaped value, by [@dasilvacontin].
 * [#580], [#610]: Ignore eslint for greenkeeper updates, by [@phillipj].
 * [#560]: Fix CLI tests for Windows, by [@kookookchoozeus].
 * Run browser tests w/node v4, by [@phillipj].

### Docs

 * [#542]: Add API documentation to README, by [@tomekwi].
 * [#546]: Add missing syntax highlighting to README code blocks, by [@pra85].
 * [#569]: Update Ctemplate links in README, by [@mortonfox].
 * [#592]: Change "loadUser" to "loadUser()" in README, by [@Flaque].
 * [#593]: Adding doctype to HTML code example in README, by [@calvinf].

### Dependencies

 * eslint -> 2.2.0. Breaking changes fix by [@phillipj]. [#548]
 * eslint -> 2.5.1.
 * mocha -> 3.0.2.
 * zuul -> 3.11.0.

## [2.2.1] / 13 December 2015

### Fixes

 * Improve HTML escaping, by [@phillipj].
 * Fix inconsistency in defining global mustache object, by [@simast].
 * Fix switch-case indent error, by [@norfish].
 * Unpin chai and eslint versions, by [@dasilvacontin].
 * Update README.md with proper grammar, by [@EvanLovely].
 * Update mjackson username in README, by [@mjackson].
 * Remove syntax highlighting in README code sample, by [@imagentleman].
 * Fix typo in README, by [@Xcrucifier].
 * Fix link typo in README, by [@keirog].

## [2.2.0] / 15 October 2015

### Added

 * Add Partials support to CLI, by [@palkan].

### Changed

 * Move install instructions to README's top, by [@mateusortiz]
 * Improved devhook install output, by [@ShashankaNataraj].
 * Clarifies and improves language in documentation, by [@jfmercer].
 * Linting CLI tool, by [@phillipj].
 * npm 2.x and node v4 on Travis, by [@phillipj].

### Fixes

 * Fix README spelling error to "aforementioned", by [@djchie].
 * Equal error message test in .render() for server and browser, by [@phillipj].

### Dependencies

 * chai -> 3.3.0
 * eslint -> 1.6.0

## [2.1.3] / 23 July 2015

### Added

 * Throw error when providing .render() with invalid template type, by [@phillipj].
 * Documents use of string literals containing double quotes, by [@jfmercer].

### Changed

 * Move mustache gif to githubusercontent, by [@Andersos].

### Fixed

 * Update UMD Shim to be resilient to HTMLElement global pollution, by [@mikesherov].

## [2.1.2] / 17 June 2015

### Added

 * Mustache global definition ([#466]) by [@yousefcisco].

## [2.1.1] / 11 June 2015

### Added

 * State that we use semver on the change log, by [@dasilvacontin].
 * Added version links to change log, by [@dasilvacontin].

### Fixed

 * Bugfix for using values from view's context prototype, by [@phillipj].
 * Improve test with undefined/null lookup hit using dot notation, by [@dasilvacontin].
 * Bugfix for null/undefined lookup hit when using dot notation, by [@phillipj].
 * Remove moot `version` property from bower.json, by [@kkirsche].
 * bower.json doesn't require a version bump via hook, by [@dasilvacontin].


## [2.1.0] / 5 June 2015

 * Added license attribute to package.json, by [@pgilad].
 * Minor changes to make mustache.js compatible with both WSH and ASP, by [@nagaozen].
 * Improve CLI view parsing error, by [@phillipj].
 * Bugfix for view context cache, by [@phillipj].

## [2.0.0] / 27 Mar 2015

 * Fixed lookup not stopping upon finding `undefined` or `null` values, by [@dasilvacontin].
 * Refactored pre-commit hook, by [@dasilvacontin].

## [1.2.0] / 24 Mar 2015

 * Added -v option to CLI, by [@phillipj].
 * Bugfix for rendering Number when it serves as the Context, by [@phillipj].
 * Specified files in package.json for a cleaner install, by [@phillipj].

## [1.1.0] / 18 Feb 2015

 * Refactor Writer.renderTokens() for better readability, by [@phillipj].
 * Cleanup tests section in readme, by [@phillipj].
 * Added JSHint to tests/CI, by [@phillipj].
 * Added node v0.12 on travis, by [@phillipj].
 * Created command line tool, by [@phillipj].
 * Added *falsy* to Inverted Sections description in README, by [@kristijanmatic].

## [1.0.0] / 20 Dec 2014

  * Inline tag compilation, by [@mjackson].
  * Fixed AMD registration, volo package.json entry, by [@jrburke].
  * Added spm support, by [@afc163].
  * Only access properties of objects on Context.lookup, by [@cmbuckley].

## [0.8.2] / 17 Mar 2014

  * Supporting Bower through a bower.json file.

## [0.8.1] / 3 Jan 2014

  * Fix usage of partial templates.

## [0.8.0] / 2 Dec 2013

  * Remove compile* writer functions, use mustache.parse instead. Smaller API.
  * Throw an error when rendering a template that contains higher-order sections and
    the original template is not provided.
  * Remove low-level Context.make function.
  * Better code readability and inline documentation.
  * Stop caching templates by name.

## [0.7.3] / 5 Nov 2013

  * Don't require the original template to be passed to the rendering function
    when using compiled templates. This is still required when using higher-order
    functions in order to be able to extract the portion of the template
    that was contained by that section. Fixes [#262].
  * Performance improvements.

## [0.7.2] / 27 Dec 2012

  * Fixed a rendering bug ([#274]) when using nested higher-order sections.
  * Better error reporting on failed parse.
  * Converted tests to use mocha instead of vows.

## [0.7.1] / 6 Dec 2012

  * Handle empty templates gracefully. Fixes [#265], [#267], and [#270].
  * Cache partials by template, not by name. Fixes [#257].
  * Added Mustache.compileTokens to compile the output of Mustache.parse. Fixes
    [#258].

## [0.7.0] / 10 Sep 2012

  * Rename Renderer => Writer.
  * Allow partials to be loaded dynamically using a callback (thanks
    [@TiddoLangerak] for the suggestion).
  * Fixed a bug with higher-order sections that prevented them from being
    passed the raw text of the section from the original template.
  * More concise token format. Tokens also include start/end indices in the
    original template.
  * High-level API is consistent with the Writer API.
  * Allow partials to be passed to the pre-compiled function (thanks
    [@fallenice]).
  * Don't use eval (thanks [@cweider]).

## [0.6.0] / 31 Aug 2012

  * Use JavaScript's definition of falsy when determining whether to render an
    inverted section or not. Issue [#186].
  * Use Mustache.escape to escape values inside {{}}. This function may be
    reassigned to alter the default escaping behavior. Issue [#244].
  * Fixed a bug that clashed with QUnit (thanks [@kannix]).
  * Added volo support (thanks [@guybedford]).

[4.2.0]: https://github.com/janl/mustache.js/compare/v4.1.0...v4.2.0
[4.1.0]: https://github.com/janl/mustache.js/compare/v4.0.1...v4.1.0
[4.0.1]: https://github.com/janl/mustache.js/compare/v4.0.0...v4.0.1
[4.0.0]: https://github.com/janl/mustache.js/compare/v3.2.1...v4.0.0
[3.2.1]: https://github.com/janl/mustache.js/compare/v3.2.0...v3.2.1
[3.2.0]: https://github.com/janl/mustache.js/compare/v3.1.0...v3.2.0
[3.1.0]: https://github.com/janl/mustache.js/compare/v3.0.3...v3.1.0
[3.0.3]: https://github.com/janl/mustache.js/compare/v3.0.2...v3.0.3
[3.0.2]: https://github.com/janl/mustache.js/compare/v3.0.1...v3.0.2
[3.0.1]: https://github.com/janl/mustache.js/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/janl/mustache.js/compare/v2.3.2...v3.0.0
[2.3.2]: https://github.com/janl/mustache.js/compare/v2.3.1...v2.3.2
[2.3.1]: https://github.com/janl/mustache.js/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/janl/mustache.js/compare/v2.2.1...v2.3.0
[2.2.1]: https://github.com/janl/mustache.js/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/janl/mustache.js/compare/v2.1.3...v2.2.0
[2.1.3]: https://github.com/janl/mustache.js/compare/v2.1.2...v2.1.3
[2.1.2]: https://github.com/janl/mustache.js/compare/v2.1.1...v2.1.2
[2.1.1]: https://github.com/janl/mustache.js/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/janl/mustache.js/compare/v2.0.0...v2.1.0
[2.0.0]: https://github.com/janl/mustache.js/compare/v1.2.0...v2.0.0
[1.2.0]: https://github.com/janl/mustache.js/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/janl/mustache.js/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/janl/mustache.js/compare/0.8.2...v1.0.0
[0.8.2]: https://github.com/janl/mustache.js/compare/0.8.1...0.8.2
[0.8.1]: https://github.com/janl/mustache.js/compare/0.8.0...0.8.1
[0.8.0]: https://github.com/janl/mustache.js/compare/0.7.3...0.8.0
[0.7.3]: https://github.com/janl/mustache.js/compare/0.7.2...0.7.3
[0.7.2]: https://github.com/janl/mustache.js/compare/0.7.1...0.7.2
[0.7.1]: https://github.com/janl/mustache.js/compare/0.7.0...0.7.1
[0.7.0]: https://github.com/janl/mustache.js/compare/0.6.0...0.7.0
[0.6.0]: https://github.com/janl/mustache.js/compare/0.5.2...0.6.0

[#186]: https://github.com/janl/mustache.js/issues/186
[#244]: https://github.com/janl/mustache.js/issues/244
[#257]: https://github.com/janl/mustache.js/issues/257
[#258]: https://github.com/janl/mustache.js/issues/258
[#262]: https://github.com/janl/mustache.js/issues/262
[#265]: https://github.com/janl/mustache.js/issues/265
[#267]: https://github.com/janl/mustache.js/issues/267
[#270]: https://github.com/janl/mustache.js/issues/270
[#274]: https://github.com/janl/mustache.js/issues/274
[#466]: https://github.com/janl/mustache.js/issues/466
[#540]: https://github.com/janl/mustache.js/issues/540
[#542]: https://github.com/janl/mustache.js/issues/542
[#546]: https://github.com/janl/mustache.js/issues/546
[#548]: https://github.com/janl/mustache.js/issues/548
[#553]: https://github.com/janl/mustache.js/issues/553
[#560]: https://github.com/janl/mustache.js/issues/560
[#569]: https://github.com/janl/mustache.js/issues/569
[#580]: https://github.com/janl/mustache.js/issues/580
[#592]: https://github.com/janl/mustache.js/issues/592
[#593]: https://github.com/janl/mustache.js/issues/593
[#597]: https://github.com/janl/mustache.js/issues/597
[#610]: https://github.com/janl/mustache.js/issues/610
[#643]: https://github.com/janl/mustache.js/issues/643
[#644]: https://github.com/janl/mustache.js/issues/644
[#657]: https://github.com/janl/mustache.js/issues/657
[#664]: https://github.com/janl/mustache.js/issues/664
[#666]: https://github.com/janl/mustache.js/issues/666
[#667]: https://github.com/janl/mustache.js/issues/667
[#668]: https://github.com/janl/mustache.js/issues/668
[#670]: https://github.com/janl/mustache.js/issues/670
[#618]: https://github.com/janl/mustache.js/issues/618
[#673]: https://github.com/janl/mustache.js/issues/673
[#679]: https://github.com/janl/mustache.js/issues/679
[#701]: https://github.com/janl/mustache.js/issues/701
[#704]: https://github.com/janl/mustache.js/issues/704
[#705]: https://github.com/janl/mustache.js/issues/705
[#713]: https://github.com/janl/mustache.js/issues/713
[#714]: https://github.com/janl/mustache.js/issues/714
[#716]: https://github.com/janl/mustache.js/issues/716
[#717]: https://github.com/janl/mustache.js/issues/717
[#728]: https://github.com/janl/mustache.js/issues/728
[#733]: https://github.com/janl/mustache.js/issues/733
[#731]: https://github.com/janl/mustache.js/issues/731
[#735]: https://github.com/janl/mustache.js/issues/735
[#739]: https://github.com/janl/mustache.js/issues/739
[#764]: https://github.com/janl/mustache.js/issues/764
[#773]: https://github.com/janl/mustache.js/issues/773

[@afc163]: https://github.com/afc163
[@aielo]: https://github.com/aielo
[@andersk]: https://github.com/andersk
[@Andersos]: https://github.com/Andersos
[@AndrewLeedham]: https://github.com/AndrewLeedham
[@bbrooks]: https://github.com/bbrooks
[@calvinf]: https://github.com/calvinf
[@cmbuckley]: https://github.com/cmbuckley
[@cweider]: https://github.com/cweider
[@dasilvacontin]: https://github.com/dasilvacontin
[@djchie]: https://github.com/djchie
[@eobrain]: https://github.com/eobrain
[@EvanLovely]: https://github.com/EvanLovely
[@fallenice]: https://github.com/fallenice
[@Flaque]: https://github.com/Flaque
[@guybedford]: https://github.com/guybedford
[@imagentleman]: https://github.com/imagentleman
[@JEStaubach]: https://github.com/JEStaubach
[@jfmercer]: https://github.com/jfmercer
[@jrburke]: https://github.com/jrburke
[@kannix]: https://github.com/kannix
[@keirog]: https://github.com/keirog
[@kkirsche]: https://github.com/kkirsche
[@kookookchoozeus]: https://github.com/kookookchoozeus
[@kristijanmatic]: https://github.com/kristijanmatic
[@kevindew]: https://github.com/kevindew
[@manzt]: https://github.com/manzt
[@mateusortiz]: https://github.com/mateusortiz
[@mightyplow]: https://github.com/mightyplow
[@mikesherov]: https://github.com/mikesherov
[@mjackson]: https://github.com/mjackson
[@mortonfox]: https://github.com/mortonfox
[@nagaozen]: https://github.com/nagaozen
[@norfish]: https://github.com/norfish
[@palkan]: https://github.com/palkan
[@paultopia]: https://github.com/paultopia
[@pgilad]: https://github.com/pgilad
[@phillipj]: https://github.com/phillipj
[@pineapplemachine]: https://github.com/pineapplemachine
[@pra85]: https://github.com/pra85
[@raymond-lam]: https://github.com/raymond-lam
[@seminaoki]: https://github.com/seminaoki
[@ShashankaNataraj]: https://github.com/ShashankaNataraj
[@simast]: https://github.com/simast
[@stackchain]: https://github.com/stackchain
[@TiddoLangerak]: https://github.com/TiddoLangerak
[@tomekwi]: https://github.com/tomekwi
[@wizawu]: https://github.com/wizawu
[@wol-soft]: https://github.com/wol-soft
[@Xcrucifier]: https://github.com/Xcrucifier
[@yotammadem]: https://github.com/yotammadem
[@yousefcisco]: https://github.com/yousefcisco
[@zekth]: https://github.com/zekth


================================================
FILE: LICENSE
================================================
The MIT License

Copyright (c) 2009 Chris Wanstrath (Ruby)
Copyright (c) 2010-2014 Jan Lehnardt (JavaScript)
Copyright (c) 2010-2015 The mustache.js community

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: MIGRATING.md
================================================
# Migrating Guide

## Moving to mustache.js v2

### Overview

mustache.js v2 introduces a bug fix that breaks compatibility with older versions: fixing null and undefined lookup.

When mustache.js tries to render a variable `{{name}}`, it executes a `lookup` function to figure out which value it should render. This function looks up the value for the key `name` in the current context, and if there is no such key in the current context it looks up the parent contexts recursively.

Value lookup should stop whenever the key exists in the context. However, due to a bug, this was not happening when the value was `null` or `undefined` even though the key existed in the context.

Here's a simple example of the same template rendered with both mustache.js v1 and v2:

Template:
```mustache
{{#friends}}
{{name}}'s twitter is: {{twitter}}
{{/friends}}
```

View:
```json
{
    "name": "David",
    "twitter": "@dasilvacontin",
    "friends": [
        {
            "name": "Phillip",
            "twitter": "@phillipjohnsen"
        },
        {
            "name": "Jan",
            "twitter": null
        }
    ]
}
```

Rendered using mustache.js v1:
```text
Phillip's twitter is: @phillipjohnsen
Jan's twitter is: @dasilvacontin
```

Rendered using mustache.js v2:
```text
Phillip's twitter is: @phillipjohnsen
Jan's twitter is:
```

================================================
FILE: README.md
================================================
# mustache.js - Logic-less {{mustache}} templates with JavaScript

> What could be more logical awesome than no logic at all?

[![Build Status](https://travis-ci.org/janl/mustache.js.svg?branch=master)](https://travis-ci.org/janl/mustache.js)

[mustache.js](http://github.com/janl/mustache.js) is a zero-dependency implementation of the [mustache](http://mustache.github.io/) template system in JavaScript.

[Mustache](http://mustache.github.io/) is a logic-less template syntax. It can be used for HTML, config files, source code - anything. It works by expanding tags in a template using values provided in a hash or object.

We call it "logic-less" because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values.

For a language-agnostic overview of mustache's template syntax, see the `mustache(5)` [manpage](http://mustache.github.io/mustache.5.html).

## Where to use mustache.js?

You can use mustache.js to render mustache templates anywhere you can use JavaScript. This includes web browsers, server-side environments such as [Node.js](http://nodejs.org/), and [CouchDB](http://couchdb.apache.org/) views.

mustache.js ships with support for the [CommonJS](http://www.commonjs.org/) module API, the [Asynchronous Module Definition](https://github.com/amdjs/amdjs-api/wiki/AMD) API (AMD) and [ECMAScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules).

In addition to being a package to be used programmatically, you can use it as a [command line tool](#command-line-tool).

And this will be your templates after you use Mustache:

!['stache](https://cloud.githubusercontent.com/assets/288977/8779228/a3cf700e-2f02-11e5-869a-300312fb7a00.gif)

## Install

You can get Mustache via [npm](http://npmjs.com).

```bash
$ npm install mustache --save
```

## Usage

Below is a quick example how to use mustache.js:

```js
const Mustache = require('mustache');

const view = {
  title: "Joe",
  calc: () => ( 2 + 4 )
};

const output = Mustache.render("{{title}} spends {{calc}}", view);
```

In this example, the `Mustache.render` function takes two parameters: 1) the [mustache](http://mustache.github.io/) template and 2) a `view` object that contains the data and code needed to render the template.

## Templates

A [mustache](http://mustache.github.io/) template is a string that contains any number of mustache tags. Tags are indicated by the double mustaches that surround them. `{{person}}` is a tag, as is `{{#person}}`. In both examples we refer to `person` as the tag's key. There are several types of tags available in mustache.js, described below.

There are several techniques that can be used to load templates and hand them to mustache.js, here are two of them:

#### Include Templates

If you need a template for a dynamic part in a static website, you can consider including the template in the static HTML file to avoid loading templates separately. Here's a small example:

```js
// file: render.js

function renderHello() {
  const template = document.getElementById('template').innerHTML;
  const rendered = Mustache.render(template, { name: 'Luke' });
  document.getElementById('target').innerHTML = rendered;
}
```

```html
<html>
  <body onload="renderHello()">
    <div id="target">Loading...</div>
    <script id="template" type="x-tmpl-mustache">
      Hello {{ name }}!
    </script>

    <script src="https://unpkg.com/mustache@latest"></script>
    <script src="render.js"></script>
  </body>
</html>
```

#### Load External Templates

If your templates reside in individual files, you can load them asynchronously and render them when they arrive. Another example using [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch):

```js
function renderHello() {
  fetch('template.mustache')
    .then((response) => response.text())
    .then((template) => {
      const rendered = Mustache.render(template, { name: 'Luke' });
      document.getElementById('target').innerHTML = rendered;    
    });
}
```

### Variables

The most basic tag type is a simple variable. A `{{name}}` tag renders the value of the `name` key in the current context. If there is no such key, nothing is rendered.

All variables are HTML-escaped by default. If you want to render unescaped HTML, use the triple mustache: `{{{name}}}`. You can also use `&` to unescape a variable.

If you'd like to change HTML-escaping behavior globally (for example, to template non-HTML formats), you can override Mustache's escape function. For example, to disable all escaping: `Mustache.escape = function(text) {return text;};`.

If you want `{{name}}` _not_ to be interpreted as a mustache tag, but rather to appear exactly as `{{name}}` in the output, you must change and then restore the default delimiter. See the [Custom Delimiters](#custom-delimiters) section for more information.

View:

```json
{
  "name": "Chris",
  "company": "<b>GitHub</b>"
}
```

Template:

```
* {{name}}
* {{age}}
* {{company}}
* {{{company}}}
* {{&company}}
{{=<% %>=}}
* {{company}}
<%={{ }}=%>
```

Output:

```html
* Chris
*
* &lt;b&gt;GitHub&lt;/b&gt;
* <b>GitHub</b>
* <b>GitHub</b>
* {{company}}
```

JavaScript's dot notation may be used to access keys that are properties of objects in a view.

View:

```json
{
  "name": {
    "first": "Michael",
    "last": "Jackson"
  },
  "age": "RIP"
}
```

Template:

```html
* {{name.first}} {{name.last}}
* {{age}}
```

Output:

```html
* Michael Jackson
* RIP
```

### Sections

Sections render blocks of text zero or more times, depending on the value of the key in the current context.

A section begins with a pound and ends with a slash. That is, `{{#person}}` begins a `person` section, while `{{/person}}` ends it. The text between the two tags is referred to as that section's "block".

The behavior of the section is determined by the value of the key.

#### False Values or Empty Lists

If the `person` key does not exist, or exists and has a value of `null`, `undefined`, `false`, `0`, or `NaN`, or is an empty string or an empty list, the block will not be rendered.

View:

```json
{
  "person": false
}
```

Template:

```html
Shown.
{{#person}}
Never shown!
{{/person}}
```

Output:

```html
Shown.
```

#### Non-Empty Lists

If the `person` key exists and is not `null`, `undefined`, or `false`, and is not an empty list the block will be rendered one or more times.

When the value is a list, the block is rendered once for each item in the list. The context of the block is set to the current item in the list for each iteration. In this way we can loop over collections.

View:

```json
{
  "stooges": [
    { "name": "Moe" },
    { "name": "Larry" },
    { "name": "Curly" }
  ]
}
```

Template:

```html
{{#stooges}}
<b>{{name}}</b>
{{/stooges}}
```

Output:

```html
<b>Moe</b>
<b>Larry</b>
<b>Curly</b>
```

When looping over an array of strings, a `.` can be used to refer to the current item in the list.

View:

```json
{
  "musketeers": ["Athos", "Aramis", "Porthos", "D'Artagnan"]
}
```

Template:

```html
{{#musketeers}}
* {{.}}
{{/musketeers}}
```

Output:

```html
* Athos
* Aramis
* Porthos
* D'Artagnan
```

If the value of a section variable is a function, it will be called in the context of the current item in the list on each iteration.

View:

```js
{
  "beatles": [
    { "firstName": "John", "lastName": "Lennon" },
    { "firstName": "Paul", "lastName": "McCartney" },
    { "firstName": "George", "lastName": "Harrison" },
    { "firstName": "Ringo", "lastName": "Starr" }
  ],
  "name": function () {
    return this.firstName + " " + this.lastName;
  }
}
```

Template:

```html
{{#beatles}}
* {{name}}
{{/beatles}}
```

Output:

```html
* John Lennon
* Paul McCartney
* George Harrison
* Ringo Starr
```

#### Functions

If the value of a section key is a function, it is called with the section's literal block of text, un-rendered, as its first argument. The second argument is a special rendering function that uses the current view as its view argument. It is called in the context of the current view object.

View:

```js
{
  "name": "Tater",
  "bold": function () {
    return function (text, render) {
      return "<b>" + render(text) + "</b>";
    }
  }
}
```

Template:

```html
{{#bold}}Hi {{name}}.{{/bold}}
```

Output:

```html
<b>Hi Tater.</b>
```

### Inverted Sections

An inverted section opens with `{{^section}}` instead of `{{#section}}`. The block of an inverted section is rendered only if the value of that section's tag is `null`, `undefined`, `false`, *falsy* or an empty list.

View:

```json
{
  "repos": []
}
```

Template:

```html
{{#repos}}<b>{{name}}</b>{{/repos}}
{{^repos}}No repos :({{/repos}}
```

Output:

```html
No repos :(
```

### Comments

Comments begin with a bang and are ignored. The following template:

```html
<h1>Today{{! ignore me }}.</h1>
```

Will render as follows:

```html
<h1>Today.</h1>
```

Comments may contain newlines.

### Partials

Partials begin with a greater than sign, like {{> box}}.

Partials are rendered at runtime (as opposed to compile time), so recursive partials are possible. Just avoid infinite loops.

They also inherit the calling context. Whereas in ERB you may have this:

```html+erb
<%= partial :next_more, :start => start, :size => size %>
```

Mustache requires only this:

```html
{{> next_more}}
```

Why? Because the `next_more.mustache` file will inherit the `size` and `start` variables from the calling context. In this way you may want to think of partials as includes, imports, template expansion, nested templates, or subtemplates, even though those aren't literally the case here.


For example, this template and partial:

    base.mustache:
    <h2>Names</h2>
    {{#names}}
      {{> user}}
    {{/names}}

    user.mustache:
    <strong>{{name}}</strong>

Can be thought of as a single, expanded template:

```html
<h2>Names</h2>
{{#names}}
  <strong>{{name}}</strong>
{{/names}}
```

In mustache.js an object of partials may be passed as the third argument to `Mustache.render`. The object should be keyed by the name of the partial, and its value should be the partial text.

```js
Mustache.render(template, view, {
  user: userTemplate
});
```

### Custom Delimiters

Custom delimiters can be used in place of `{{` and `}}` by setting the new values in JavaScript or in templates.

#### Setting in JavaScript

The `Mustache.tags` property holds an array consisting of the opening and closing tag values. Set custom values by passing a new array of tags to `render()`, which gets honored over the default values, or by overriding the `Mustache.tags` property itself:

```js
const customTags = [ '<%', '%>' ];
```

##### Pass Value into Render Method
```js
Mustache.render(template, view, {}, customTags);
```

##### Override Tags Property
```js
Mustache.tags = customTags;
// Subsequent parse() and render() calls will use customTags
```

#### Setting in Templates

Set Delimiter tags start with an equals sign and change the tag delimiters from `{{` and `}}` to custom strings.

Consider the following contrived example:

```html+erb
* {{ default_tags }}
{{=<% %>=}}
* <% erb_style_tags %>
<%={{ }}=%>
* {{ default_tags_again }}
```

Here we have a list with three items. The first item uses the default tag style, the second uses ERB style as defined by the Set Delimiter tag, and the third returns to the default style after yet another Set Delimiter declaration.

According to [ctemplates](https://htmlpreview.github.io/?https://raw.githubusercontent.com/OlafvdSpek/ctemplate/master/doc/howto.html), this "is useful for languages like TeX, where double-braces may occur in the text and are awkward to use for markup."

Custom delimiters may not contain whitespace or the equals sign.

## Pre-parsing and Caching Templates

By default, when mustache.js first parses a template it keeps the full parsed token tree in a cache. The next time it sees that same template it skips the parsing step and renders the template much more quickly. If you'd like, you can do this ahead of time using `mustache.parse`.

```js
Mustache.parse(template);

// Then, sometime later.
Mustache.render(template, view);
```

## Command line tool

mustache.js is shipped with a Node.js based command line tool. It might be installed as a global tool on your computer to render a mustache template of some kind

```bash
$ npm install -g mustache

$ mustache dataView.json myTemplate.mustache > output.html
```

also supports stdin.

```bash
$ cat dataView.json | mustache - myTemplate.mustache > output.html
```

or as a package.json `devDependency` in a build process maybe?

```bash
$ npm install mustache --save-dev
```

```json
{
  "scripts": {
    "build": "mustache dataView.json myTemplate.mustache > public/output.html"
  }
}
```
```bash
$ npm run build
```

The command line tool is basically a wrapper around `Mustache.render` so you get all the features.

If your templates use partials you should pass paths to partials using `-p` flag:

```bash
$ mustache -p path/to/partial1.mustache -p path/to/partial2.mustache dataView.json myTemplate.mustache
```

## Plugins for JavaScript Libraries

mustache.js may be built specifically for several different client libraries, including the following:

  - [jQuery](http://jquery.com/)
  - [MooTools](http://mootools.net/)
  - [Dojo](http://www.dojotoolkit.org/)
  - [YUI](http://developer.yahoo.com/yui/)
  - [qooxdoo](http://qooxdoo.org/)

These may be built using [Rake](http://rake.rubyforge.org/) and one of the following commands:
```bash
$ rake jquery
$ rake mootools
$ rake dojo
$ rake yui3
$ rake qooxdoo
```

## TypeScript

Since the source code of this package is written in JavaScript, we follow the [TypeScript publishing docs](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) preferred approach
by having type definitions available via [@types/mustache](https://www.npmjs.com/package/@types/mustache).

## Testing

In order to run the tests you'll need to install [Node.js](http://nodejs.org/).

You also need to install the sub module containing [Mustache specifications](http://github.com/mustache/spec) in the project root.
```bash
$ git submodule init
$ git submodule update
```
Install dependencies.
```bash
$ npm install
```
Then run the tests.
```bash
$ npm test
```
The test suite consists of both unit and integration tests. If a template isn't rendering correctly for you, you can make a test for it by doing the following:

  1. Create a template file named `mytest.mustache` in the `test/_files`
     directory. Replace `mytest` with the name of your test.
  2. Create a corresponding view file named `mytest.js` in the same directory.
     This file should contain a JavaScript object literal enclosed in
     parentheses. See any of the other view files for an example.
  3. Create a file with the expected output in `mytest.txt` in the same
     directory.

Then, you can run the test with:
```bash
$ TEST=mytest npm run test-render
```

### Browser tests

Browser tests are not included in `npm test` as they run for too long, although they are ran automatically on Travis when merged into master. Run browser tests locally in any browser:
```bash
$ npm run test-browser-local
```
then point your browser to `http://localhost:8080/__zuul`

## Who uses mustache.js?

An updated list of mustache.js users is kept [on the Github wiki](https://github.com/janl/mustache.js/wiki/Beard-Competition). Add yourself or your company if you use mustache.js!

## Contributing

mustache.js is a mature project, but it continues to actively invite maintainers. You can help out a high-profile project that is used in a lot of places on the web. No big commitment required, if all you do is review a single [Pull Request](https://github.com/janl/mustache.js/pulls), you are a maintainer. And a hero.

### Your First Contribution

- review a [Pull Request](https://github.com/janl/mustache.js/pulls)
- fix an [Issue](https://github.com/janl/mustache.js/issues)
- update the [documentation](https://github.com/janl/mustache.js#usage)
- make a website
- write a tutorial

## Thanks

mustache.js wouldn't kick ass if it weren't for these fine souls:

  * Chris Wanstrath / defunkt
  * Alexander Lang / langalex
  * Sebastian Cohnen / tisba
  * J Chris Anderson / jchris
  * Tom Robinson / tlrobinson
  * Aaron Quint / quirkey
  * Douglas Crockford
  * Nikita Vasilyev / NV
  * Elise Wood / glytch
  * Damien Mathieu / dmathieu
  * Jakub Kuźma / qoobaa
  * Will Leinweber / will
  * dpree
  * Jason Smith / jhs
  * Aaron Gibralter / agibralter
  * Ross Boucher / boucher
  * Matt Sanford / mzsanford
  * Ben Cherry / bcherry
  * Michael Jackson / mjackson
  * Phillip Johnsen / phillipj
  * David da Silva Contín / dasilvacontin


================================================
FILE: Rakefile
================================================
require 'rake'
require 'rake/clean'

task :default => :test

def minified_file
  ENV['FILE'] || 'mustache.min.js'
end

desc "Run all tests"
task :test do
  sh "./node_modules/.bin/mocha test"
end

desc "Run JSHint"
task :hint do
  sh "./node_modules/.bin/jshint mustache.js"
end

# Creates a task that uses the various template wrappers to make a wrapped
# output file. There is some extra complexity because Dojo and YUI use
# different final locations.
def templated_build(name, final_location=nil)
  short = name.downcase
  source = File.join("wrappers", short)
  dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  target_js = final_location.nil? ? "#{short}.mustache.js" : "mustache.js"

  desc "Package for #{name}"
  task short.to_sym => dependencies do
    puts "Packaging for #{name}"

    mkdir_p final_location unless final_location.nil?

    sources = [ "#{source}/mustache.js.pre", 'mustache.js', "#{source}/mustache.js.post" ]
    relative_name = "#{final_location || '.'}/#{target_js}"

    open(relative_name, 'w') do |f|
      sources.each {|source| f << File.read(source) }
    end

    puts "Done, see #{relative_name}"
  end

  CLEAN.include(final_location.nil? ? target_js : final_location)
end

templated_build "jQuery"
templated_build "MooTools"
templated_build "Dojo", "dojox/string"
templated_build "YUI3", "yui3/mustache"
templated_build "qooxdoo"


================================================
FILE: bin/mustache
================================================
#!/usr/bin/env node

var fs = require('fs'),
    path = require('path');

var Mustache = require('..');
var pkg = require('../package');
var partials = {};

var partialsPaths = [];
var partialArgIndex = -1;

while ((partialArgIndex = process.argv.indexOf('-p')) > -1) {
  partialsPaths.push(process.argv.splice(partialArgIndex, 2)[1]);
}

var viewArg = process.argv[2];
var templateArg = process.argv[3];
var outputArg = process.argv[4];

if (hasVersionArg()) {
  return console.log(pkg.version);
}

if (!templateArg || !viewArg) {
  console.error('Syntax: mustache <view> <template> [output]');
  process.exit(1);
}

run(readPartials, readView, readTemplate, render, toStdout);

/**
 * Runs a list of functions as a waterfall.
 * Functions are runned one after the other in order, providing each
 * function the returned values of all the previously invoked functions.
 * Each function is expected to exit the process if an error occurs.
 */
function run (/*args*/) {
  var values = [];
  var fns = Array.prototype.slice.call(arguments);

  function invokeNextFn (val) {
    values.unshift(val);
    if (fns.length === 0) return;
    invoke(fns.shift());
  }

  function invoke (fn) {
    fn.apply(null, [invokeNextFn].concat(values));
  }

  invoke(fns.shift());
}

function readView (cb) {
  var view;
  if (isJsFile(viewArg)) {
    view = require(path.join(process.cwd(),viewArg));
    cb(view);
  } else {
    if (isStdin(viewArg)) {
      view = process.openStdin();
    } else {
      view = fs.createReadStream(viewArg);
    }
    streamToStr(view, function onDone (str) {
      cb(parseView(str));
    });
  }
}

function parseView (str) {
  try {
    return JSON.parse(str);
  } catch (ex) {
    console.error(
      'Shooot, could not parse view as JSON.\n' +
      'Tips: functions are not valid JSON and keys / values must be surround with double quotes.\n\n' +
      ex.stack);

    process.exit(1);
  }
}

function readPartials (cb) {
  if (!partialsPaths.length) return cb();
  var partialPath = partialsPaths.pop();
  var partial = fs.createReadStream(partialPath);
  streamToStr(partial, function onDone (str) {
    partials[getPartialName(partialPath)] = str;
    readPartials(cb);
  });
}

function readTemplate (cb) {
  var template = fs.createReadStream(templateArg);
  streamToStr(template, cb);
}

function render (cb, templateStr, jsonView) {
  cb(Mustache.render(templateStr, jsonView, partials));
}

function toStdout (cb, str) {
  if (outputArg) {
    cb(fs.writeFileSync(outputArg, str));
  } else {
    cb(process.stdout.write(str));
  }
}

function streamToStr (stream, cb) {
  var data = '';

  stream.on('data', function onData (chunk) {
    data += chunk;
  }).once('end', function onEnd () {
    cb(data.toString());
  }).on('error', function onError (err) {
    if (wasNotFound(err)) {
      console.error('Could not find file:', err.path);
    } else {
      console.error('Error while reading file:', err.message);
    }
    process.exit(1);
  });
}

function isStdin (view) {
  return view === '-';
}

function isJsFile (view) {
  var extension = path.extname(view);
  return extension === '.js' || extension === '.cjs';
}

function wasNotFound (err) {
  return err.code && err.code === 'ENOENT';
}

function hasVersionArg () {
  return ['--version', '-v'].some(function matchInArgs (opt) {
    return process.argv.indexOf(opt) > -1;
  });
}

function getPartialName (filename) {
  return path.basename(filename, '.mustache');
}


================================================
FILE: mustache.js
================================================
/*!
 * mustache.js - Logic-less {{mustache}} templates with JavaScript
 * http://github.com/janl/mustache.js
 */

var objectToString = Object.prototype.toString;
var isArray = Array.isArray || function isArrayPolyfill (object) {
  return objectToString.call(object) === '[object Array]';
};

function isFunction (object) {
  return typeof object === 'function';
}

/**
 * More correct typeof string handling array
 * which normally returns typeof 'object'
 */
function typeStr (obj) {
  return isArray(obj) ? 'array' : typeof obj;
}

function escapeRegExp (string) {
  return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
}

/**
 * Null safe way of checking whether or not an object,
 * including its prototype, has a given property
 */
function hasProperty (obj, propName) {
  return obj != null && typeof obj === 'object' && (propName in obj);
}

/**
 * Safe way of detecting whether or not the given thing is a primitive and
 * whether it has the given property
 */
function primitiveHasOwnProperty (primitive, propName) {
  return (
    primitive != null
    && typeof primitive !== 'object'
    && primitive.hasOwnProperty
    && primitive.hasOwnProperty(propName)
  );
}

// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
// See https://github.com/janl/mustache.js/issues/189
var regExpTest = RegExp.prototype.test;
function testRegExp (re, string) {
  return regExpTest.call(re, string);
}

var nonSpaceRe = /\S/;
function isWhitespace (string) {
  return !testRegExp(nonSpaceRe, string);
}

var entityMap = {
  '&': '&amp;',
  '<': '&lt;',
  '>': '&gt;',
  '"': '&quot;',
  "'": '&#39;',
  '/': '&#x2F;',
  '`': '&#x60;',
  '=': '&#x3D;'
};

function escapeHtml (string) {
  return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) {
    return entityMap[s];
  });
}

var whiteRe = /\s*/;
var spaceRe = /\s+/;
var equalsRe = /\s*=/;
var curlyRe = /\s*\}/;
var tagRe = /#|\^|\/|>|\{|&|=|!/;

/**
 * Breaks up the given `template` string into a tree of tokens. If the `tags`
 * argument is given here it must be an array with two string values: the
 * opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of
 * course, the default is to use mustaches (i.e. mustache.tags).
 *
 * A token is an array with at least 4 elements. The first element is the
 * mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag
 * did not contain a symbol (i.e. {{myValue}}) this element is "name". For
 * all text that appears outside a symbol this element is "text".
 *
 * The second element of a token is its "value". For mustache tags this is
 * whatever else was inside the tag besides the opening symbol. For text tokens
 * this is the text itself.
 *
 * The third and fourth elements of the token are the start and end indices,
 * respectively, of the token in the original template.
 *
 * Tokens that are the root node of a subtree contain two more elements: 1) an
 * array of tokens in the subtree and 2) the index in the original template at
 * which the closing tag for that section begins.
 *
 * Tokens for partials also contain two more elements: 1) a string value of
 * indendation prior to that tag and 2) the index of that tag on that line -
 * eg a value of 2 indicates the partial is the third tag on this line.
 */
function parseTemplate (template, tags) {
  if (!template)
    return [];
  var lineHasNonSpace = false;
  var sections = [];     // Stack to hold section tokens
  var tokens = [];       // Buffer to hold the tokens
  var spaces = [];       // Indices of whitespace tokens on the current line
  var hasTag = false;    // Is there a {{tag}} on the current line?
  var nonSpace = false;  // Is there a non-space char on the current line?
  var indentation = '';  // Tracks indentation for tags that use it
  var tagIndex = 0;      // Stores a count of number of tags encountered on a line

  // Strips all whitespace tokens array for the current line
  // if there was a {{#tag}} on it and otherwise only space.
  function stripSpace () {
    if (hasTag && !nonSpace) {
      while (spaces.length)
        delete tokens[spaces.pop()];
    } else {
      spaces = [];
    }

    hasTag = false;
    nonSpace = false;
  }

  var openingTagRe, closingTagRe, closingCurlyRe;
  function compileTags (tagsToCompile) {
    if (typeof tagsToCompile === 'string')
      tagsToCompile = tagsToCompile.split(spaceRe, 2);

    if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
      throw new Error('Invalid tags: ' + tagsToCompile);

    openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\s*');
    closingTagRe = new RegExp('\\s*' + escapeRegExp(tagsToCompile[1]));
    closingCurlyRe = new RegExp('\\s*' + escapeRegExp('}' + tagsToCompile[1]));
  }

  compileTags(tags || mustache.tags);

  var scanner = new Scanner(template);

  var start, type, value, chr, token, openSection;
  while (!scanner.eos()) {
    start = scanner.pos;

    // Match any text between tags.
    value = scanner.scanUntil(openingTagRe);

    if (value) {
      for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
        chr = value.charAt(i);

        if (isWhitespace(chr)) {
          spaces.push(tokens.length);
          indentation += chr;
        } else {
          nonSpace = true;
          lineHasNonSpace = true;
          indentation += ' ';
        }

        tokens.push([ 'text', chr, start, start + 1 ]);
        start += 1;

        // Check for whitespace on the current line.
        if (chr === '\n') {
          stripSpace();
          indentation = '';
          tagIndex = 0;
          lineHasNonSpace = false;
        }
      }
    }

    // Match the opening tag.
    if (!scanner.scan(openingTagRe))
      break;

    hasTag = true;

    // Get the tag type.
    type = scanner.scan(tagRe) || 'name';
    scanner.scan(whiteRe);

    // Get the tag value.
    if (type === '=') {
      value = scanner.scanUntil(equalsRe);
      scanner.scan(equalsRe);
      scanner.scanUntil(closingTagRe);
    } else if (type === '{') {
      value = scanner.scanUntil(closingCurlyRe);
      scanner.scan(curlyRe);
      scanner.scanUntil(closingTagRe);
      type = '&';
    } else {
      value = scanner.scanUntil(closingTagRe);
    }

    // Match the closing tag.
    if (!scanner.scan(closingTagRe))
      throw new Error('Unclosed tag at ' + scanner.pos);

    if (type == '>') {
      token = [ type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace ];
    } else {
      token = [ type, value, start, scanner.pos ];
    }
    tagIndex++;
    tokens.push(token);

    if (type === '#' || type === '^') {
      sections.push(token);
    } else if (type === '/') {
      // Check section nesting.
      openSection = sections.pop();

      if (!openSection)
        throw new Error('Unopened section "' + value + '" at ' + start);

      if (openSection[1] !== value)
        throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
    } else if (type === 'name' || type === '{' || type === '&') {
      nonSpace = true;
    } else if (type === '=') {
      // Set the tags for the next time around.
      compileTags(value);
    }
  }

  stripSpace();

  // Make sure there are no open sections when we're done.
  openSection = sections.pop();

  if (openSection)
    throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);

  return nestTokens(squashTokens(tokens));
}

/**
 * Combines the values of consecutive text tokens in the given `tokens` array
 * to a single token.
 */
function squashTokens (tokens) {
  var squashedTokens = [];

  var token, lastToken;
  for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
    token = tokens[i];

    if (token) {
      if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
        lastToken[1] += token[1];
        lastToken[3] = token[3];
      } else {
        squashedTokens.push(token);
        lastToken = token;
      }
    }
  }

  return squashedTokens;
}

/**
 * Forms the given array of `tokens` into a nested tree structure where
 * tokens that represent a section have two additional items: 1) an array of
 * all tokens that appear in that section and 2) the index in the original
 * template that represents the end of that section.
 */
function nestTokens (tokens) {
  var nestedTokens = [];
  var collector = nestedTokens;
  var sections = [];

  var token, section;
  for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
    token = tokens[i];

    switch (token[0]) {
      case '#':
      case '^':
        collector.push(token);
        sections.push(token);
        collector = token[4] = [];
        break;
      case '/':
        section = sections.pop();
        section[5] = token[2];
        collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
        break;
      default:
        collector.push(token);
    }
  }

  return nestedTokens;
}

/**
 * A simple string scanner that is used by the template parser to find
 * tokens in template strings.
 */
function Scanner (string) {
  this.string = string;
  this.tail = string;
  this.pos = 0;
}

/**
 * Returns `true` if the tail is empty (end of string).
 */
Scanner.prototype.eos = function eos () {
  return this.tail === '';
};

/**
 * Tries to match the given regular expression at the current position.
 * Returns the matched text if it can match, the empty string otherwise.
 */
Scanner.prototype.scan = function scan (re) {
  var match = this.tail.match(re);

  if (!match || match.index !== 0)
    return '';

  var string = match[0];

  this.tail = this.tail.substring(string.length);
  this.pos += string.length;

  return string;
};

/**
 * Skips all text until the given regular expression can be matched. Returns
 * the skipped string, which is the entire tail if no match can be made.
 */
Scanner.prototype.scanUntil = function scanUntil (re) {
  var index = this.tail.search(re), match;

  switch (index) {
    case -1:
      match = this.tail;
      this.tail = '';
      break;
    case 0:
      match = '';
      break;
    default:
      match = this.tail.substring(0, index);
      this.tail = this.tail.substring(index);
  }

  this.pos += match.length;

  return match;
};

/**
 * Represents a rendering context by wrapping a view object and
 * maintaining a reference to the parent context.
 */
function Context (view, parentContext) {
  this.view = view;
  this.cache = { '.': this.view };
  this.parent = parentContext;
}

/**
 * Creates a new context using the given view with this context
 * as the parent.
 */
Context.prototype.push = function push (view) {
  return new Context(view, this);
};

/**
 * Returns the value of the given name in this context, traversing
 * up the context hierarchy if the value is absent in this context's view.
 */
Context.prototype.lookup = function lookup (name) {
  var cache = this.cache;

  var value;
  if (cache.hasOwnProperty(name)) {
    value = cache[name];
  } else {
    var context = this, intermediateValue, names, index, lookupHit = false;

    while (context) {
      if (name.indexOf('.') > 0) {
        intermediateValue = context.view;
        names = name.split('.');
        index = 0;

        /**
         * Using the dot notion path in `name`, we descend through the
         * nested objects.
         *
         * To be certain that the lookup has been successful, we have to
         * check if the last object in the path actually has the property
         * we are looking for. We store the result in `lookupHit`.
         *
         * This is specially necessary for when the value has been set to
         * `undefined` and we want to avoid looking up parent contexts.
         *
         * In the case where dot notation is used, we consider the lookup
         * to be successful even if the last "object" in the path is
         * not actually an object but a primitive (e.g., a string, or an
         * integer), because it is sometimes useful to access a property
         * of an autoboxed primitive, such as the length of a string.
         **/
        while (intermediateValue != null && index < names.length) {
          if (index === names.length - 1)
            lookupHit = (
              hasProperty(intermediateValue, names[index])
              || primitiveHasOwnProperty(intermediateValue, names[index])
            );

          intermediateValue = intermediateValue[names[index++]];
        }
      } else {
        intermediateValue = context.view[name];

        /**
         * Only checking against `hasProperty`, which always returns `false` if
         * `context.view` is not an object. Deliberately omitting the check
         * against `primitiveHasOwnProperty` if dot notation is not used.
         *
         * Consider this example:
         * ```
         * Mustache.render("The length of a football field is {{#length}}{{length}}{{/length}}.", {length: "100 yards"})
         * ```
         *
         * If we were to check also against `primitiveHasOwnProperty`, as we do
         * in the dot notation case, then render call would return:
         *
         * "The length of a football field is 9."
         *
         * rather than the expected:
         *
         * "The length of a football field is 100 yards."
         **/
        lookupHit = hasProperty(context.view, name);
      }

      if (lookupHit) {
        value = intermediateValue;
        break;
      }

      context = context.parent;
    }

    cache[name] = value;
  }

  if (isFunction(value))
    value = value.call(this.view);

  return value;
};

/**
 * A Writer knows how to take a stream of tokens and render them to a
 * string, given a context. It also maintains a cache of templates to
 * avoid the need to parse the same template twice.
 */
function Writer () {
  this.templateCache = {
    _cache: {},
    set: function set (key, value) {
      this._cache[key] = value;
    },
    get: function get (key) {
      return this._cache[key];
    },
    clear: function clear () {
      this._cache = {};
    }
  };
}

/**
 * Clears all cached templates in this writer.
 */
Writer.prototype.clearCache = function clearCache () {
  if (typeof this.templateCache !== 'undefined') {
    this.templateCache.clear();
  }
};

/**
 * Parses and caches the given `template` according to the given `tags` or
 * `mustache.tags` if `tags` is omitted,  and returns the array of tokens
 * that is generated from the parse.
 */
Writer.prototype.parse = function parse (template, tags) {
  var cache = this.templateCache;
  var cacheKey = template + ':' + (tags || mustache.tags).join(':');
  var isCacheEnabled = typeof cache !== 'undefined';
  var tokens = isCacheEnabled ? cache.get(cacheKey) : undefined;

  if (tokens == undefined) {
    tokens = parseTemplate(template, tags);
    isCacheEnabled && cache.set(cacheKey, tokens);
  }
  return tokens;
};

/**
 * High-level method that is used to render the given `template` with
 * the given `view`.
 *
 * The optional `partials` argument may be an object that contains the
 * names and templates of partials that are used in the template. It may
 * also be a function that is used to load partial templates on the fly
 * that takes a single argument: the name of the partial.
 *
 * If the optional `config` argument is given here, then it should be an
 * object with a `tags` attribute or an `escape` attribute or both.
 * If an array is passed, then it will be interpreted the same way as
 * a `tags` attribute on a `config` object.
 *
 * The `tags` attribute of a `config` object must be an array with two
 * string values: the opening and closing tags used in the template (e.g.
 * [ "<%", "%>" ]). The default is to mustache.tags.
 *
 * The `escape` attribute of a `config` object must be a function which
 * accepts a string as input and outputs a safely escaped string.
 * If an `escape` function is not provided, then an HTML-safe string
 * escaping function is used as the default.
 */
Writer.prototype.render = function render (template, view, partials, config) {
  var tags = this.getConfigTags(config);
  var tokens = this.parse(template, tags);
  var context = (view instanceof Context) ? view : new Context(view, undefined);
  return this.renderTokens(tokens, context, partials, template, config);
};

/**
 * Low-level method that renders the given array of `tokens` using
 * the given `context` and `partials`.
 *
 * Note: The `originalTemplate` is only ever used to extract the portion
 * of the original template that was contained in a higher-order section.
 * If the template doesn't use higher-order sections, this argument may
 * be omitted.
 */
Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate, config) {
  var buffer = '';

  var token, symbol, value;
  for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
    value = undefined;
    token = tokens[i];
    symbol = token[0];

    if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate, config);
    else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate, config);
    else if (symbol === '>') value = this.renderPartial(token, context, partials, config);
    else if (symbol === '&') value = this.unescapedValue(token, context);
    else if (symbol === 'name') value = this.escapedValue(token, context, config);
    else if (symbol === 'text') value = this.rawValue(token);

    if (value !== undefined)
      buffer += value;
  }

  return buffer;
};

Writer.prototype.renderSection = function renderSection (token, context, partials, originalTemplate, config) {
  var self = this;
  var buffer = '';
  var value = context.lookup(token[1]);

  // This function is used to render an arbitrary template
  // in the current context by higher-order sections.
  function subRender (template) {
    return self.render(template, context, partials, config);
  }

  if (!value) return;

  if (isArray(value)) {
    for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
      buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config);
    }
  } else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') {
    buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config);
  } else if (isFunction(value)) {
    if (typeof originalTemplate !== 'string')
      throw new Error('Cannot use higher-order sections without the original template');

    // Extract the portion of the original template that the section contains.
    value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);

    if (value != null)
      buffer += value;
  } else {
    buffer += this.renderTokens(token[4], context, partials, originalTemplate, config);
  }
  return buffer;
};

Writer.prototype.renderInverted = function renderInverted (token, context, partials, originalTemplate, config) {
  var value = context.lookup(token[1]);

  // Use JavaScript's definition of falsy. Include empty arrays.
  // See https://github.com/janl/mustache.js/issues/186
  if (!value || (isArray(value) && value.length === 0))
    return this.renderTokens(token[4], context, partials, originalTemplate, config);
};

Writer.prototype.indentPartial = function indentPartial (partial, indentation, lineHasNonSpace) {
  var filteredIndentation = indentation.replace(/[^ \t]/g, '');
  var partialByNl = partial.split('\n');
  for (var i = 0; i < partialByNl.length; i++) {
    if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) {
      partialByNl[i] = filteredIndentation + partialByNl[i];
    }
  }
  return partialByNl.join('\n');
};

Writer.prototype.renderPartial = function renderPartial (token, context, partials, config) {
  if (!partials) return;
  var tags = this.getConfigTags(config);

  var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
  if (value != null) {
    var lineHasNonSpace = token[6];
    var tagIndex = token[5];
    var indentation = token[4];
    var indentedValue = value;
    if (tagIndex == 0 && indentation) {
      indentedValue = this.indentPartial(value, indentation, lineHasNonSpace);
    }
    var tokens = this.parse(indentedValue, tags);
    return this.renderTokens(tokens, context, partials, indentedValue, config);
  }
};

Writer.prototype.unescapedValue = function unescapedValue (token, context) {
  var value = context.lookup(token[1]);
  if (value != null)
    return value;
};

Writer.prototype.escapedValue = function escapedValue (token, context, config) {
  var escape = this.getConfigEscape(config) || mustache.escape;
  var value = context.lookup(token[1]);
  if (value != null)
    return (typeof value === 'number' && escape === mustache.escape) ? String(value) : escape(value);
};

Writer.prototype.rawValue = function rawValue (token) {
  return token[1];
};

Writer.prototype.getConfigTags = function getConfigTags (config) {
  if (isArray(config)) {
    return config;
  }
  else if (config && typeof config === 'object') {
    return config.tags;
  }
  else {
    return undefined;
  }
};

Writer.prototype.getConfigEscape = function getConfigEscape (config) {
  if (config && typeof config === 'object' && !isArray(config)) {
    return config.escape;
  }
  else {
    return undefined;
  }
};

var mustache = {
  name: 'mustache.js',
  version: '4.2.0',
  tags: [ '{{', '}}' ],
  clearCache: undefined,
  escape: undefined,
  parse: undefined,
  render: undefined,
  Scanner: undefined,
  Context: undefined,
  Writer: undefined,
  /**
   * Allows a user to override the default caching strategy, by providing an
   * object with set, get and clear methods. This can also be used to disable
   * the cache by setting it to the literal `undefined`.
   */
  set templateCache (cache) {
    defaultWriter.templateCache = cache;
  },
  /**
   * Gets the default or overridden caching object from the default writer.
   */
  get templateCache () {
    return defaultWriter.templateCache;
  }
};

// All high-level mustache.* functions use this writer.
var defaultWriter = new Writer();

/**
 * Clears all cached templates in the default writer.
 */
mustache.clearCache = function clearCache () {
  return defaultWriter.clearCache();
};

/**
 * Parses and caches the given template in the default writer and returns the
 * array of tokens it contains. Doing this ahead of time avoids the need to
 * parse templates on the fly as they are rendered.
 */
mustache.parse = function parse (template, tags) {
  return defaultWriter.parse(template, tags);
};

/**
 * Renders the `template` with the given `view`, `partials`, and `config`
 * using the default writer.
 */
mustache.render = function render (template, view, partials, config) {
  if (typeof template !== 'string') {
    throw new TypeError('Invalid template! Template should be a "string" ' +
                        'but "' + typeStr(template) + '" was given as the first ' +
                        'argument for mustache#render(template, view, partials)');
  }

  return defaultWriter.render(template, view, partials, config);
};

// Export the escaping function so that the user may override it.
// See https://github.com/janl/mustache.js/issues/244
mustache.escape = escapeHtml;

// Export these mainly for testing, but also for advanced usage.
mustache.Scanner = Scanner;
mustache.Context = Context;
mustache.Writer = Writer;

export default mustache;


================================================
FILE: package.json
================================================
{
  "name": "mustache",
  "version": "4.2.0",
  "description": "Logic-less {{mustache}} templates with JavaScript",
  "author": "mustache.js Authors <http://github.com/janl/mustache.js>",
  "homepage": "https://github.com/janl/mustache.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/janl/mustache.js.git"
  },
  "keywords": [
    "mustache",
    "template",
    "templates",
    "ejs"
  ],
  "main": "mustache.js",
  "bin": {
    "mustache": "./bin/mustache"
  },
  "files": [
    "bin/",
    "mustache.mjs",
    "mustache.min.js",
    "wrappers/"
  ],
  "exports": {
    ".": {
      "import": "./mustache.mjs",
      "require": "./mustache.js"
    },
    "./*": "./*"
  },
  "volo": {
    "url": "https://raw.github.com/janl/mustache.js/{version}/mustache.js"
  },
  "scripts": {
    "build": "cp mustache.js mustache.mjs && rollup mustache.mjs --file mustache.js --format umd --name Mustache && uglifyjs mustache.js > mustache.min.js",
    "test": "npm run test-lint && npm run test-unit",
    "test-lint": "eslint mustache.js bin/mustache test/*.js test/**/*.js",
    "test-unit": "mocha --reporter spec test/*-test.js",
    "test-render": "mocha  --reporter spec test/render-test",
    "pre-test-browser": "node test/create-browser-suite.js",
    "test-browser": "npm run pre-test-browser && zuul -- test/context-test.js test/parse-test.js test/scanner-test.js test/render-test-browser.js",
    "test-browser-local": "npm run pre-test-browser && zuul --local 8080 -- test/context-test.js test/scanner-test.js test/parse-test.js test/render-test-browser.js",
    "postversion": "scripts/bump-version-in-source",
    "prepublishOnly": "npm run build"
  },
  "devDependencies": {
    "chai": "^3.4.0",
    "eslint": "^6.5.1",
    "esm": "^3.2.25",
    "jshint": "^2.9.5",
    "mocha": "^3.0.2",
    "puppeteer": "^2.0.0",
    "rollup": "^1.26.3",
    "uglify-js": "^3.4.6",
    "zuul": "^3.11.0",
    "zuul-ngrok": "nolanlawson/zuul-ngrok#patch-1"
  },
  "greenkeeper": {
    "ignore": [
      "eslint"
    ]
  },
  "license": "MIT"
}


================================================
FILE: scripts/bump-version-in-source
================================================
#!/usr/bin/env ruby

require 'json'

def puts_c(color, str)
	puts "\x1b[#{color}m#{str}\x1b[0m"
end

class Source
	attr_accessor :path, :v_regex

	def initialize(path, v_regex)
		@path = path
		@v_regex = v_regex
	end
end

class Bumper
	attr_accessor :sources, :bumped, :target_v

	def initialize(sources)
		@sources = sources
	end

	def start

		# get package.json version
		package = JSON.parse File.read 'package.json'
		@target_v = package['version']

		@bumped = false
		@sources.each {|source| bump_source(source)}

		# if bumped, do extra stuff and notify the user
		if @bumped
			`git add mustache.js`
			`git commit --amend --no-edit`

			puts_c 32, "successfully bumped version to #{@target_v}!"
			puts_c 33, "don't forget to `npm publish`!"
		end

		exit 0
	end

	def bump_source(source)
		file_buffer = File.read source.path
		if match = file_buffer.match(source.v_regex)
			file_v = match.captures[0]
			if @target_v != file_v
				did_bump
				puts "> bumping version in file '#{source.path}': #{file_v} -> #{@target_v}..."
				file_buffer[source.v_regex, 1] = @target_v
				File.open(source.path, 'w') { |f| f.write file_buffer }
			end
		else
			puts_c 31, "ERROR: Can't find version in '#{source.path}'"
			exit 1
		end
	end

	def did_bump
		if !@bumped
			puts 'bump detected!'
		end
		@bumped = true
	end
end

bumper = Bumper.new([
	Source.new('mustache.js', /version: '([^']+)'/),
])
bumper.start


================================================
FILE: spec/_files/bom_as_whitespace.js
================================================
var bom_as_whitespace = {'tag': 'Tag name w/o BOM', '\uFEFFtag': 'Tag name with BOM'};

================================================
FILE: spec/_files/bom_as_whitespace.mustache
================================================
{{tag}}

================================================
FILE: spec/_files/bom_as_whitespace.txt
================================================
Tag name w/o BOM

================================================
FILE: test/.eslintrc
================================================
{
  "extends": "../.eslintrc",
  "rules": {
    "func-names": 0
  }
}


================================================
FILE: test/_files/ampersand_escape.js
================================================
({
  message: 'Some <code>'
});


================================================
FILE: test/_files/ampersand_escape.mustache
================================================
{{&message}}


================================================
FILE: test/_files/ampersand_escape.txt
================================================
Some <code>


================================================
FILE: test/_files/apostrophe.js
================================================
({
  'apos': "'",
  'control': 'X'
});


================================================
FILE: test/_files/apostrophe.mustache
================================================
{{apos}}{{control}}


================================================
FILE: test/_files/apostrophe.txt
================================================
&#39;X


================================================
FILE: test/_files/array_of_strings.js
================================================
({
  array_of_strings: ['hello', 'world']
});


================================================
FILE: test/_files/array_of_strings.mustache
================================================
{{#array_of_strings}}{{.}} {{/array_of_strings}}


================================================
FILE: test/_files/array_of_strings.txt
================================================
hello world 


================================================
FILE: test/_files/avoids_obj_prototype_in_view_cache.js
================================================
({
  valueOf: 'Avoids methods',
  watch: 'in Object.prototype'
});


================================================
FILE: test/_files/avoids_obj_prototype_in_view_cache.mustache
================================================
{{valueOf}} {{watch}}

================================================
FILE: test/_files/avoids_obj_prototype_in_view_cache.txt
================================================
Avoids methods in Object.prototype

================================================
FILE: test/_files/backslashes.js
================================================
({
  value: '\\abc'
});


================================================
FILE: test/_files/backslashes.mustache
================================================
* {{value}}
* {{{value}}}
* {{&value}}
<script>
foo = { bar: 'abc\"xyz\"' };
foo = { bar: 'x\'y' };
</script>


================================================
FILE: test/_files/backslashes.txt
================================================
* \abc
* \abc
* \abc
<script>
foo = { bar: 'abc\"xyz\"' };
foo = { bar: 'x\'y' };
</script>


================================================
FILE: test/_files/bug_11_eating_whitespace.js
================================================
({
  tag: 'yo'
});


================================================
FILE: test/_files/bug_11_eating_whitespace.mustache
================================================
{{tag}} foo


================================================
FILE: test/_files/bug_11_eating_whitespace.txt
================================================
yo foo


================================================
FILE: test/_files/bug_length_property.js
================================================
({
    length: 'hello'
});


================================================
FILE: test/_files/bug_length_property.mustache
================================================
{{#length}}The length variable is: {{length}}{{/length}}


================================================
FILE: test/_files/bug_length_property.txt
================================================
The length variable is: hello


================================================
FILE: test/_files/changing_delimiters.js
================================================
({
  'foo': 'foooooooooooooo',
  'bar': '<b>bar!</b>'
});


================================================
FILE: test/_files/changing_delimiters.mustache
================================================
{{=<% %>=}}<% foo %> {{foo}} <%{bar}%> {{{bar}}}


================================================
FILE: test/_files/changing_delimiters.txt
================================================
foooooooooooooo {{foo}} <b>bar!</b> {{{bar}}}


================================================
FILE: test/_files/check_falsy.js
================================================
({
  number: function (text, render) {
    return function (text, render) {
      return +render(text);
    };
  }
});


================================================
FILE: test/_files/check_falsy.mustache
================================================
<p>{{#number}}0{{/number}}</p>


================================================
FILE: test/_files/check_falsy.txt
================================================
<p>0</p>


================================================
FILE: test/_files/cli.cjs
================================================
module.exports = {
  name: 'LeBron'
};


================================================
FILE: test/_files/cli.js
================================================
module.exports = {
  name: 'LeBron'
};


================================================
FILE: test/_files/cli.json
================================================
{
  "name": "LeBron"
}


================================================
FILE: test/_files/cli.mustache
================================================
Howdy {{name}}, CLI rox

================================================
FILE: test/_files/cli.txt
================================================
Howdy LeBron, CLI rox

================================================
FILE: test/_files/cli_js_view_with_function.js
================================================
module.exports = {
  'name': 'Tater',
  'bold': function () {
    return function (text, render) {
      return '<b>' + render(text) + '</b>';
    };
  }
};

================================================
FILE: test/_files/cli_js_view_with_function.mustache
================================================
{{#bold}}Hi {{name}}.{{/bold}}

================================================
FILE: test/_files/cli_js_view_with_function.txt
================================================
<b>Hi Tater.</b>

================================================
FILE: test/_files/cli_with_partials.json
================================================
{ "users": [
    {
      "name": "LeBron"
    },
    {
      "name": "LeBron 2"
    }
  ],
  "comments": [
    {
      "title": "A Comedy of Errors"
    }
  ]
}

================================================
FILE: test/_files/cli_with_partials.mustache
================================================
{{#users}}
{{>cli}}
{{/users}}

{{#comments}}
{{>comments}}
{{/comments}}

================================================
FILE: test/_files/cli_with_partials.txt
================================================
Howdy LeBron, CLI roxHowdy LeBron 2, CLI rox
<h1>A Comedy of Errors</h1>


================================================
FILE: test/_files/comments.js
================================================
({
  title: function () {
    return 'A Comedy of Errors';
  }
});


================================================
FILE: test/_files/comments.mustache
================================================
<h1>{{title}}{{! just something interesting... or not... }}</h1>


================================================
FILE: test/_files/comments.txt
================================================
<h1>A Comedy of Errors</h1>


================================================
FILE: test/_files/complex.js
================================================
({
  header: function () {
    return 'Colors';
  },
  item: [
      {name: 'red', current: true, url: '#Red'},
      {name: 'green', current: false, url: '#Green'},
      {name: 'blue', current: false, url: '#Blue'}
  ],
  link: function () {
    return this['current'] !== true;
  },
  list: function () {
    return this.item.length !== 0;
  },
  empty: function () {
    return this.item.length === 0;
  }
});


================================================
FILE: test/_files/complex.mustache
================================================
<h1>{{header}}</h1>
{{#list}}
  <ul>
  {{#item}}
  {{#current}}
  <li><strong>{{name}}</strong></li>
  {{/current}}
  {{#link}}
  <li><a href="{{url}}">{{name}}</a></li>
  {{/link}}
  {{/item}}
  </ul>
{{/list}}
{{#empty}}
  <p>The list is empty.</p>
{{/empty}}


================================================
FILE: test/_files/complex.txt
================================================
<h1>Colors</h1>
  <ul>
  <li><strong>red</strong></li>
  <li><a href="#Green">green</a></li>
  <li><a href="#Blue">blue</a></li>
  </ul>


================================================
FILE: test/_files/context_lookup.js
================================================
({
  'outer': {
    'id': 1,
    'second': {
      'nothing': 2
    }
  }
});


================================================
FILE: test/_files/context_lookup.mustache
================================================
{{#outer}}{{#second}}{{id}}{{/second}}{{/outer}}


================================================
FILE: test/_files/context_lookup.txt
================================================
1


================================================
FILE: test/_files/delimiters.js
================================================
({
  first: 'It worked the first time.',
  second: 'And it worked the second time.',
  third: 'Then, surprisingly, it worked the third time.',
  fourth: 'Fourth time also fine!.'
});


================================================
FILE: test/_files/delimiters.mustache
================================================
{{=<% %>=}}*
<% first %>
* <% second %>
<%=| |=%>
* | third |
|={{ }}=|
* {{ fourth }}


================================================
FILE: test/_files/delimiters.txt
================================================
*
It worked the first time.
* And it worked the second time.
* Then, surprisingly, it worked the third time.
* Fourth time also fine!.


================================================
FILE: test/_files/disappearing_whitespace.js
================================================
({
  bedrooms: true,
  total: 1
});


================================================
FILE: test/_files/disappearing_whitespace.mustache
================================================
{{#bedrooms}}{{total}}{{/bedrooms}} BED


================================================
FILE: test/_files/disappearing_whitespace.txt
================================================
1 BED


================================================
FILE: test/_files/dot_notation.js
================================================
({
  name: 'A Book',
  authors: ['John Power', 'Jamie Walsh'],
  price: {
    value: 200,
    vat: function () {
      return this.value * 0.2;
    },
    currency: {
      symbol: '$',
      name: 'USD'
    }
  },
  availability: {
    status: true,
    text: 'In Stock'
  },
  // And now, some truthy false values
  truthy: {
    zero: 0,
    notTrue: false
  },
  singletonList: [{singletonItem: 'singleton item'}]
});


================================================
FILE: test/_files/dot_notation.mustache
================================================
<!-- exciting part -->
<h1>{{name}}</h1>
<p>Authors: <ul>{{#authors}}<li>{{.}}</li>{{/authors}}</ul></p>
<p>Price: {{{price.currency.symbol}}}{{price.value}} {{#price.currency}}{{name}} <b>{{availability.text}}</b>{{/price.currency}}</p>
<p>VAT: {{{price.currency.symbol}}}{{#price}}{{vat}}{{/price}}</p>
<!-- boring part -->
<h2>Test truthy false values:</h2>
<p>Zero: {{truthy.zero}}</p>
<p>False: {{truthy.notTrue}}</p>
<p>length of string should be rendered: {{price.currency.name.length}}</p>
<p>length of string in a list should be rendered: {{#singletonList}}{{singletonItem.length}}{{/singletonList}}</p>
<p>length of an array should be rendered: {{authors.length}}</p>


================================================
FILE: test/_files/dot_notation.txt
================================================
<!-- exciting part -->
<h1>A Book</h1>
<p>Authors: <ul><li>John Power</li><li>Jamie Walsh</li></ul></p>
<p>Price: $200 USD <b>In Stock</b></p>
<p>VAT: $40</p>
<!-- boring part -->
<h2>Test truthy false values:</h2>
<p>Zero: 0</p>
<p>False: false</p>
<p>length of string should be rendered: 3</p>
<p>length of string in a list should be rendered: 14</p>
<p>length of an array should be rendered: 2</p>


================================================
FILE: test/_files/double_render.js
================================================
({
  foo: true,
  bar: '{{win}}',
  win: 'FAIL'
});


================================================
FILE: test/_files/double_render.mustache
================================================
{{#foo}}{{bar}}{{/foo}}


================================================
FILE: test/_files/double_render.txt
================================================
{{win}}


================================================
FILE: test/_files/empty_list.js
================================================
({
  jobs: []
});


================================================
FILE: test/_files/empty_list.mustache
================================================
These are the jobs:
{{#jobs}}
{{.}}
{{/jobs}}


================================================
FILE: test/_files/empty_list.txt
================================================
These are the jobs:


================================================
FILE: test/_files/empty_sections.js
================================================
({});


================================================
FILE: test/_files/empty_sections.mustache
================================================
{{#foo}}{{/foo}}foo{{#bar}}{{/bar}}


================================================
FILE: test/_files/empty_sections.txt
================================================
foo


================================================
FILE: test/_files/empty_string.js
================================================
({
  description: 'That is all!',
  child: {
    description: ''
  }
});


================================================
FILE: test/_files/empty_string.mustache
================================================
{{description}}{{#child}}{{description}}{{/child}}


================================================
FILE: test/_files/empty_string.txt
================================================
That is all!


================================================
FILE: test/_files/empty_template.js
================================================
({});


================================================
FILE: test/_files/empty_template.mustache
================================================
<html><head></head><body><h1>Test</h1></body></html>

================================================
FILE: test/_files/empty_template.txt
================================================
<html><head></head><body><h1>Test</h1></body></html>

================================================
FILE: test/_files/error_not_found.js
================================================
({
  bar: 2
});


================================================
FILE: test/_files/error_not_found.mustache
================================================
{{foo}}

================================================
FILE: test/_files/error_not_found.txt
================================================


================================================
FILE: test/_files/escaped.js
================================================
({
  title: function () {
    return 'Bear > Shark';
  },
  symbol: null,
  entities: "&quot; \"'<>`=/"
});


================================================
FILE: test/_files/escaped.mustache
================================================
<h1>{{title}}{{symbol}}</h1>
And even {{entities}}, but not {{{entities}}}.


================================================
FILE: test/_files/escaped.txt
================================================
<h1>Bear &gt; Shark</h1>
And even &amp;quot; &quot;&#39;&lt;&gt;&#x60;&#x3D;&#x2F;, but not &quot; "'<>`=/.


================================================
FILE: test/_files/falsy.js
================================================
({
  'emptyString': '',
  'emptyArray': [],
  'zero': 0,
  'null': null,
  'undefined': undefined,
  'NaN': 0/0
});

================================================
FILE: test/_files/falsy.mustache
================================================
{{#emptyString}}empty string{{/emptyString}}
{{^emptyString}}inverted empty string{{/emptyString}}
{{#emptyArray}}empty array{{/emptyArray}}
{{^emptyArray}}inverted empty array{{/emptyArray}}
{{#zero}}zero{{/zero}}
{{^zero}}inverted zero{{/zero}}
{{#null}}null{{/null}}
{{^null}}inverted null{{/null}}
{{#undefined}}undefined{{/undefined}}
{{^undefined}}inverted undefined{{/undefined}}
{{#NaN}}NaN{{/NaN}}
{{^NaN}}inverted NaN{{/NaN}}


================================================
FILE: test/_files/falsy.txt
================================================

inverted empty string

inverted empty array

inverted zero

inverted null

inverted undefined

inverted NaN


================================================
FILE: test/_files/falsy_array.js
================================================
({
  'list': [
		['', 'emptyString'],
		[[], 'emptyArray'],
		[0, 'zero'],
		[null, 'null'],
		[undefined, 'undefined'],
		[0/0, 'NaN']
  ]
});

================================================
FILE: test/_files/falsy_array.mustache
================================================
{{#list}}
{{#.}}{{#.}}{{.}}{{/.}}{{^.}}inverted {{/.}}{{/.}}
{{/list}}

================================================
FILE: test/_files/falsy_array.txt
================================================
inverted emptyString
inverted emptyArray
inverted zero
inverted null
inverted undefined
inverted NaN


================================================
FILE: test/_files/grandparent_context.js
================================================
({
  grand_parent_id: 'grand_parent1',
  parent_contexts: [
    {
      parent_id: 'parent1',
      child_contexts: [
        { child_id: 'parent1-child1' },
        { child_id: 'parent1-child2' }
      ]
    },
    {
      parent_id: 'parent2',
      child_contexts: [
        { child_id: 'parent2-child1' },
        { child_id: 'parent2-child2' }
      ]
    }
  ]
});


================================================
FILE: test/_files/grandparent_context.mustache
================================================
{{grand_parent_id}}
{{#parent_contexts}}
{{grand_parent_id}}
{{parent_id}}
{{#child_contexts}}
{{grand_parent_id}}
{{parent_id}}
{{child_id}}
{{/child_contexts}}
{{/parent_contexts}}


================================================
FILE: test/_files/grandparent_context.txt
================================================
grand_parent1
grand_parent1
parent1
grand_parent1
parent1
parent1-child1
grand_parent1
parent1
parent1-child2
grand_parent1
parent2
grand_parent1
parent2
parent2-child1
grand_parent1
parent2
parent2-child2


================================================
FILE: test/_files/higher_order_sections.js
================================================
({
  name: 'Tater',
  helper: 'To tinker?',
  bolder: function () {
    return function (text, render) {
      return text + ' => <b>' + render(text) + '</b> ' + this.helper;
    };
  }
});


================================================
FILE: test/_files/higher_order_sections.mustache
================================================
{{#bolder}}Hi {{name}}.{{/bolder}}


================================================
FILE: test/_files/higher_order_sections.txt
================================================
Hi {{name}}. => <b>Hi Tater.</b> To tinker?


================================================
FILE: test/_files/implicit_iterator.js
================================================
({
  data: {
    author: {
      twitter_id: 819606,
      name: 'janl'
    }
  }
});


================================================
FILE: test/_files/implicit_iterator.mustache
================================================
{{# data.author.twitter_id }}
<meta name="twitter:site:id" content="{{.}}">
{{/ data.author.twitter_id }}

{{# data.author.name }}
<meta name="twitter:site" content="{{.}}">
{{/ data.author.name }}


================================================
FILE: test/_files/implicit_iterator.txt
================================================
<meta name="twitter:site:id" content="819606">

<meta name="twitter:site" content="janl">


================================================
FILE: test/_files/included_tag.js
================================================
({
  html: 'I like {{mustache}}'
});


================================================
FILE: test/_files/included_tag.mustache
================================================
You said "{{{html}}}" today


================================================
FILE: test/_files/included_tag.txt
================================================
You said "I like {{mustache}}" today


================================================
FILE: test/_files/inverted_section.js
================================================
({
  'repos': []
});


================================================
FILE: test/_files/inverted_section.mustache
================================================
{{#repos}}<b>{{name}}</b>{{/repos}}
{{^repos}}No repos :({{/repos}}
{{^nothin}}Hello!{{/nothin}}


================================================
FILE: test/_files/inverted_section.txt
================================================

No repos :(
Hello!


================================================
FILE: test/_files/keys_with_questionmarks.js
================================================
({
  'person?': {
    name: 'Jon'
  }
});


================================================
FILE: test/_files/keys_with_questionmarks.mustache
================================================
{{#person?}}
  Hi {{name}}!
{{/person?}}


================================================
FILE: test/_files/keys_with_questionmarks.txt
================================================
  Hi Jon!


================================================
FILE: test/_files/malicious_template.js
================================================
({});


================================================
FILE: test/_files/malicious_template.mustache
================================================
{{"+(function () {throw "evil"})()+"}}
{{{"+(function () {throw "evil"})()+"}}}
{{> "+(function () {throw "evil"})()+"}}
{{# "+(function () {throw "evil"})()+"}}
{{/ "+(function () {throw "evil"})()+"}}


================================================
FILE: test/_files/malicious_template.txt
================================================




================================================
FILE: test/_files/multiline_comment.js
================================================
({});


================================================
FILE: test/_files/multiline_comment.mustache
================================================
{{!

This is a multi-line comment.

}}
Hello world!


================================================
FILE: test/_files/multiline_comment.txt
================================================
Hello world!


================================================
FILE: test/_files/nested_dot.js
================================================
({ name: 'Bruno' });


================================================
FILE: test/_files/nested_dot.mustache
================================================
{{#name}}Hello {{.}}{{/name}}

================================================
FILE: test/_files/nested_dot.txt
================================================
Hello Bruno

================================================
FILE: test/_files/nested_higher_order_sections.js
================================================
({
  bold: function () {
    return function (text, render) {
      return '<b>' + render(text) + '</b>';
    };
  },
  person: { name: 'Jonas' }
});


================================================
FILE: test/_files/nested_higher_order_sections.mustache
================================================
{{#bold}}{{#person}}My name is {{name}}!{{/person}}{{/bold}}


================================================
FILE: test/_files/nested_higher_order_sections.txt
================================================
<b>My name is Jonas!</b>


================================================
FILE: test/_files/nested_iterating.js
================================================
({
  inner: [{
    foo: 'foo',
    inner: [{
      bar: 'bar'
    }]
  }]
});


================================================
FILE: test/_files/nested_iterating.mustache
================================================
{{#inner}}{{foo}}{{#inner}}{{bar}}{{/inner}}{{/inner}}


================================================
FILE: test/_files/nested_iterating.txt
================================================
foobar


================================================
FILE: test/_files/nesting.js
================================================
({
  foo: [
    {a: {b: 1}},
    {a: {b: 2}},
    {a: {b: 3}}
  ]
});


================================================
FILE: test/_files/nesting.mustache
================================================
{{#foo}}
  {{#a}}
    {{b}}
  {{/a}}
{{/foo}}


================================================
FILE: test/_files/nesting.txt
================================================
    1
    2
    3


================================================
FILE: test/_files/nesting_same_name.js
================================================
({
  items: [
    {
      name: 'name',
      items: [1, 2, 3, 4]
    }
  ]
});


================================================
FILE: test/_files/nesting_same_name.mustache
================================================
{{#items}}{{name}}{{#items}}{{.}}{{/items}}{{/items}}


================================================
FILE: test/_files/nesting_same_name.txt
================================================
name1234


================================================
FILE: test/_files/null_lookup_array.js
================================================
({
  'name': 'David',
  'twitter': '@dasilvacontin',
  'farray': [
    ['Flor', '@florrts'],
    ['Miquel', null],
    ['Chris', undefined]
  ]
});


================================================
FILE: test/_files/null_lookup_array.mustache
================================================
{{#farray}}
{{#.}}{{#.}}{{.}} {{/.}}{{^.}}no twitter{{/.}}{{/.}}
{{/farray}}


================================================
FILE: test/_files/null_lookup_array.txt
================================================
Flor @florrts 
Miquel no twitter
Chris no twitter


================================================
FILE: test/_files/null_lookup_object.js
================================================
({
  'name': 'David',
  'twitter': '@dasilvacontin',
  'fobject': [
    {
      'name': 'Flor',
      'twitter': '@florrts'
    },
    {
      'name': 'Miquel',
      'twitter': null
    },
    {
	'name': 'Chris',
	'twitter': undefined
    }
  ],
  'favorites': {
    'color': 'blue',
    'president': 'Bush',
    'show': 'Futurama'
  },
  'mascot': {
    'name': 'Squid',
    'favorites': {
      'color': 'orange',
      'president': undefined,
      'show': null
    }
  }
});


================================================
FILE: test/_files/null_lookup_object.mustache
================================================
{{#fobject}}
{{name}}'s twitter: {{#twitter}}{{.}}{{/twitter}}{{^twitter}}unknown{{/twitter}}.
{{/fobject}}

{{#mascot}}
{{name}}'s favorite color: {{#favorites.color}}{{.}}{{/favorites.color}}{{^favorites.color}}no one{{/favorites.color}}.
{{name}}'s favorite president: {{#favorites.president}}{{.}}{{/favorites.president}}{{^favorites.president}}no one{{/favorites.president}}.
{{name}}'s favorite show: {{#favorites.show}}{{.}}{{/favorites.show}}{{^favorites.show}}none{{/favorites.show}}.
{{/mascot}}


================================================
FILE: test/_files/null_lookup_object.txt
================================================
Flor's twitter: @florrts.
Miquel's twitter: unknown.
Chris's twitter: unknown.

Squid's favorite color: orange.
Squid's favorite president: no one.
Squid's favorite show: none.


================================================
FILE: test/_files/null_string.js
================================================
({
  name: 'Elise',
  glytch: true,
  binary: false,
  value: null,
  undef: undefined,
  numeric: function () {
    return NaN;
  }
});


================================================
FILE: test/_files/null_string.mustache
================================================
Hello {{name}}
glytch {{glytch}}
binary {{binary}}
value {{value}}
undef {{undef}}
numeric {{numeric}}


================================================
FILE: test/_files/null_string.txt
================================================
Hello Elise
glytch true
binary false
value 
undef 
numeric NaN


================================================
FILE: test/_files/null_view.js
================================================
({
  name: 'Joe',
  friends: null
});


================================================
FILE: test/_files/null_view.mustache
================================================
{{name}}'s friends: {{#friends}}{{name}}, {{/friends}}

================================================
FILE: test/_files/null_view.txt
================================================
Joe's friends: 

================================================
FILE: test/_files/partial_array.js
================================================
({
  array: ['1', '2', '3', '4']
});


================================================
FILE: test/_files/partial_array.mustache
================================================
{{>partial}}

================================================
FILE: test/_files/partial_array.partial
================================================
Here's a non-sense array of values
{{#array}}
  {{.}}
{{/array}}


================================================
FILE: test/_files/partial_array.txt
================================================
Here's a non-sense array of values
  1
  2
  3
  4


================================================
FILE: test/_files/partial_array_of_partials.js
================================================
({
  numbers: [
    {i: '1'},
    {i: '2'},
    {i: '3'},
    {i: '4'}
  ]
});


================================================
FILE: test/_files/partial_array_of_partials.mustache
================================================
Here is some stuff!
{{#numbers}}
{{>partial}}
{{/numbers}}


================================================
FILE: test/_files/partial_array_of_partials.partial
================================================
{{i}}


================================================
FILE: test/_files/partial_array_of_partials.txt
================================================
Here is some stuff!
1
2
3
4


================================================
FILE: test/_files/partial_array_of_partials_implicit.js
================================================
({
  numbers: ['1', '2', '3', '4']
});


================================================
FILE: test/_files/partial_array_of_partials_implicit.mustache
================================================
Here is some stuff!
{{#numbers}}
{{>partial}}
{{/numbers}}


================================================
FILE: test/_files/partial_array_of_partials_implicit.partial
================================================
{{.}}


================================================
FILE: test/_files/partial_array_of_partials_implicit.txt
================================================
Here is some stuff!
1
2
3
4


================================================
FILE: test/_files/partial_empty.js
================================================
({
  foo: 1
});


================================================
FILE: test/_files/partial_empty.mustache
================================================
hey {{foo}}
{{>partial}}


================================================
FILE: test/_files/partial_empty.partial
================================================


================================================
FILE: test/_files/partial_empty.txt
================================================
hey 1


================================================
FILE: test/_files/partial_template.js
================================================
({
  title: function () {
    return 'Welcome';
  },
  again: 'Goodbye'
});


================================================
FILE: test/_files/partial_template.mustache
================================================
<h1>{{title}}</h1>
{{>partial}}


================================================
FILE: test/_files/partial_template.partial
================================================
Again, {{again}}!


================================================
FILE: test/_files/partial_template.txt
================================================
<h1>Welcome</h1>
Again, Goodbye!


================================================
FILE: test/_files/partial_view.js
================================================
({
  greeting: function () {
    return 'Welcome';
  },
  farewell: function () {
    return 'Fair enough, right?';
  },
  name: 'Chris',
  value: 10000,
  taxed_value: function () {
    return this.value - (this.value * 0.4);
  },
  in_ca: true
});


================================================
FILE: test/_files/partial_view.mustache
================================================
<h1>{{greeting}}</h1>
{{>partial}}
<h3>{{farewell}}</h3>


================================================
FILE: test/_files/partial_view.partial
================================================
Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
Well, ${{ taxed_value }}, after taxes.
{{/in_ca}}

================================================
FILE: test/_files/partial_view.txt
================================================
<h1>Welcome</h1>
Hello Chris
You have just won $10000!
Well, $6000, after taxes.
<h3>Fair enough, right?</h3>


================================================
FILE: test/_files/partial_whitespace.js
================================================
({
  greeting: function () {
    return 'Welcome';
  },
  farewell: function () {
    return 'Fair enough, right?';
  },
  name: 'Chris',
  value: 10000,
  taxed_value: function () {
    return this.value - (this.value * 0.4);
  },
  in_ca: true
});


================================================
FILE: test/_files/partial_whitespace.mustache
================================================
<h1>{{  greeting  }}</h1>
{{> partial }}
<h3>{{ farewell }}</h3>


================================================
FILE: test/_files/partial_whitespace.partial
================================================
Hello {{ name}}
You have just won ${{value }}!
{{# in_ca  }}
Well, ${{ taxed_value }}, after taxes.
{{/  in_ca }}

================================================
FILE: test/_files/partial_whitespace.txt
================================================
<h1>Welcome</h1>
Hello Chris
You have just won $10000!
Well, $6000, after taxes.
<h3>Fair enough, right?</h3>


================================================
FILE: test/_files/recursion_with_same_names.js
================================================
({
  name: 'name',
  description: 'desc',
  terms: [
    {name: 't1', index: 0},
    {name: 't2', index: 1}
  ]
});


================================================
FILE: test/_files/recursion_with_same_names.mustache
================================================
{{ name }}
{{ description }}

{{#terms}}
  {{name}}
  {{index}}
{{/terms}}


================================================
FILE: test/_files/recursion_with_same_names.txt
================================================
name
desc

  t1
  0
  t2
  1


================================================
FILE: test/_files/reuse_of_enumerables.js
================================================
({
  terms: [
    {name: 't1', index: 0},
    {name: 't2', index: 1}
  ]
});


================================================
FILE: test/_files/reuse_of_enumerables.mustache
================================================
{{#terms}}
  {{name}}
  {{index}}
{{/terms}}
{{#terms}}
  {{name}}
  {{index}}
{{/terms}}


================================================
FILE: test/_files/reuse_of_enumerables.txt
================================================
  t1
  0
  t2
  1
  t1
  0
  t2
  1


================================================
FILE: test/_files/section_as_context.js
================================================
({
  a_object: {
    title: 'this is an object',
    description: 'one of its attributes is a list',
    a_list: [
      {label: 'listitem1'},
      {label: 'listitem2'}
    ]
  }
});


================================================
FILE: test/_files/section_as_context.mustache
================================================
{{#a_object}}
  <h1>{{title}}</h1>
  <p>{{description}}</p>
  <ul>
    {{#a_list}}
    <li>{{label}}</li>
    {{/a_list}}
  </ul>
{{/a_object}}


================================================
FILE: test/_files/section_as_context.txt
================================================
  <h1>this is an object</h1>
  <p>one of its attributes is a list</p>
  <ul>
    <li>listitem1</li>
    <li>listitem2</li>
  </ul>


================================================
FILE: test/_files/section_functions_in_partials.js
================================================
({
  bold: function (){
    return function (text, render) {
      return '<b>' + render(text) + '</b>';
    };
  }
});


================================================
FILE: test/_files/section_functions_in_partials.mustache
================================================
{{> partial}}

<p>some more text</p>


================================================
FILE: test/_files/section_functions_in_partials.partial
================================================
{{#bold}}Hello There{{/bold}}


================================================
FILE: test/_files/section_functions_in_partials.txt
================================================
<b>Hello There</b>

<p>some more text</p>


================================================
FILE: test/_files/simple.js
================================================
({
  name: 'Chris',
  value: 10000,
  taxed_value: function () {
    return this.value - (this.value * 0.4);
  },
  in_ca: true
});


================================================
FILE: test/_files/simple.mustache
================================================
Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
Well, ${{ taxed_value }}, after taxes.
{{/in_ca}}


================================================
FILE: test/_files/simple.txt
================================================
Hello Chris
You have just won $10000!
Well, $6000, after taxes.


================================================
FILE: test/_files/string_as_context.js
================================================
({
  a_string: 'aa',
  a_list: ['a','b','c']
});


================================================
FILE: test/_files/string_as_context.mustache
================================================
<ul>
{{#a_list}}
  <li>{{a_string}}/{{.}}</li>
{{/a_list}}
</ul>

================================================
FILE: test/_files/string_as_context.txt
================================================
<ul>
  <li>aa/a</li>
  <li>aa/b</li>
  <li>aa/c</li>
</ul>

================================================
FILE: test/_files/two_in_a_row.js
================================================
({
  name: 'Joe',
  greeting: 'Welcome'
});


================================================
FILE: test/_files/two_in_a_row.mustache
================================================
{{greeting}}, {{name}}!


================================================
FILE: test/_files/two_in_a_row.txt
================================================
Welcome, Joe!


================================================
FILE: test/_files/two_sections.js
================================================
({});


================================================
FILE: test/_files/two_sections.mustache
================================================
{{#foo}}
{{/foo}}
{{#bar}}
{{/bar}}


================================================
FILE: test/_files/two_sections.txt
================================================


================================================
FILE: test/_files/unescaped.js
================================================
({
  title: function () {
    return 'Bear > Shark';
  },
  symbol: null
});


================================================
FILE: test/_files/unescaped.mustache
================================================
<h1>{{{title}}}{{{symbol}}}</h1>


================================================
FILE: test/_files/unescaped.txt
================================================
<h1>Bear > Shark</h1>


================================================
FILE: test/_files/uses_props_from_view_prototype.js
================================================
var Aaa = (function () {
  function Aaa (x, y) {
    this.x = x;
    this._y = y;
  }
  Object.defineProperty(Aaa.prototype, 'y', {
    get: function () {
      return this._y;
    },
    set: function (value) {
      this._y = value;
    },
    enumerable: true,
    configurable: true
  });
  return Aaa;
})();
var Bbb = (function () {
  function Bbb () {
  }
  return Bbb;
})();

var b = new Bbb();
b.item = new Aaa('0', '00');
b.items = [];
b.items.push({ a: new Aaa('1', '2') });
b.items.push({ a: new Aaa('3', '4') });

(b);


================================================
FILE: test/_files/uses_props_from_view_prototype.mustache
================================================
[{{ item.x }};{{ item.y }}]||{{#items}}[{{ a.x }};{{ a.y }} {{#a}}{{y}}{{/a}}]{{/items}}

================================================
FILE: test/_files/uses_props_from_view_prototype.txt
================================================
[0;00]||[1;2 2][3;4 4]

================================================
FILE: test/_files/whitespace.js
================================================
({
  tag1: 'Hello',
  tag2: 'World'
});


================================================
FILE: test/_files/whitespace.mustache
================================================
{{tag1}}


{{tag2}}.


================================================
FILE: test/_files/whitespace.txt
================================================
Hello


World.


================================================
FILE: test/_files/zero_view.js
================================================
({ nums: [0, 1, 2] });


================================================
FILE: test/_files/zero_view.mustache
================================================
{{#nums}}{{.}},{{/nums}}

================================================
FILE: test/_files/zero_view.txt
================================================
0,1,2,

================================================
FILE: test/cli-test.js
================================================
require('./helper');

var fs = require('fs');
var path = require('path');
var child_process = require('child_process');
var _files = path.join(__dirname, '_files');
var cliTxt = path.resolve(_files, 'cli.txt');
var cliPartialsTxt = path.resolve(_files, 'cli_with_partials.txt');
var moduleVersion = require('../package').version;

function changeForOS (command) {
  var requireFlag = !isLegacyNodeVersion ? '--require esm' : '';
  command = command.replace('bin/mustache', 'node ' + requireFlag + ' bin/mustache');

  if (process.platform === 'win32') {
    return command
      .replace(/\bcat\b/g, 'type')
      .replace(/\//g, '\\');
  }

  return command;
}

function exec () {
  arguments[0] = changeForOS(arguments[0]);
  return child_process.exec.apply(child_process, arguments);
}

describe('Mustache CLI', function () {

  var expectedOutput;

  it('writes syntax hints into stderr when runned with wrong number of arguments', function (done) {
    exec('bin/mustache', function (err, stdout, stderr) {
      assert.notEqual(stderr.indexOf('Syntax'), -1);
      done();
    });
  });

  it('writes hints about JSON parsing errors when given invalid JSON', function (done) {
    exec('echo {name:"lebron"} | bin/mustache - test/_files/cli.mustache', function (err, stdout, stderr) {
      assert.notEqual(stderr.indexOf('Shooot, could not parse view as JSON'), -1);
      done();
    });
  });

  it('writes module version into stdout when runned with --version', function (done){
    exec('bin/mustache --version', function (err, stdout, stderr) {
      assert.notEqual(stdout.indexOf(moduleVersion), -1);
      done();
    });
  });

  it('writes module version into stdout when runned with -v', function (done){
    exec('bin/mustache -v', function (err, stdout, stderr) {
      assert.notEqual(stdout.indexOf(moduleVersion), -1);
      done();
    });
  });

  describe('without partials', function (){
    before(function (done) {
      fs.readFile(cliTxt, function onFsEnd (err, data) {
        if (err) return done(err);

        expectedOutput = data.toString();
        done();
      });
    });

    it('writes rendered template into stdout when successfull', function (done) {
      exec('bin/mustache test/_files/cli.json test/_files/cli.mustache', function (err, stdout, stderr) {
        assert.equal(err, null);
        assert.equal(stderr, '');
        assert.equal(stdout, expectedOutput);
        done();
      });
    });

    it('can handle view written in JavaScript with .js suffix', function (done) {
      exec('bin/mustache test/_files/cli.js test/_files/cli.mustache', function (err, stdout, stderr) {
        assert.equal(err, null);
        assert.equal(stderr, '');
        assert.equal(stdout, expectedOutput);
        done();
      });
    });

    it('can handle view written in JavaScript with .cjs suffix', function (done) {
      exec('bin/mustache test/_files/cli.cjs test/_files/cli.mustache', function (err, stdout, stderr) {
        assert.equal(err, null);
        assert.equal(stderr, '');
        assert.equal(stdout, expectedOutput);
        done();
      });
    });

    it('writes rendered template into the file specified by the third argument', function (done) {
      var outputFile = 'test/_files/cli_output.txt';
      exec('bin/mustache test/_files/cli.json test/_files/cli.mustache ' + outputFile, function (err, stdout, stderr) {
        assert.equal(err, null);
        assert.equal(stderr, '');
        assert.equal(stdout, '');
        assert.equal(fs.readFileSync(outputFile), expectedOutput);
        fs.unlinkSync('test/_files/cli_output.txt');
        done();
      });
    });

    it('reads view data from stdin when first argument equals "-"', function (done){
      exec('cat test/_files/cli.json | bin/mustache - test/_files/cli.mustache', function (err, stdout, stderr) {
        assert.equal(err, null);
        assert.equal(stderr, '');
        assert.equal(stdout, expectedOutput);
        done();
      });
    });

    it('writes it couldnt find template into stderr when second argument doesnt resolve to a file', function (done) {
      exec('bin/mustache test/_files/cli.json test/_files/non-existing-template.mustache', function (err, stdout, stderr) {
        assert.isOk(/Could not find file: .+non-existing-template\.mustache/.test(stderr));
        done();
      });
    });

    it('writes it couldnt find view into stderr when first argument doesnt resolve to a file', function (done) {
      exec('bin/mustache test/_files/non-existing-view.json test/_files/cli.mustache', function (err, stdout, stderr) {
        assert.isOk(/Could not find file: .+non-existing-view\.json/.test(stderr));
        done();
      });
    });
  });


  describe('with partials', function (){
    before(function (done) {
      fs.readFile(cliPartialsTxt, function onFsEnd (err, data) {
        if (err) return done(err);

        expectedOutput = data.toString();
        done();
      });
    });

    it('writes rendered template with partials into stdout', function (done) {
      exec('bin/mustache test/_files/cli_with_partials.json test/_files/cli_with_partials.mustache -p test/_files/cli.mustache -p test/_files/comments.mustache', function (err, stdout, stderr) {
        assert.equal(err, null);
        assert.equal(stderr, '');
        assert.equal(stdout, expectedOutput);
        done();
      });
    });

    it('writes rendered template with partials when partials args before required args', function (done) {
      exec('bin/mustache -p test/_files/cli.mustache -p test/_files/comments.mustache test/_files/cli_with_partials.json test/_files/cli_with_partials.mustache', function (err, stdout, stderr) {
        assert.equal(err, null);
        assert.equal(stderr, '');
        assert.equal(stdout, expectedOutput);
        done();
      });
    });
  });
});


================================================
FILE: test/context-test.js
================================================
require('./helper');
var Context = Mustache.Context;

describe('A new Mustache.Context', function () {
  var context;
  beforeEach(function () {
    context = new Context({ name: 'parent', message: 'hi', a: { b: 'b' } });
  });

  it('is able to lookup properties of its own view', function () {
    assert.equal(context.lookup('name'), 'parent');
  });

  it('is able to lookup nested properties of its own view', function () {
    assert.equal(context.lookup('a.b'), 'b');
  });

  describe('when pushed', function () {
    beforeEach(function () {
      context = context.push({ name: 'child', c: { d: 'd' } });
    });

    it('returns the child context', function () {
      assert.equal(context.view.name, 'child');
      assert.equal(context.parent.view.name, 'parent');
    });

    it('is able to lookup properties of its own view', function () {
      assert.equal(context.lookup('name'), 'child');
    });

    it("is able to lookup properties of the parent context's view", function () {
      assert.equal(context.lookup('message'), 'hi');
    });

    it('is able to lookup nested properties of its own view', function () {
      assert.equal(context.lookup('c.d'), 'd');
    });

    it('is able to lookup nested properties of its parent view', function () {
      assert.equal(context.lookup('a.b'), 'b');
    });
  });
});

describe('A Mustache.Context', function () {
  var context;

  describe('with an empty string in the lookup chain', function () {
    var view, context;
    beforeEach(function () {
      view = { a: '' };
      view.a.b = 'value';
      context = new Context(view);
    });

    it('is able to lookup a nested property', function () {
      assert.equal(context.lookup('a.b'), view.a.b);
    });
  });
});


================================================
FILE: test/create-browser-suite.js
================================================
require('./helper');

var renderHelper = require('./render-helper');

var fs = require('fs');
var path = require('path');

var _testsTemplate = path.join(__dirname, 'render-test-browser-tmpl.mustache');
var _templateContent = fs.readFileSync(_testsTemplate).toString();

var tests = renderHelper.getTests();
var content = Mustache.render(_templateContent, JSON.stringify(tests));

fs.writeFileSync(path.join(__dirname, 'render-test-browser.js'), content);

================================================
FILE: test/helper.js
================================================
var chai = require('chai');
var isRunningInNode = process !== undefined && process.versions.node !== undefined;

if (isRunningInNode) {
  var nodejsMajorVersion = Number(process.versions.node.split('.')[0]);
  isLegacyNodeVersion = !(nodejsMajorVersion >= 10);

  if (!isLegacyNodeVersion) {
    // The `zuul` package we use to run tests in browsers via Saucelabs eagerly loads all
    // packages it sees being used via `require()`. Because we don't want the `esm` package
    // to be loaded when running browser tests, we refer to `require()` via `module.require()`
    // because that avoid the mentioned eager loading
    module.require = module.require('esm')(module);
  }
}
assert = chai.assert;
chai.should();
Mustache = require('../mustache');


================================================
FILE: test/module-systems/.eslintrc
================================================
{
  "extends": "../.eslintrc",
  "parserOptions": {
    "ecmaVersion": 2017
  }
}


================================================
FILE: test/module-systems/_fixtures/amd.html
================================================
<!DOCTYPE html>
<html>
<head>
  <script src='https://unpkg.com/requirejs@2.3.6/require.js'></script>
  <script>
    require.config({
      paths: {
        mustache: '../../../mustache'
      }
    });

    // Placed here rather in the -test.js file because it makes debugging in
    // a local browser simpler because this .html file can be opened by double
    // clicking the file and inspecting any errors/unexpected results
    requirejs(['mustache'], Mustache => {
        document.body.textContent = Mustache.render(
          '{{title}} spends {{calc}}',
          {
            title: 'Joe',
            calc: () => 2 + 4
          });
      });
  </script>
</head>
<body>Text content to be overwritten<body>
</html>


================================================
FILE: test/module-systems/_fixtures/global-scope.html
================================================
<!DOCTYPE html>
<html>
<head>
  <script src='../../../mustache.js'></script>
</head>
<body>Text content to be overwritten<body>
<script>
  document.body.textContent = Mustache.render(
    '{{title}} spends {{calc}}',
    {
      title: 'Joe',
      calc: () => 2 + 4
    });
</script>
</html>


================================================
FILE: test/module-systems/browser-test.js
================================================
const fs = require('fs');
const path = require('path');
const puppeteer = require('puppeteer');
const chai = require('chai');

const mustache = fs.readFileSync(path.join(__dirname, '../../mustache.js'), 'utf8');

describe('Browser usage', () => {

  let browser;
  let page;

  before(async function () {
    this.timeout(10 * 1000);

    // Awkward .launch() options below are needed to avoid hitting timeouts
    // when tests are run in GitHub Actions for some weird reason
    // https://github.com/GoogleChrome/puppeteer/issues/4617
    browser = await puppeteer.launch({ignoreDefaultArgs: ['--disable-extensions']});

    page = await browser.newPage();
    page.on('console', msg => console.log('PAGE LOG:', msg.text()));
    page.on('pageerror', err => console.error('PAGE ERROR:', err));
  });

  after(() => browser.close());

  it('is exposed on the global scope as window.Mustache', async () => {
    await page.goto(`file://${path.join(__dirname, '_fixtures/global-scope.html')}`);

    const bodyElement = await page.$('body');
    const textContentProperty = await bodyElement.getProperty('textContent');
    const value = await textContentProperty.jsonValue();

    chai.assert.equal(value.trim(), 'Joe spends 6');
  });

  it('is exposed as AMD and consumable via RequireJS', async function () {
    this.timeout(10 * 1000);

    await page.goto(`file://${path.join(__dirname, '_fixtures/amd.html')}`, { waitUntil: 'networkidle0' });

    const bodyElement = await page.$('body');
    const textContentProperty = await bodyElement.getProperty('textContent');
    const value = await textContentProperty.jsonValue();

    chai.assert.equal(value, 'Joe spends 6');
  });
});


================================================
FILE: test/module-systems/commonjs-test.js
================================================
const assert = require('assert');
const mustache = require('mustache');

const view = {
  title: 'Joe',
  calc: () => 2 + 4
};

assert.strictEqual(
  mustache.render('{{title}} spends {{calc}}', view),
  'Joe spends 6'
);


================================================
FILE: test/module-systems/deno-test.ts
================================================
import { assertEquals } from "https://deno.land/std@0.51.0/testing/asserts.ts";
import mustache from "../../mustache.mjs";

const view = {
  title: "Joe",
  calc: function() {
    return 2 + 4;
  }
};

Deno.test("can use mustache", () => {
  assertEquals(
    mustache.render("{{title}} spends {{calc}}", view),
    "Joe spends 6"
  );
});


================================================
FILE: test/module-systems/esm-test-exports.mjs
================================================
import assert from 'assert';
import mustache from 'mustache';

const view = {
  title: 'Joe',
  calc: () => 2 + 4
};

assert.strictEqual(
  mustache.render('{{title}} spends {{calc}}', view),
  'Joe spends 6'
);


================================================
FILE: test/module-systems/esm-test.mjs
================================================
import assert from 'assert';
import mustache from 'mustache/mustache.mjs';

const view = {
  title: 'Joe',
  calc: () => 2 + 4
};

assert.strictEqual(
  mustache.render('{{title}} spends {{calc}}', view),
  'Joe spends 6'
);


================================================
FILE: test/mustache-spec-test.js
================================================
require('./helper');

var fs = require('fs');
var path = require('path');
var specsDir = path.join(__dirname, 'spec/specs');

var skipTests = {
  comments: [
    'Standalone Without Newline'
  ],
  delimiters: [
    'Standalone Without Newline'
  ],
  inverted: [
    'Standalone Without Newline'
  ],
  partials: [
    'Standalone Without Previous Line',
    'Standalone Without Newline'
  ],
  sections: [
    'Standalone Without Newline'
  ],
  '~lambdas': [
    'Interpolation',
    'Interpolation - Expansion',
    'Interpolation - Alternate Delimiters',
    'Interpolation - Multiple Calls',
    'Escaping',
    'Section - Expansion',
    'Section - Alternate Delimiters'
  ]
};

// You can run the skipped tests by setting the NOSKIP environment variable to
// true (e.g. NOSKIP=true mocha test/mustache-spec-test.js)
var noSkip = process.env.NOSKIP;

// You can put the name of a specific test file to run in the TEST environment
// variable (e.g. TEST=interpolation mocha test/mustache-spec-test.js)
var fileToRun = process.env.TEST;

// Mustache should work on node 0.6 that doesn't have fs.existsSync
function existsDir (path) {
  try {
    return fs.statSync(path).isDirectory();
  } catch (x) {
    return false;
  }
}

var specFiles;
if (fileToRun) {
  specFiles = [fileToRun];
} else if (existsDir(specsDir)) {
  specFiles = fs.readdirSync(specsDir).filter(function (file) {
    return (/\.json$/).test(file);
  }).map(function (file) {
    return path.basename(file).replace(/\.json$/, '');
  }).sort();
} else {
  specFiles = [];
}

function getSpecs (specArea) {
  return JSON.parse(fs.readFileSync(path.join(specsDir, specArea + '.' + 'json'), 'utf8'));
}

describe('Mustache spec compliance', function () {
  beforeEach(function () {
    Mustache.clearCache();
  });

  specFiles.forEach(function (specArea) {
    describe('- ' + specArea + ':', function () {
      var specs = getSpecs(specArea);
      specs.tests.forEach(function (test) {
        var it_ = (!noSkip && skipTests[specArea] && skipTests[specArea].indexOf(test.name) >= 0) ? it.skip : it;
        it_(test.name + ' - ' + test.desc, function () {
          if (test.data.lambda && test.data.lambda.__tag__ === 'code')
            test.data.lambda = eval('(function() { return ' + test.data.lambda.js + '; })');
          var output = Mustache.render(test.template, test.data, test.partials);
          assert.equal(output, test.expected);
        });
      });
    });
  });
});


================================================
FILE: test/parse-test.js
================================================
require('./helper');

// A map of templates to their expected token output. Tokens are in the format:
// [type, value, startIndex, endIndex, subTokens].
var expectations = {
  ''                                        : [],
  '{{hi}}'                                  : [ [ 'name', 'hi', 0, 6 ] ],
  '{{hi.world}}'                            : [ [ 'name', 'hi.world', 0, 12 ] ],
  '{{hi . world}}'                          : [ [ 'name', 'hi . world', 0, 14 ] ],
  '{{ hi}}'                                 : [ [ 'name', 'hi', 0, 7 ] ],
  '{{hi }}'                                 : [ [ 'name', 'hi', 0, 7 ] ],
  '{{ hi }}'                                : [ [ 'name', 'hi', 0, 8 ] ],
  '{{{hi}}}'                                : [ [ '&', 'hi', 0, 8 ] ],
  '{{!hi}}'                                 : [ [ '!', 'hi', 0, 7 ] ],
  '{{! hi}}'                                : [ [ '!', 'hi', 0, 8 ] ],
  '{{! hi }}'                               : [ [ '!', 'hi', 0, 9 ] ],
  '{{ !hi}}'                                : [ [ '!', 'hi', 0, 8 ] ],
  '{{ ! hi}}'                               : [ [ '!', 'hi', 0, 9 ] ],
  '{{ ! hi }}'                              : [ [ '!', 'hi', 0, 10 ] ],
  'a\n b'                                   : [ [ 'text', 'a\n b', 0, 4 ] ],
  'a{{hi}}'                                 : [ [ 'text', 'a', 0, 1 ], [ 'name', 'hi', 1, 7 ] ],
  'a {{hi}}'                                : [ [ 'text', 'a ', 0, 2 ], [ 'name', 'hi', 2, 8 ] ],
  ' a{{hi}}'                                : [ [ 'text', ' a', 0, 2 ], [ 'name', 'hi', 2, 8 ] ],
  ' a {{hi}}'                               : [ [ 'text', ' a ', 0, 3 ], [ 'name', 'hi', 3, 9 ] ],
  'a{{hi}}b'                                : [ [ 'text', 'a', 0, 1 ], [ 'name', 'hi', 1, 7 ], [ 'text', 'b', 7, 8 ] ],
  'a{{hi}} b'                               : [ [ 'text', 'a', 0, 1 ], [ 'name', 'hi', 1, 7 ], [ 'text', ' b', 7, 9 ] ],
  'a{{hi}}b '                               : [ [ 'text', 'a', 0, 1 ], [ 'name', 'hi', 1, 7 ], [ 'text', 'b ', 7, 9 ] ],
  'a\n{{hi}} b \n'                          : [ [ 'text', 'a\n', 0, 2 ], [ 'name', 'hi', 2, 8 ], [ 'text', ' b \n', 8, 12 ] ],
  'a\n {{hi}} \nb'                          : [ [ 'text', 'a\n ', 0, 3 ], [ 'name', 'hi', 3, 9 ], [ 'text', ' \nb', 9, 12 ] ],
  'a\n {{!hi}} \nb'                         : [ [ 'text', 'a\n', 0, 2 ], [ '!', 'hi', 3, 10 ], [ 'text', 'b', 12, 13 ] ],
  'a\n{{#a}}{{/a}}\nb'                      : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 2, 8, [], 8 ], [ 'text', 'b', 15, 16 ] ],
  'a\n {{#a}}{{/a}}\nb'                     : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [], 9 ], [ 'text', 'b', 16, 17 ] ],
  'a\n {{#a}}{{/a}} \nb'                    : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [], 9 ], [ 'text', 'b', 17, 18 ] ],
  'a\n{{#a}}\n{{/a}}\nb'                    : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 2, 8, [], 9 ], [ 'text', 'b', 16, 17 ] ],
  'a\n {{#a}}\n{{/a}}\nb'                   : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [], 10 ], [ 'text', 'b', 17, 18 ] ],
  'a\n {{#a}}\n{{/a}} \nb'                  : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [], 10 ], [ 'text', 'b', 18, 19 ] ],
  'a\n{{#a}}\n{{/a}}\n{{#b}}\n{{/b}}\nb'    : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 2, 8, [], 9 ], [ '#', 'b', 16, 22, [], 23 ], [ 'text', 'b', 30, 31 ] ],
  'a\n {{#a}}\n{{/a}}\n{{#b}}\n{{/b}}\nb'   : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [], 10 ], [ '#', 'b', 17, 23, [], 24 ], [ 'text', 'b', 31, 32 ] ],
  'a\n {{#a}}\n{{/a}}\n{{#b}}\n{{/b}} \nb'  : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [], 10 ], [ '#', 'b', 17, 23, [], 24 ], [ 'text', 'b', 32, 33 ] ],
  'a\n{{#a}}\n{{#b}}\n{{/b}}\n{{/a}}\nb'    : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 2, 8, [ [ '#', 'b', 9, 15, [], 16 ] ], 23 ], [ 'text', 'b', 30, 31 ] ],
  'a\n {{#a}}\n{{#b}}\n{{/b}}\n{{/a}}\nb'   : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [ [ '#', 'b', 10, 16, [], 17 ] ], 24 ], [ 'text', 'b', 31, 32 ] ],
  'a\n {{#a}}\n{{#b}}\n{{/b}}\n{{/a}} \nb'  : [ [ 'text', 'a\n', 0, 2 ], [ '#', 'a', 3, 9, [ [ '#', 'b', 10, 16, [], 17 ] ], 24 ], [ 'text', 'b', 32, 33 ] ],
  '{{>abc}}'                                : [ [ '>', 'abc', 0, 8, '', 0, false ] ],
  '{{> abc }}'                              : [ [ '>', 'abc', 0, 10, '', 0, false ] ],
  '{{ > abc }}'                             : [ [ '>', 'abc', 0, 11, '', 0, false ] ],
  '  {{> abc }}\n'                          : [ [ '>', 'abc', 2, 12, '  ', 0, false ] ],
  '  {{> abc }} {{> abc }}\n'               : [ [ '>', 'abc', 2, 12, '  ', 0, false ], [ '>', 'abc', 13, 23, '   ', 1, false ] ],
  '{{ > abc }}'                             : [ [ '>', 'abc', 0, 11, '', 0, false ] ],
  '{{=<% %>=}}'                             : [ [ '=', '<% %>', 0, 11 ] ],
  '{{= <% %> =}}'                           : [ [ '=', '<% %>', 0, 13 ] ],
  '{{=<% %>=}}<%={{ }}=%>'                  : [ [ '=', '<% %>', 0, 11 ], [ '=', '{{ }}', 11, 22 ] ],
  '{{=<% %>=}}<%hi%>'                       : [ [ '=', '<% %>', 0, 11 ], [ 'name', 'hi', 11, 17 ] ],
  '{{#a}}{{/a}}hi{{#b}}{{/b}}\n'            : [ [ '#', 'a', 0, 6, [], 6 ], [ 'text', 'hi', 12, 14 ], [ '#', 'b', 14, 20, [], 20 ], [ 'text', '\n', 26, 27 ] ],
  '{{a}}\n{{b}}\n\n{{#c}}\n{{/c}}\n'        : [ [ 'name', 'a', 0, 5 ], [ 'text', '\n', 5, 6 ], [ 'name', 'b', 6, 11 ], [ 'text', '\n\n', 11, 13 ], [ '#', 'c', 13, 19, [], 20 ] ],
  '{{#foo}}\n  {{#a}}\n    {{b}}\n  {{/a}}\n{{/foo}}\n'
                                            : [ [ '#', 'foo', 0, 8, [ [ '#', 'a', 11, 17, [ [ 'text', '    ', 18, 22 ], [ 'name', 'b', 22, 27 ], [ 'text', '\n', 27, 28 ] ], 30 ] ], 37 ] ]
};

var originalTemplateCache;
before(function () {
  originalTemplateCache = Mustache.templateCache;
});

beforeEach(function (){
  Mustache.clearCache();
  Mustache.templateCache = originalTemplateCache;
});

describe('Mustache.parse', function () {

  for (var template in expectations) {
    (function (template, tokens) {
      it('knows how to parse ' + JSON.stringify(template), function () {
        assert.deepEqual(Mustache.parse(template), tokens);
      });
    })(template, expectations[template]);
  }

  describe('when there is an unclosed tag', function () {
    it('throws an error', function () {
      assert.throws(function () {
        Mustache.parse('My name is {{name');
      }, /unclosed tag at 17/i);
    });
  });

  describe('when there is an unclosed section', function () {
    it('throws an error', function () {
      assert.throws(function () {
        Mustache.parse('A list: {{#people}}{{name}}');
      }, /unclosed section "people" at 27/i);
    });
  });

  describe('when there is an unopened section', function () {
    it('throws an error', function () {
      assert.throws(function () {
        Mustache.parse('The end of the list! {{/people}}');
      }, /unopened section "people" at 21/i);
    });
  });

  describe('when invalid tags are given as an argument', function () {
    it('throws an error', function () {
      assert.throws(function () {
        Mustache.parse('A template <% name %>', [ '<%' ]);
      }, /invalid tags/i);
    });
  });

  describe('when the template contains invalid tags', function () {
    it('throws an error', function () {
      assert.throws(function () {
        Mustache.parse('A template {{=<%=}}');
      }, /invalid tags/i);
    });
  });

  describe('when parsing a template without tags specified followed by the same template with tags specified', function () {
    it('returns different tokens for the latter parse', function () {
      var template = '{{foo}}[bar]';
      var parsedWithBraces = Mustache.parse(template);
      var parsedWithBrackets = Mustache.parse(template, ['[', ']']);
      assert.notDeepEqual(parsedWithBrackets, parsedWithBraces);
    });
  });

  describe('when parsing a template with tags specified followed by the same template with different tags specified', function () {
    it('returns different tokens for the latter parse', function () {
      var template = '(foo)[bar]';
      var parsedWithParens = Mustache.parse(template, ['(', ')']);
      var parsedWithBrackets = Mustache.parse(template, ['[', ']']);
      assert.notDeepEqual(parsedWithBrackets, parsedWithParens);
    });
  });

  describe('when parsing a template after already having parsed that template with a different Mustache.tags', function () {
    it('returns different tokens for the latter parse', function () {
      var template = '{{foo}}[bar]';
      var parsedWithBraces = Mustache.parse(template);

      var oldTags = Mustache.tags;
      Mustache.tags = ['[', ']'];
      var parsedWithBrackets = Mustache.parse(template);
      Mustache.tags = oldTags;

      assert.notDeepEqual(parsedWithBrackets, parsedWithBraces);
    });
  });

  describe('when parsing a template with the same tags second time, return the cached tokens', function () {
    it('returns the same tokens for the latter parse', function () {
      var template = '{{foo}}[bar]';
      var parsedResult1 = Mustache.parse(template);
      var parsedResult2 = Mustache.parse(template);

      assert.deepEqual(parsedResult1, parsedResult2);
      assert.ok(parsedResult1 === parsedResult2);
    });
  });

  describe('when parsing a template with caching disabled and the same tags second time, do not return the cached tokens', function () {
    it('returns different tokens for the latter parse', function () {
      Mustache.templateCache = undefined;
      var template = '{{foo}}[bar]';
      var parsedResult1 = Mustache.parse(template);
      var parsedResult2 = Mustache.parse(template);

      assert.deepEqual(parsedResult1, parsedResult2);
      assert.ok(parsedResult1 !== parsedResult2);
    });
  });

  describe('when parsing a template with custom caching and the same tags second time, do not return the cached tokens', function () {
    it('returns the same tokens for the latter parse', function () {
      Mustache.templateCache = {
        _cache: [],
        set: function set (key, value) {
          this._cache.push([key, value]);
        },
        get: function get (key) {
          var cacheLength = this._cache.length;
          for (var i = 0; i < cacheLength; i++) {
            var entry = this._cache[i];
            if (entry[0] === key) {
              return entry[1];
            }
          }
          return undefined;
        },
        clear: function clear () {
          this._cache = [];
        }
      };

      var template = '{{foo}}[bar]';
      var parsedResult1 = Mustache.parse(template);
      var parsedResult2 = Mustache.parse(template);

      assert.deepEqual(parsedResult1, parsedResult2);
      assert.ok(parsedResult1 === parsedResult2);
    });
  });

});


================================================
FILE: test/partial-test.js
================================================
/* eslint-disable func-names */
require('./helper');

describe('Partials spec', function () {
  beforeEach(function () {
    Mustache.clearCache();
  });

  
    it('The greater-than operator should expand to the named partial.', function () {
      var template = '"{{>text}}"';
      var data = {};
      var partials = {'text':'from partial'};
      var expected = '"from partial"';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });
    it('The empty string should be used when the named partial is not found.', function () {
      var template = '"{{>text}}"';
      var data = {};
      var partials = {};
      var expected = '""';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });
    it('The greater-than operator should operate within the current context.', function () {
      var template = '"{{>partial}}"';
      var data = {'text':'content'};
      var partials = {'partial':'*{{text}}*'};
      var expected = '"*content*"';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });
    it('Inline partials should not be indented', function () {
      var template = '    <div>{{> partial}}</div>';
      var data = {};
      var partials = {'partial':'This is a partial.'};
      var expected = '    <div>This is a partial.</div>';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });

    it('Inline partials should not be indented (multiline)', function () {
      var template = '    <div>{{> partial}}</div>';
      var data = {};
      var partials = {'partial':'This is a\npartial.'};
      var expected = '    <div>This is a\n         partial.</div>';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });

    it('The greater-than operator should properly recurse.', function () {
      var template = '{{>node}}';
      var data = {'content':'X','nodes':[{'content':'Y','nodes':[]}]};
      var partials = {'node':'{{content}}<{{#nodes}}{{>node}}{{/nodes}}>'};
      var expected = 'X<Y<>>';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });
    it('The greater-than operator should not alter surrounding whitespace.', function () {
      var template = '| {{>partial}} |';
      var data = {};
      var partials = {'partial':'\t|\t'};
      var expected = '| \t|\t |';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });
    it('"\r\n" should be considered a newline for standalone tags.', function () {
      var template = '|\r\n{{>partial}}\r\n|';
      var data = {};
      var partials = {'partial':'>'};
      var expected = '|\r\n>|';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });
    it('Standalone tags should not require a newline to precede them.', function () {
      var template = '  {{>partial}}\n>';
      var data = {};
      var partials = {'partial':'>\n>'};
      var expected = '  >\n  >>';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });   
    it('Superfluous in-tag whitespace should be ignored.', function () {
      var template = '|{{> partial }}|';
      var data = {'boolean':true};
      var partials = {'partial':'[]'};
      var expected = '|[]|';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });
    it('Each line of the partial should be indented before rendering.', function () {
      var template = '\\\n {{>partial}}\n/\n';
      var data = {
				'content': '<\n->'
			};
      var partials =  {
				'partial': '|\n{{{content}}}\n|\n'
			};
      var expected = '\\\n |\n <\n->\n |\n/\n';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });

    it('Standalone tags should not require a newline to follow them.', function () {
      var template = '>\n  {{>partial}}';
      var data = {
			
			};
      var partials =  {
				'partial': '>\n>'
			};
      var expected = '>\n  >\n  >';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });

    it('Whitespace should be left untouched.', function () {
      var template = '  {{data}}  {{> partial}}\n';
      var data = {
        'data': '|'
			};
      var partials =  {
				'partial': '>\n>'
			};
      var expected = '  |  >\n>\n';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });

    it('Partial without indentation should inherit functions.', function () {
      var template = '{{> partial }}';
      var data = {
        toUpperCase: function () {
              return function (label) {
                      return label.toUpperCase();
              };
        }
      };
      var partials = {partial: 'aA-{{ #toUpperCase }}Input{{ /toUpperCase }}-Aa'};
      var expected = 'aA-INPUT-Aa';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });

    it('Partial with indentation should inherit functions.', function () {
      var template = '  {{> partial }}';
      var data = {
        toUpperCase: function () {
              return function (label) {
                      return label.toUpperCase();
              };
        }
      };
      var partials = {partial: 'aA-{{ #toUpperCase }}Input{{ /toUpperCase }}-Aa'};
      var expected = '  aA-INPUT-Aa';
      var renderResult = Mustache.render(template, data, partials);
      assert.equal(renderResult, expected);
    });

    it('Nested partials should support custom delimiters.', function () {
      var tags = ['[[', ']]'];
      var template = '[[> level1 ]]';
      var partials = {
        level1: 'partial 1\n[[> level2]]',
        level2: 'partial 2\n[[> level3]]',
        level3: 'partial 3\n[[> level4]]',
        level4: 'partial 4\n[[> level5]]',
        level5: 'partial 5',
      };
      var expected = 'partial 1\npartial 2\npartial 3\npartial 4\npartial 5';
      var renderResult = Mustache.render(template, {}, partials, tags);
      assert.equal(renderResult, expected);
    });
});


================================================
FILE: test/render-helper.js
================================================
var fs = require('fs');
var path = require('path');

var _files = path.join(__dirname, '_files');

function getContents (testName, ext) {
  try {
    return fs.readFileSync(path.join(_files, testName + '.' + ext), 'utf8');
  } catch (ex) {
    return null;
  }
}

function getView (testName) {
  var view = getContents(testName, 'js');
  if (!view) view = getContents(testName, 'cjs');
  if (!view) throw new Error('Cannot find view for test "' + testName + '"');
  return view;
}

function getPartial (testName) {
  try {
    return getContents(testName, 'partial');
  } catch (error) {
    // No big deal. Not all tests need to test partial support.
  }
}

// You can put the name of a specific test to run in the TEST environment
// variable (e.g. TEST=backslashes mocha test/render-test.js)
var testToRun = process.env.TEST;

var testNames;
if (testToRun) {
  testNames = testToRun.split(',');
} else {
  testNames = fs.readdirSync(_files).filter(function (file) {
    return (/\.c?js$/).test(file);
  }).map(function (file) {
    return path.basename(file).replace(/\.c?js$/, '');
  });
}

function getTest (testName) {
  return {
    name: testName,
    view: getView(testName),
    template: getContents(testName, 'mustache'),
    partial: getPartial(testName),
    expect: getContents(testName, 'txt')
  };
}

exports.getTests = function getTests () {
  return testNames.map(getTest);
};

================================================
FILE: test/render-test-browser-tmpl.mustache
================================================
/* eslint-disable */
require('./helper');

describe('Mustache.render', function () {
  beforeEach(function () {
    Mustache.clearCache();
  });

  it('requires template to be a string', function () {
    assert.throws(function () {
      Mustache.render(['dummy template'], ['foo', 'bar']);
    }, TypeError, 'Invalid template! Template should be a "string" but ' +
                  '"array" was given as the first argument ' +
                  'for mustache#render(template, view, partials)');
  });

  var i;
  var tests = {{{.}}};

  for (i = 0; i < tests.length; i++) {

    (function indexClosure(test) {
        var view = eval(test.view);

        it('knows how to render ' + test.name, function () {

          var output;
          if (test.partial) {
            output = Mustache.render(test.template, view, { partial: test.partial });
          } else {
            output = Mustache.render(test.template, view);
          }

          assert.equal(output, test.expect);
        });
    })(tests[i]);

  }
});

================================================
FILE: test/render-test.js
================================================
require('./helper');

var renderHelper = require('./render-helper');

var tests = renderHelper.getTests();

describe('Mustache.render', function () {
  beforeEach(function () {
    Mustache.clearCache();
  });

  it('requires template to be a string', function () {
    assert.throws(function () {
      Mustache.render(['dummy template'], ['foo', 'bar']);
    }, TypeError, 'Invalid template! Template should be a "string" but ' +
                  '"array" was given as the first argument ' +
                  'for mustache#render(template, view, partials)');
  });

  describe('custom tags', function () {
    it('uses tags argument instead of Mustache.tags when given', function () {
      var template = '<<placeholder>>bar{{placeholder}}';

      Mustache.tags = ['{{', '}}'];
      assert.equal(Mustache.render(template, { placeholder: 'foo' }, {}, ['<<', '>>']), 'foobar{{placeholder}}');
    });
    
    it('uses config.tags argument instead of Mustache.tags when given', function () {
      var template = '<<placeholder>>bar{{placeholder}}';

      Mustache.tags = ['{{', '}}'];
      assert.equal(Mustache.render(template, { placeholder: 'foo' }, {}, { tags: ['<<', '>>']}),  'foobar{{placeholder}}');
    });

    it('uses tags argument instead of Mustache.tags when given, even when it previously rendered the template using Mustache.tags', function () {
      var template = '((placeholder))bar{{placeholder}}';

      Mustache.tags = ['{{', '}}'];
      Mustache.render(template, { placeholder: 'foo' });
      assert.equal(Mustache.render(template, { placeholder: 'foo' }, {}, ['((', '))']), 'foobar{{placeholder}}');
    });
    
    it('uses config.tags argument instead of Mustache.tags when given, even when it previously rendered the template using Mustache.tags', function () {
      var template = '((placeholder))bar{{placeholder}}';

      Mustache.tags = ['{{', '}}'];
      Mustache.render(template, { placeholder: 'foo' });
      assert.equal(Mustache.render(template, { placeholder: 'foo' }, {}, { tags: ['((', '))'] }), 'foobar{{placeholder}}');
    });

    it('uses tags argument instead of Mustache.tags when given, even when it previously rendered the template using different tags', function () {
      var template = '[[placeholder]]bar<<placeholder>>';

      Mustache.render(template, { placeholder: 'foo' }, {}, ['<<', '>>']);
      assert.equal(Mustache.render(template, { placeholder: 'foo' }, {}, ['[[', ']]']), 'foobar<<placeholder>>');
    });
    
    it('uses config.tags argument instead of Mustache.tags when given, even when it previously rendered the template using different tags', function () {
      var template = '[[placeholder]]bar<<placeholder>>';

      Mustache.render(template, { placeholder: 'foo' }, {}, ['<<', '>>']);
      assert.equal(Mustache.render(template, { placeholder: 'foo' }, {}, { tags: ['[[', ']]'] }), 'foobar<<placeholder>>');
    });

    it('does not mutate Mustache.tags when given tags argument', function () {
      var correctMustacheTags = ['{{', '}}'];
      Mustache.tags = correctMustacheTags;

      Mustache.render('((placeholder))', { placeholder: 'foo' }, {}, ['((', '))']);

      assert.equal(Mustache.tags, correctMustacheTags);
      assert.deepEqual(Mustache.tags, ['{{', '}}']);
    });
    
    it('does not mutate Mustache.tags when given config.tags argument', function () {
      var correctMustacheTags = ['{{', '}}'];
      Mustache.tags = correctMustacheTags;

      Mustache.render('((placeholder))', { placeholder: 'foo' }, {}, { tags: ['((', '))'] });

      assert.equal(Mustache.tags, correctMustacheTags);
      assert.deepEqual(Mustache.tags, ['{{', '}}']);
    });

    it('uses provided tags when rendering partials', function () {
      var output = Mustache.render('<%> partial %>', { name: 'Santa Claus' }, {
        partial: '<% name %>'
      }, ['<%', '%>']);

      assert.equal(output, 'Santa Claus');
    });
    
    it('uses provided config.tags when rendering partials', function () {
      var output = Mustache.render('<%> partial %>', { name: 'Santa Claus' }, {
        partial: '<% name %>'
      }, { tags: ['<%', '%>'] }); 

      assert.equal(output, 'Santa Claus');
    });
    
    it('uses config.escape argument instead of Mustache.escape when given', function () {
      var template = 'Hello, {{placeholder}}';
      
      function escapeBang (text) {
        return text + '!';
      }
      assert.equal(Mustache.render(template, { placeholder: 'world' }, {}, { escape: escapeBang }), 'Hello, world!');
    });

    it('uses config.escape argument instead of Mustache.escape when given, even when it previously rendered the template using Mustache.escape', function () {
      var template = 'Hello, {{placeholder}}';
      
      function escapeQuestion (text) {
        return text + '?';
      }
      Mustache.render(template, { placeholder: 'world' });
      assert.equal(Mustache.render(template, { placeholder: 'world' }, {}, { escape: escapeQuestion }), 'Hello, world?');
    });

    it('uses config.escape argument instead of Mustache.escape when given, even when it previously rendered the template using a different escape function', function () {
      var template = 'Hello, {{placeholder}}';
      
      function escapeQuestion (text) {
        return text + '?';
      }
      function escapeBang (text) {
        return text + '!';
      }
      Mustache.render(template, { placeholder: 'foo' }, {}, { escape: escapeQuestion });
      assert.equal(Mustache.render(template, { placeholder: 'foo' }, {}, { escape: escapeBang }), 'Hello, foo!');
    });
    
    it('does not mutate Mustache.escape when given config.escape argument', function () {
      var correctMustacheEscape = Mustache.escape;

      function escapeNone (text) {
        return text;
      }
      Mustache.render('((placeholder))', { placeholder: 'foo' }, {}, { escape: escapeNone });

      assert.equal(Mustache.escape, correctMustacheEscape);
      assert.equal(Mustache.escape('>&'), '&gt;&amp;');
    });
    
    it('uses provided config.escape when rendering partials', function () {
      function escapeDoubleAmpersand (text) {
        return text.replace('&', '&&');
      }
      var output = Mustache.render('{{> partial }}', { name: 'Ampersand &' }, {
        partial: '{{ name }}'
      }, { escape: escapeDoubleAmpersand }); 

      assert.equal(output, 'Ampersand &&');
    });
    
    it('uses config.tags and config.escape arguments instead of Mustache.tags and Mustache.escape when given', function () {
      var template = 'Hello, {{placeholder}} [[placeholder]]';
      
      function escapeTwoBangs (text) {
        return text + '!!';
      }
      var config = {
        tags: ['[[', ']]'],
        escape: escapeTwoBangs,
      };
      assert.equal(Mustache.render(template, { placeholder: 'world' }, {}, config), 'Hello, {{placeholder}} world!!');
    });
    
    it('uses provided config.tags and config.escape when rendering partials', function () {
      function escapeDoubleAmpersand (text) {
        return text.replace('&', '&&');
      }
      var config = {
        tags: ['[[', ']]'],
        escape: escapeDoubleAmpersand
      };
      var output = Mustache.render('[[> partial ]]', { name: 'Ampersand &' }, {
        partial: '[[ name ]]'
      }, config); 

      assert.equal(output, 'Ampersand &&');
    });
    
    it('uses provided config.tags and config.escape when rendering sections', function () {
      var template = (
        '<[[&value-raw]]: ' +
        '[[#test-1]][[value-1]][[/test-1]]' +
        '[[^test-2]][[value-2]][[/test-2]], ' +
        '[[#test-lambda]][[value-lambda]][[/test-lambda]]' +
        '>'
      );
      
      function escapeQuotes (text) {
        return '"' + text + '"';
      }
      var config = {
        tags: ['[[', ']]'],
        escape: escapeQuotes
      };
      var viewTestTrue = {
        'value-raw': 'foo',
        'test-1': true,
        'value-1': 'abc',
        'test-2': true,
        'value-2': '123',
        'test-lambda': function () {
          return function (text, render) { return 'lambda: ' + render(text); };
        },
        'value-lambda': 'bar'
      };
      var viewTestFalse = {
        'value-raw': 'foo',
        'test-1': false,
        'value-1': 'abc',
        'test-2': false,
        'value-2': '123',
        'test-lambda': function () {
          return function (text, render) { return 'lambda: ' + render(text); };
        },
        'value-lambda': 'bar'
      };
      var outputTrue = Mustache.render(template, viewTestTrue, {}, config); 
      var outputFalse = Mustache.render(template, viewTestFalse, {}, config); 

      assert.equal(outputTrue, '<foo: "abc", lambda: "bar">');
      assert.equal(outputFalse, '<foo: "123", lambda: "bar">');
    });
  });

  tests.forEach(function (test) {
    var view = eval(test.view);

    it('knows how to render ' + test.name, function () {
      var output;
      if (test.partial) {
        output = Mustache.render(test.template, view, { partial: test.partial });
      } else {
        output = Mustache.render(test.template, view);
      }

      output.should.equal(test.expect);
    });

  });
});


================================================
FILE: test/scanner-test.js
================================================
require('./helper');
var Scanner = Mustache.Scanner;

describe('A new Mustache.Scanner', function () {
  describe('for an empty string', function () {
    it('is at the end', function () {
      var scanner = new Scanner('');
      assert(scanner.eos());
    });
  });

  describe('for a non-empty string', function () {
    var scanner;
    beforeEach(function () {
      scanner = new Scanner('a b c');
    });

    describe('scan', function () {
      describe('when the RegExp matches the entire string', function () {
        it('returns the entire string', function () {
          var match = scanner.scan(/a b c/);
          assert.equal(match, scanner.string);
          assert(scanner.eos());
        });
      });

      describe('when the RegExp matches at index 0', function () {
        it('returns the portion of the string that matched', function () {
          var match = scanner.scan(/a/);
          assert.equal(match, 'a');
          assert.equal(scanner.pos, 1);
        });
      });

      describe('when the RegExp matches at some index other than 0', function () {
        it('returns the empty string', function () {
          var match = scanner.scan(/b/);
          assert.equal(match, '');
          assert.equal(scanner.pos, 0);
        });
      });

      describe('when the RegExp does not match', function () {
        it('returns the empty string', function () {
          var match = scanner.scan(/z/);
          assert.equal(match, '');
          assert.equal(scanner.pos, 0);
        });
      });
    }); // scan

    describe('scanUntil', function () {
      describe('when the RegExp matches at index 0', function () {
        it('returns the empty string', function () {
          var match = scanner.scanUntil(/a/);
          assert.equal(match, '');
          assert.equal(scanner.pos, 0);
        });
      });

      describe('when the RegExp matches at some index other than 0', function () {
        it('returns the string up to that index', function () {
          var match = scanner.scanUntil(/b/);
          assert.equal(match, 'a ');
          assert.equal(scanner.pos, 2);
        });
      });

      describe('when the RegExp does not match', function () {
        it('returns the entire string', function () {
          var match = scanner.scanUntil(/z/);
          assert.equal(match, scanner.string);
          assert(scanner.eos());
        });
      });
    }); // scanUntil
  }); // for a non-empty string
});


================================================
FILE: wrappers/dojo/mustache.js.post
================================================

  dojox.mustache = dojo.hitch(Mustache, "render");

})();

================================================
FILE: wrappers/dojo/mustache.js.pre
================================================
/*
Shameless port of a shameless port
@defunkt => @janl => @aq => @voodootikigod
 
See http://github.com/defunkt/mustache for more info.
*/

dojo.provide("dojox.mustache._base");
(function(){


================================================
FILE: wrappers/jquery/mustache.js.post
================================================
  $.mustache = function (template, view, partials) {
    return Mustache.render(template, view, partials);
  };

  $.fn.mustache = function (view, partials) {
    return $(this).map(function (i, elm) {
      var template = $.trim($(elm).html());
      var output = $.mustache(template, view, partials);
      return $(output).get();
    });
  };

})(jQuery);


================================================
FILE: wrappers/jquery/mustache.js.pre
================================================
/*
Shameless port of a shameless port
@defunkt => @janl => @aq
 
See http://github.com/defunkt/mustache for more info.
*/
 
;(function($) {



================================================
FILE: wrappers/mootools/mustache.js.post
================================================

    Object.implement('mustache', function(view, partials){
        return Mustache.render(view, this, partials);
    });
})();


================================================
FILE: wrappers/mootools/mustache.js.pre
================================================
(function(){



================================================
FILE: wrappers/qooxdoo/mustache.js.post
================================================
/**
 * Above is the original mustache code.
 */

// EXPOSE qooxdoo variant
qx.bom.Template.version = this.Mustache.version;
qx.bom.Template.render = this.Mustache.render;

}).call({});

================================================
FILE: wrappers/qooxdoo/mustache.js.pre
================================================
/* ************************************************************************

   qooxdoo - the new era of web development

   http://qooxdoo.org

   Copyright:
     2004-2012 1&1 Internet AG, Germany, http://www.1und1.de

   License:
     LGPL: http://www.gnu.org/licenses/lgpl.html
     EPL: http://www.eclipse.org/org/documents/epl-v10.php
     See the LICENSE file in the project's top-level directory for details.

   Authors:
     * Martin Wittemann (martinwittemann)

   ======================================================================

   This class contains code based on the following work:

   * Mustache.js version 0.8.0

     Code:
       https://github.com/janl/mustache.js

     Copyright:
       (c) 2009 Chris Wanstrath (Ruby)
       (c) 2010 Jan Lehnardt (JavaScript)

     License:
       MIT: http://www.opensource.org/licenses/mit-license.php

   ----------------------------------------------------------------------

   Copyright (c) 2009 Chris Wanstrath (Ruby)
   Copyright (c) 2010 Jan Lehnardt (JavaScript)

   Permission is hereby granted, free of charge, to any person obtaining
   a copy of this software and associated documentation files (the
   "Software"), to deal in the Software without restriction, including
   without limitation the rights to use, copy, modify, merge, publish,
   distribute, sublicense, and/or sell copies of the Software, and to
   permit persons to whom the Software is furnished to do so, subject to
   the following conditions:

   The above copyright notice and this permission notice shall be
   included in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
   LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

************************************************************************ */

/**
 * The is a template class which can be used for HTML templating. In fact,
 * this is a wrapper for mustache.js which is a "framework-agnostic way to
 * render logic-free views".
 *
 * Here is a basic example how to use it:
 * Template:
 * <pre class="javascript">
 * var template = "Hi, my name is {{name}}!";
 * var view = {name: "qooxdoo"};
 * qx.bom.Template.render(template, view);
 * // return "Hi, my name is qooxdoo!"
 * </pre>
 *
 * For further details, please visit the mustache.js documentation here:
 *   https://github.com/janl/mustache.js/blob/master/README.md
 *
 * @ignore(module)
 */
qx.Bootstrap.define("qx.bom.Template", {
  statics : {
    /** Contains the mustache.js version. */
    version: null,

    /**
     * Original and only template method of mustache.js. For further
     * documentation, please visit https://github.com/janl/mustache.js
     *
     * @signature function(template, view, partials)
     * @param template {String} The String containing the template.
     * @param view {Object} The object holding the data to render.
     * @param partials {Object} Object holding parts of a template.
     * @return {String} The parsed template.
     */
    render: null,

    /**
     * Combines {@link #render} and {@link #get}. Input is equal to {@link #render}
     * and output is equal to {@link #get}. The advantage over {@link #get}
     * is that you don't need a HTML template but can use a template
     * string and still get a DOM element. Keep in mind that templates
     * can only have one root element.
     *
     * @param template {String} The String containing the template.
     * @param view {Object} The object holding the data to render.
     * @param partials {Object} Object holding parts of a template.
     * @return {Element} A DOM element holding the parsed template data.
     */
    renderToNode : function(template, view, partials) {
       var renderedTmpl = this.render(template, view, partials);
       return this._createNodeFromTemplate(renderedTmpl);
    },

    /**
     * Helper method which provides you with a direct access to templates
     * stored as HTML in the DOM. The DOM node with the given ID will be used
     * as a template, parsed and a new DOM node will be returned containing the
     * parsed data. Keep in mind to have only one root DOM element in the the
     * template.
     * Additionally, you should not put the template into a regular, hidden
     * DOM element because the template may not be valid HTML due to the containing
     * mustache tags. We suggest to put it into a script tag with the type
     * <code>text/template</code>.
     *
     * @param id {String} The id of the HTML template in the DOM.
     * @param view {Object} The object holding the data to render.
     * @param partials {Object} Object holding parts of a template.
     * @return {Element} A DOM element holding the parsed template data.
     */
    get : function(id, view, partials) {
      // get the content stored in the DOM
      var template = document.getElementById(id);
      return this.renderToNode(template.innerHTML, view, partials);
    },

    /**
     * Accepts a parsed template and returns a (potentially nested) node.
     *
     * @param template {String} The String containing the template.
     * @return {Element} A DOM element holding the parsed template data.
     */
    _createNodeFromTemplate : function(template) {
      // template is text only (no html elems) so use text node
      if (template.search(/<|>/) === -1) {
        return document.createTextNode(template);
      }

      // template has html elems so convert string into DOM nodes
      var helper = qx.dom.Element.create("div");
      helper.innerHTML = template;

      return helper.children[0];
    }
  }
});

(function() {
// prevent using CommonJS exports object,
// by shadowing global exports object
var exports;

// prevent using AMD compatible loader,
// by shadowing global define function
var define;

/**
 * Below is the original mustache.js code. Snapshot date is mentioned in
 * the head of this file.
 * @ignore(exports)
 * @ignore(define.*)
 * @ignore(module.*)
 * @lint ignoreNoLoopBlock()
 */
Download .txt
gitextract_6pju20il/

├── .eslintrc
├── .esmrc
├── .github/
│   └── workflows/
│       ├── usage.yml
│       └── verify.yml
├── .gitignore
├── .gitmodules
├── .travis.yml
├── .zuul.yml
├── CHANGELOG.md
├── LICENSE
├── MIGRATING.md
├── README.md
├── Rakefile
├── bin/
│   └── mustache
├── mustache.js
├── package.json
├── scripts/
│   └── bump-version-in-source
├── spec/
│   └── _files/
│       ├── bom_as_whitespace.js
│       ├── bom_as_whitespace.mustache
│       └── bom_as_whitespace.txt
├── test/
│   ├── .eslintrc
│   ├── _files/
│   │   ├── ampersand_escape.js
│   │   ├── ampersand_escape.mustache
│   │   ├── ampersand_escape.txt
│   │   ├── apostrophe.js
│   │   ├── apostrophe.mustache
│   │   ├── apostrophe.txt
│   │   ├── array_of_strings.js
│   │   ├── array_of_strings.mustache
│   │   ├── array_of_strings.txt
│   │   ├── avoids_obj_prototype_in_view_cache.js
│   │   ├── avoids_obj_prototype_in_view_cache.mustache
│   │   ├── avoids_obj_prototype_in_view_cache.txt
│   │   ├── backslashes.js
│   │   ├── backslashes.mustache
│   │   ├── backslashes.txt
│   │   ├── bug_11_eating_whitespace.js
│   │   ├── bug_11_eating_whitespace.mustache
│   │   ├── bug_11_eating_whitespace.txt
│   │   ├── bug_length_property.js
│   │   ├── bug_length_property.mustache
│   │   ├── bug_length_property.txt
│   │   ├── changing_delimiters.js
│   │   ├── changing_delimiters.mustache
│   │   ├── changing_delimiters.txt
│   │   ├── check_falsy.js
│   │   ├── check_falsy.mustache
│   │   ├── check_falsy.txt
│   │   ├── cli.cjs
│   │   ├── cli.js
│   │   ├── cli.json
│   │   ├── cli.mustache
│   │   ├── cli.txt
│   │   ├── cli_js_view_with_function.js
│   │   ├── cli_js_view_with_function.mustache
│   │   ├── cli_js_view_with_function.txt
│   │   ├── cli_with_partials.json
│   │   ├── cli_with_partials.mustache
│   │   ├── cli_with_partials.txt
│   │   ├── comments.js
│   │   ├── comments.mustache
│   │   ├── comments.txt
│   │   ├── complex.js
│   │   ├── complex.mustache
│   │   ├── complex.txt
│   │   ├── context_lookup.js
│   │   ├── context_lookup.mustache
│   │   ├── context_lookup.txt
│   │   ├── delimiters.js
│   │   ├── delimiters.mustache
│   │   ├── delimiters.txt
│   │   ├── disappearing_whitespace.js
│   │   ├── disappearing_whitespace.mustache
│   │   ├── disappearing_whitespace.txt
│   │   ├── dot_notation.js
│   │   ├── dot_notation.mustache
│   │   ├── dot_notation.txt
│   │   ├── double_render.js
│   │   ├── double_render.mustache
│   │   ├── double_render.txt
│   │   ├── empty_list.js
│   │   ├── empty_list.mustache
│   │   ├── empty_list.txt
│   │   ├── empty_sections.js
│   │   ├── empty_sections.mustache
│   │   ├── empty_sections.txt
│   │   ├── empty_string.js
│   │   ├── empty_string.mustache
│   │   ├── empty_string.txt
│   │   ├── empty_template.js
│   │   ├── empty_template.mustache
│   │   ├── empty_template.txt
│   │   ├── error_not_found.js
│   │   ├── error_not_found.mustache
│   │   ├── error_not_found.txt
│   │   ├── escaped.js
│   │   ├── escaped.mustache
│   │   ├── escaped.txt
│   │   ├── falsy.js
│   │   ├── falsy.mustache
│   │   ├── falsy.txt
│   │   ├── falsy_array.js
│   │   ├── falsy_array.mustache
│   │   ├── falsy_array.txt
│   │   ├── grandparent_context.js
│   │   ├── grandparent_context.mustache
│   │   ├── grandparent_context.txt
│   │   ├── higher_order_sections.js
│   │   ├── higher_order_sections.mustache
│   │   ├── higher_order_sections.txt
│   │   ├── implicit_iterator.js
│   │   ├── implicit_iterator.mustache
│   │   ├── implicit_iterator.txt
│   │   ├── included_tag.js
│   │   ├── included_tag.mustache
│   │   ├── included_tag.txt
│   │   ├── inverted_section.js
│   │   ├── inverted_section.mustache
│   │   ├── inverted_section.txt
│   │   ├── keys_with_questionmarks.js
│   │   ├── keys_with_questionmarks.mustache
│   │   ├── keys_with_questionmarks.txt
│   │   ├── malicious_template.js
│   │   ├── malicious_template.mustache
│   │   ├── malicious_template.txt
│   │   ├── multiline_comment.js
│   │   ├── multiline_comment.mustache
│   │   ├── multiline_comment.txt
│   │   ├── nested_dot.js
│   │   ├── nested_dot.mustache
│   │   ├── nested_dot.txt
│   │   ├── nested_higher_order_sections.js
│   │   ├── nested_higher_order_sections.mustache
│   │   ├── nested_higher_order_sections.txt
│   │   ├── nested_iterating.js
│   │   ├── nested_iterating.mustache
│   │   ├── nested_iterating.txt
│   │   ├── nesting.js
│   │   ├── nesting.mustache
│   │   ├── nesting.txt
│   │   ├── nesting_same_name.js
│   │   ├── nesting_same_name.mustache
│   │   ├── nesting_same_name.txt
│   │   ├── null_lookup_array.js
│   │   ├── null_lookup_array.mustache
│   │   ├── null_lookup_array.txt
│   │   ├── null_lookup_object.js
│   │   ├── null_lookup_object.mustache
│   │   ├── null_lookup_object.txt
│   │   ├── null_string.js
│   │   ├── null_string.mustache
│   │   ├── null_string.txt
│   │   ├── null_view.js
│   │   ├── null_view.mustache
│   │   ├── null_view.txt
│   │   ├── partial_array.js
│   │   ├── partial_array.mustache
│   │   ├── partial_array.partial
│   │   ├── partial_array.txt
│   │   ├── partial_array_of_partials.js
│   │   ├── partial_array_of_partials.mustache
│   │   ├── partial_array_of_partials.partial
│   │   ├── partial_array_of_partials.txt
│   │   ├── partial_array_of_partials_implicit.js
│   │   ├── partial_array_of_partials_implicit.mustache
│   │   ├── partial_array_of_partials_implicit.partial
│   │   ├── partial_array_of_partials_implicit.txt
│   │   ├── partial_empty.js
│   │   ├── partial_empty.mustache
│   │   ├── partial_empty.partial
│   │   ├── partial_empty.txt
│   │   ├── partial_template.js
│   │   ├── partial_template.mustache
│   │   ├── partial_template.partial
│   │   ├── partial_template.txt
│   │   ├── partial_view.js
│   │   ├── partial_view.mustache
│   │   ├── partial_view.partial
│   │   ├── partial_view.txt
│   │   ├── partial_whitespace.js
│   │   ├── partial_whitespace.mustache
│   │   ├── partial_whitespace.partial
│   │   ├── partial_whitespace.txt
│   │   ├── recursion_with_same_names.js
│   │   ├── recursion_with_same_names.mustache
│   │   ├── recursion_with_same_names.txt
│   │   ├── reuse_of_enumerables.js
│   │   ├── reuse_of_enumerables.mustache
│   │   ├── reuse_of_enumerables.txt
│   │   ├── section_as_context.js
│   │   ├── section_as_context.mustache
│   │   ├── section_as_context.txt
│   │   ├── section_functions_in_partials.js
│   │   ├── section_functions_in_partials.mustache
│   │   ├── section_functions_in_partials.partial
│   │   ├── section_functions_in_partials.txt
│   │   ├── simple.js
│   │   ├── simple.mustache
│   │   ├── simple.txt
│   │   ├── string_as_context.js
│   │   ├── string_as_context.mustache
│   │   ├── string_as_context.txt
│   │   ├── two_in_a_row.js
│   │   ├── two_in_a_row.mustache
│   │   ├── two_in_a_row.txt
│   │   ├── two_sections.js
│   │   ├── two_sections.mustache
│   │   ├── two_sections.txt
│   │   ├── unescaped.js
│   │   ├── unescaped.mustache
│   │   ├── unescaped.txt
│   │   ├── uses_props_from_view_prototype.js
│   │   ├── uses_props_from_view_prototype.mustache
│   │   ├── uses_props_from_view_prototype.txt
│   │   ├── whitespace.js
│   │   ├── whitespace.mustache
│   │   ├── whitespace.txt
│   │   ├── zero_view.js
│   │   ├── zero_view.mustache
│   │   └── zero_view.txt
│   ├── cli-test.js
│   ├── context-test.js
│   ├── create-browser-suite.js
│   ├── helper.js
│   ├── module-systems/
│   │   ├── .eslintrc
│   │   ├── _fixtures/
│   │   │   ├── amd.html
│   │   │   └── global-scope.html
│   │   ├── browser-test.js
│   │   ├── commonjs-test.js
│   │   ├── deno-test.ts
│   │   ├── esm-test-exports.mjs
│   │   └── esm-test.mjs
│   ├── mustache-spec-test.js
│   ├── parse-test.js
│   ├── partial-test.js
│   ├── render-helper.js
│   ├── render-test-browser-tmpl.mustache
│   ├── render-test.js
│   └── scanner-test.js
└── wrappers/
    ├── dojo/
    │   ├── mustache.js.post
    │   └── mustache.js.pre
    ├── jquery/
    │   ├── mustache.js.post
    │   └── mustache.js.pre
    ├── mootools/
    │   ├── mustache.js.post
    │   └── mustache.js.pre
    └── qooxdoo/
        ├── mustache.js.post
        └── mustache.js.pre
Download .txt
SYMBOL INDEX (36 symbols across 6 files)

FILE: mustache.js
  function isFunction (line 11) | function isFunction (object) {
  function typeStr (line 19) | function typeStr (obj) {
  function escapeRegExp (line 23) | function escapeRegExp (string) {
  function hasProperty (line 31) | function hasProperty (obj, propName) {
  function primitiveHasOwnProperty (line 39) | function primitiveHasOwnProperty (primitive, propName) {
  function testRegExp (line 51) | function testRegExp (re, string) {
  function isWhitespace (line 56) | function isWhitespace (string) {
  function escapeHtml (line 71) | function escapeHtml (string) {
  function parseTemplate (line 109) | function parseTemplate (template, tags) {
  function squashTokens (line 255) | function squashTokens (tokens) {
  function nestTokens (line 282) | function nestTokens (tokens) {
  function Scanner (line 315) | function Scanner (string) {
  function Context (line 375) | function Context (view, parentContext) {
  function Writer (line 481) | function Writer () {
  function subRender (line 592) | function subRender (template) {
  method templateCache (line 711) | set templateCache (cache) {
  method templateCache (line 717) | get templateCache () {

FILE: test/_files/uses_props_from_view_prototype.js
  function Aaa (line 2) | function Aaa (x, y) {
  function Bbb (line 19) | function Bbb () {

FILE: test/cli-test.js
  function changeForOS (line 11) | function changeForOS (command) {
  function exec (line 24) | function exec () {

FILE: test/mustache-spec-test.js
  function existsDir (line 44) | function existsDir (path) {
  function getSpecs (line 65) | function getSpecs (specArea) {

FILE: test/render-helper.js
  function getContents (line 6) | function getContents (testName, ext) {
  function getView (line 14) | function getView (testName) {
  function getPartial (line 21) | function getPartial (testName) {
  function getTest (line 44) | function getTest (testName) {

FILE: test/render-test.js
  function escapeBang (line 104) | function escapeBang (text) {
  function escapeQuestion (line 113) | function escapeQuestion (text) {
  function escapeQuestion (line 123) | function escapeQuestion (text) {
  function escapeBang (line 126) | function escapeBang (text) {
  function escapeNone (line 136) | function escapeNone (text) {
  function escapeDoubleAmpersand (line 146) | function escapeDoubleAmpersand (text) {
  function escapeTwoBangs (line 159) | function escapeTwoBangs (text) {
  function escapeDoubleAmpersand (line 170) | function escapeDoubleAmpersand (text) {
  function escapeQuotes (line 193) | function escapeQuotes (text) {
Condensed preview — 247 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (171K chars).
[
  {
    "path": ".eslintrc",
    "chars": 531,
    "preview": "{\n  \"env\": {\n    \"browser\": true,\n    \"node\": true\n  },\n  \"rules\": {\n    \"func-names\": 2,\n    \"no-mixed-spaces-and-tabs\""
  },
  {
    "path": ".esmrc",
    "chars": 288,
    "preview": "{\n  cjs: {\n    // Ensure ESM `export default` ends up as the root, e.g. `module.exports` when\n    // being `require()`d "
  },
  {
    "path": ".github/workflows/usage.yml",
    "chars": 3726,
    "preview": "name: Package usage\n\non: [push, pull_request]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actio"
  },
  {
    "path": ".github/workflows/verify.yml",
    "chars": 1829,
    "preview": "name: Verify changes\n\non: [push, pull_request]\n\njobs:\n  lint:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actio"
  },
  {
    "path": ".gitignore",
    "chars": 200,
    "preview": "node_modules\njquery.mustache.js\nmootools.mustache.js\ndojox\nyui3\nqooxdoo.mustache.js\ntest/render-test-browser.js\nnpm-debu"
  },
  {
    "path": ".gitmodules",
    "chars": 82,
    "preview": "[submodule \"test/spec\"]\n\tpath = test/spec\n\turl = https://github.com/mustache/spec\n"
  },
  {
    "path": ".travis.yml",
    "chars": 547,
    "preview": "language: node_js\nnode_js:\n  - 8\nscript:\n  - npm run build\n  - \"test $TRAVIS_PULL_REQUEST != 'false' || test $TRAVIS_NOD"
  },
  {
    "path": ".zuul.yml",
    "chars": 191,
    "preview": "ui: mocha-bdd\nbrowsers:\n  - name: chrome\n    version: latest\n  - name: firefox\n    version: latest\n  - name: ie\n    vers"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 22306,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nThis project adheres to [Semantic Ver"
  },
  {
    "path": "LICENSE",
    "chars": 1183,
    "preview": "The MIT License\n\nCopyright (c) 2009 Chris Wanstrath (Ruby)\nCopyright (c) 2010-2014 Jan Lehnardt (JavaScript)\nCopyright ("
  },
  {
    "path": "MIGRATING.md",
    "chars": 1339,
    "preview": "# Migrating Guide\n\n## Moving to mustache.js v2\n\n### Overview\n\nmustache.js v2 introduces a bug fix that breaks compatibil"
  },
  {
    "path": "README.md",
    "chars": 16850,
    "preview": "# mustache.js - Logic-less {{mustache}} templates with JavaScript\n\n> What could be more logical awesome than no logic at"
  },
  {
    "path": "Rakefile",
    "chars": 1387,
    "preview": "require 'rake'\nrequire 'rake/clean'\n\ntask :default => :test\n\ndef minified_file\n  ENV['FILE'] || 'mustache.min.js'\nend\n\nd"
  },
  {
    "path": "bin/mustache",
    "chars": 3468,
    "preview": "#!/usr/bin/env node\n\nvar fs = require('fs'),\n    path = require('path');\n\nvar Mustache = require('..');\nvar pkg = requir"
  },
  {
    "path": "mustache.js",
    "chars": 23522,
    "preview": "/*!\n * mustache.js - Logic-less {{mustache}} templates with JavaScript\n * http://github.com/janl/mustache.js\n */\n\nvar ob"
  },
  {
    "path": "package.json",
    "chars": 2063,
    "preview": "{\n  \"name\": \"mustache\",\n  \"version\": \"4.2.0\",\n  \"description\": \"Logic-less {{mustache}} templates with JavaScript\",\n  \"a"
  },
  {
    "path": "scripts/bump-version-in-source",
    "chars": 1417,
    "preview": "#!/usr/bin/env ruby\n\nrequire 'json'\n\ndef puts_c(color, str)\n\tputs \"\\x1b[#{color}m#{str}\\x1b[0m\"\nend\n\nclass Source\n\tattr_"
  },
  {
    "path": "spec/_files/bom_as_whitespace.js",
    "chars": 86,
    "preview": "var bom_as_whitespace = {'tag': 'Tag name w/o BOM', '\\uFEFFtag': 'Tag name with BOM'};"
  },
  {
    "path": "spec/_files/bom_as_whitespace.mustache",
    "chars": 8,
    "preview": "{{tag}}"
  },
  {
    "path": "spec/_files/bom_as_whitespace.txt",
    "chars": 16,
    "preview": "Tag name w/o BOM"
  },
  {
    "path": "test/.eslintrc",
    "chars": 70,
    "preview": "{\n  \"extends\": \"../.eslintrc\",\n  \"rules\": {\n    \"func-names\": 0\n  }\n}\n"
  },
  {
    "path": "test/_files/ampersand_escape.js",
    "chars": 32,
    "preview": "({\n  message: 'Some <code>'\n});\n"
  },
  {
    "path": "test/_files/ampersand_escape.mustache",
    "chars": 13,
    "preview": "{{&message}}\n"
  },
  {
    "path": "test/_files/ampersand_escape.txt",
    "chars": 12,
    "preview": "Some <code>\n"
  },
  {
    "path": "test/_files/apostrophe.js",
    "chars": 39,
    "preview": "({\n  'apos': \"'\",\n  'control': 'X'\n});\n"
  },
  {
    "path": "test/_files/apostrophe.mustache",
    "chars": 20,
    "preview": "{{apos}}{{control}}\n"
  },
  {
    "path": "test/_files/apostrophe.txt",
    "chars": 7,
    "preview": "&#39;X\n"
  },
  {
    "path": "test/_files/array_of_strings.js",
    "chars": 46,
    "preview": "({\n  array_of_strings: ['hello', 'world']\n});\n"
  },
  {
    "path": "test/_files/array_of_strings.mustache",
    "chars": 49,
    "preview": "{{#array_of_strings}}{{.}} {{/array_of_strings}}\n"
  },
  {
    "path": "test/_files/array_of_strings.txt",
    "chars": 13,
    "preview": "hello world \n"
  },
  {
    "path": "test/_files/avoids_obj_prototype_in_view_cache.js",
    "chars": 67,
    "preview": "({\n  valueOf: 'Avoids methods',\n  watch: 'in Object.prototype'\n});\n"
  },
  {
    "path": "test/_files/avoids_obj_prototype_in_view_cache.mustache",
    "chars": 21,
    "preview": "{{valueOf}} {{watch}}"
  },
  {
    "path": "test/_files/avoids_obj_prototype_in_view_cache.txt",
    "chars": 34,
    "preview": "Avoids methods in Object.prototype"
  },
  {
    "path": "test/_files/backslashes.js",
    "chars": 24,
    "preview": "({\n  value: '\\\\abc'\n});\n"
  },
  {
    "path": "test/_files/backslashes.mustache",
    "chars": 110,
    "preview": "* {{value}}\n* {{{value}}}\n* {{&value}}\n<script>\nfoo = { bar: 'abc\\\"xyz\\\"' };\nfoo = { bar: 'x\\'y' };\n</script>\n"
  },
  {
    "path": "test/_files/backslashes.txt",
    "chars": 92,
    "preview": "* \\abc\n* \\abc\n* \\abc\n<script>\nfoo = { bar: 'abc\\\"xyz\\\"' };\nfoo = { bar: 'x\\'y' };\n</script>\n"
  },
  {
    "path": "test/_files/bug_11_eating_whitespace.js",
    "chars": 19,
    "preview": "({\n  tag: 'yo'\n});\n"
  },
  {
    "path": "test/_files/bug_11_eating_whitespace.mustache",
    "chars": 12,
    "preview": "{{tag}} foo\n"
  },
  {
    "path": "test/_files/bug_11_eating_whitespace.txt",
    "chars": 7,
    "preview": "yo foo\n"
  },
  {
    "path": "test/_files/bug_length_property.js",
    "chars": 27,
    "preview": "({\n    length: 'hello'\n});\n"
  },
  {
    "path": "test/_files/bug_length_property.mustache",
    "chars": 57,
    "preview": "{{#length}}The length variable is: {{length}}{{/length}}\n"
  },
  {
    "path": "test/_files/bug_length_property.txt",
    "chars": 30,
    "preview": "The length variable is: hello\n"
  },
  {
    "path": "test/_files/changing_delimiters.js",
    "chars": 58,
    "preview": "({\n  'foo': 'foooooooooooooo',\n  'bar': '<b>bar!</b>'\n});\n"
  },
  {
    "path": "test/_files/changing_delimiters.mustache",
    "chars": 49,
    "preview": "{{=<% %>=}}<% foo %> {{foo}} <%{bar}%> {{{bar}}}\n"
  },
  {
    "path": "test/_files/changing_delimiters.txt",
    "chars": 46,
    "preview": "foooooooooooooo {{foo}} <b>bar!</b> {{{bar}}}\n"
  },
  {
    "path": "test/_files/check_falsy.js",
    "chars": 119,
    "preview": "({\n  number: function (text, render) {\n    return function (text, render) {\n      return +render(text);\n    };\n  }\n});\n"
  },
  {
    "path": "test/_files/check_falsy.mustache",
    "chars": 31,
    "preview": "<p>{{#number}}0{{/number}}</p>\n"
  },
  {
    "path": "test/_files/check_falsy.txt",
    "chars": 9,
    "preview": "<p>0</p>\n"
  },
  {
    "path": "test/_files/cli.cjs",
    "chars": 39,
    "preview": "module.exports = {\n  name: 'LeBron'\n};\n"
  },
  {
    "path": "test/_files/cli.js",
    "chars": 39,
    "preview": "module.exports = {\n  name: 'LeBron'\n};\n"
  },
  {
    "path": "test/_files/cli.json",
    "chars": 23,
    "preview": "{\n  \"name\": \"LeBron\"\n}\n"
  },
  {
    "path": "test/_files/cli.mustache",
    "chars": 23,
    "preview": "Howdy {{name}}, CLI rox"
  },
  {
    "path": "test/_files/cli.txt",
    "chars": 21,
    "preview": "Howdy LeBron, CLI rox"
  },
  {
    "path": "test/_files/cli_js_view_with_function.js",
    "chars": 156,
    "preview": "module.exports = {\n  'name': 'Tater',\n  'bold': function () {\n    return function (text, render) {\n      return '<b>' + "
  },
  {
    "path": "test/_files/cli_js_view_with_function.mustache",
    "chars": 30,
    "preview": "{{#bold}}Hi {{name}}.{{/bold}}"
  },
  {
    "path": "test/_files/cli_js_view_with_function.txt",
    "chars": 16,
    "preview": "<b>Hi Tater.</b>"
  },
  {
    "path": "test/_files/cli_with_partials.json",
    "chars": 160,
    "preview": "{ \"users\": [\n    {\n      \"name\": \"LeBron\"\n    },\n    {\n      \"name\": \"LeBron 2\"\n    }\n  ],\n  \"comments\": [\n    {\n      \""
  },
  {
    "path": "test/_files/cli_with_partials.mustache",
    "chars": 73,
    "preview": "{{#users}}\n{{>cli}}\n{{/users}}\n\n{{#comments}}\n{{>comments}}\n{{/comments}}"
  },
  {
    "path": "test/_files/cli_with_partials.txt",
    "chars": 73,
    "preview": "Howdy LeBron, CLI roxHowdy LeBron 2, CLI rox\n<h1>A Comedy of Errors</h1>\n"
  },
  {
    "path": "test/_files/comments.js",
    "chars": 67,
    "preview": "({\n  title: function () {\n    return 'A Comedy of Errors';\n  }\n});\n"
  },
  {
    "path": "test/_files/comments.mustache",
    "chars": 65,
    "preview": "<h1>{{title}}{{! just something interesting... or not... }}</h1>\n"
  },
  {
    "path": "test/_files/comments.txt",
    "chars": 28,
    "preview": "<h1>A Comedy of Errors</h1>\n"
  },
  {
    "path": "test/_files/complex.js",
    "chars": 414,
    "preview": "({\n  header: function () {\n    return 'Colors';\n  },\n  item: [\n      {name: 'red', current: true, url: '#Red'},\n      {n"
  },
  {
    "path": "test/_files/complex.mustache",
    "chars": 262,
    "preview": "<h1>{{header}}</h1>\n{{#list}}\n  <ul>\n  {{#item}}\n  {{#current}}\n  <li><strong>{{name}}</strong></li>\n  {{/current}}\n  {{"
  },
  {
    "path": "test/_files/complex.txt",
    "chars": 137,
    "preview": "<h1>Colors</h1>\n  <ul>\n  <li><strong>red</strong></li>\n  <li><a href=\"#Green\">green</a></li>\n  <li><a href=\"#Blue\">blue<"
  },
  {
    "path": "test/_files/context_lookup.js",
    "chars": 78,
    "preview": "({\n  'outer': {\n    'id': 1,\n    'second': {\n      'nothing': 2\n    }\n  }\n});\n"
  },
  {
    "path": "test/_files/context_lookup.mustache",
    "chars": 49,
    "preview": "{{#outer}}{{#second}}{{id}}{{/second}}{{/outer}}\n"
  },
  {
    "path": "test/_files/context_lookup.txt",
    "chars": 2,
    "preview": "1\n"
  },
  {
    "path": "test/_files/delimiters.js",
    "chars": 183,
    "preview": "({\n  first: 'It worked the first time.',\n  second: 'And it worked the second time.',\n  third: 'Then, surprisingly, it wo"
  },
  {
    "path": "test/_files/delimiters.mustache",
    "chars": 87,
    "preview": "{{=<% %>=}}*\n<% first %>\n* <% second %>\n<%=| |=%>\n* | third |\n|={{ }}=|\n* {{ fourth }}\n"
  },
  {
    "path": "test/_files/delimiters.txt",
    "chars": 135,
    "preview": "*\nIt worked the first time.\n* And it worked the second time.\n* Then, surprisingly, it worked the third time.\n* Fourth ti"
  },
  {
    "path": "test/_files/disappearing_whitespace.js",
    "chars": 36,
    "preview": "({\n  bedrooms: true,\n  total: 1\n});\n"
  },
  {
    "path": "test/_files/disappearing_whitespace.mustache",
    "chars": 40,
    "preview": "{{#bedrooms}}{{total}}{{/bedrooms}} BED\n"
  },
  {
    "path": "test/_files/disappearing_whitespace.txt",
    "chars": 6,
    "preview": "1 BED\n"
  },
  {
    "path": "test/_files/dot_notation.js",
    "chars": 422,
    "preview": "({\n  name: 'A Book',\n  authors: ['John Power', 'Jamie Walsh'],\n  price: {\n    value: 200,\n    vat: function () {\n      r"
  },
  {
    "path": "test/_files/dot_notation.mustache",
    "chars": 678,
    "preview": "<!-- exciting part -->\n<h1>{{name}}</h1>\n<p>Authors: <ul>{{#authors}}<li>{{.}}</li>{{/authors}}</ul></p>\n<p>Price: {{{pr"
  },
  {
    "path": "test/_files/dot_notation.txt",
    "chars": 401,
    "preview": "<!-- exciting part -->\n<h1>A Book</h1>\n<p>Authors: <ul><li>John Power</li><li>Jamie Walsh</li></ul></p>\n<p>Price: $200 U"
  },
  {
    "path": "test/_files/double_render.js",
    "chars": 52,
    "preview": "({\n  foo: true,\n  bar: '{{win}}',\n  win: 'FAIL'\n});\n"
  },
  {
    "path": "test/_files/double_render.mustache",
    "chars": 24,
    "preview": "{{#foo}}{{bar}}{{/foo}}\n"
  },
  {
    "path": "test/_files/double_render.txt",
    "chars": 8,
    "preview": "{{win}}\n"
  },
  {
    "path": "test/_files/empty_list.js",
    "chars": 18,
    "preview": "({\n  jobs: []\n});\n"
  },
  {
    "path": "test/_files/empty_list.mustache",
    "chars": 46,
    "preview": "These are the jobs:\n{{#jobs}}\n{{.}}\n{{/jobs}}\n"
  },
  {
    "path": "test/_files/empty_list.txt",
    "chars": 20,
    "preview": "These are the jobs:\n"
  },
  {
    "path": "test/_files/empty_sections.js",
    "chars": 6,
    "preview": "({});\n"
  },
  {
    "path": "test/_files/empty_sections.mustache",
    "chars": 36,
    "preview": "{{#foo}}{{/foo}}foo{{#bar}}{{/bar}}\n"
  },
  {
    "path": "test/_files/empty_sections.txt",
    "chars": 4,
    "preview": "foo\n"
  },
  {
    "path": "test/_files/empty_string.js",
    "chars": 73,
    "preview": "({\n  description: 'That is all!',\n  child: {\n    description: ''\n  }\n});\n"
  },
  {
    "path": "test/_files/empty_string.mustache",
    "chars": 51,
    "preview": "{{description}}{{#child}}{{description}}{{/child}}\n"
  },
  {
    "path": "test/_files/empty_string.txt",
    "chars": 13,
    "preview": "That is all!\n"
  },
  {
    "path": "test/_files/empty_template.js",
    "chars": 6,
    "preview": "({});\n"
  },
  {
    "path": "test/_files/empty_template.mustache",
    "chars": 52,
    "preview": "<html><head></head><body><h1>Test</h1></body></html>"
  },
  {
    "path": "test/_files/empty_template.txt",
    "chars": 52,
    "preview": "<html><head></head><body><h1>Test</h1></body></html>"
  },
  {
    "path": "test/_files/error_not_found.js",
    "chars": 16,
    "preview": "({\n  bar: 2\n});\n"
  },
  {
    "path": "test/_files/error_not_found.mustache",
    "chars": 7,
    "preview": "{{foo}}"
  },
  {
    "path": "test/_files/error_not_found.txt",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/_files/escaped.js",
    "chars": 108,
    "preview": "({\n  title: function () {\n    return 'Bear > Shark';\n  },\n  symbol: null,\n  entities: \"&quot; \\\"'<>`=/\"\n});\n"
  },
  {
    "path": "test/_files/escaped.mustache",
    "chars": 76,
    "preview": "<h1>{{title}}{{symbol}}</h1>\nAnd even {{entities}}, but not {{{entities}}}.\n"
  },
  {
    "path": "test/_files/escaped.txt",
    "chars": 108,
    "preview": "<h1>Bear &gt; Shark</h1>\nAnd even &amp;quot; &quot;&#39;&lt;&gt;&#x60;&#x3D;&#x2F;, but not &quot; \"'<>`=/.\n"
  },
  {
    "path": "test/_files/falsy.js",
    "chars": 115,
    "preview": "({\n  'emptyString': '',\n  'emptyArray': [],\n  'zero': 0,\n  'null': null,\n  'undefined': undefined,\n  'NaN': 0/0\n});"
  },
  {
    "path": "test/_files/falsy.mustache",
    "chars": 436,
    "preview": "{{#emptyString}}empty string{{/emptyString}}\n{{^emptyString}}inverted empty string{{/emptyString}}\n{{#emptyArray}}empty "
  },
  {
    "path": "test/_files/falsy.txt",
    "chars": 109,
    "preview": "\ninverted empty string\n\ninverted empty array\n\ninverted zero\n\ninverted null\n\ninverted undefined\n\ninverted NaN\n"
  },
  {
    "path": "test/_files/falsy_array.js",
    "chars": 143,
    "preview": "({\n  'list': [\n\t\t['', 'emptyString'],\n\t\t[[], 'emptyArray'],\n\t\t[0, 'zero'],\n\t\t[null, 'null'],\n\t\t[undefined, 'undefined'],"
  },
  {
    "path": "test/_files/falsy_array.mustache",
    "chars": 70,
    "preview": "{{#list}}\n{{#.}}{{#.}}{{.}}{{/.}}{{^.}}inverted {{/.}}{{/.}}\n{{/list}}"
  },
  {
    "path": "test/_files/falsy_array.txt",
    "chars": 101,
    "preview": "inverted emptyString\ninverted emptyArray\ninverted zero\ninverted null\ninverted undefined\ninverted NaN\n"
  },
  {
    "path": "test/_files/grandparent_context.js",
    "chars": 371,
    "preview": "({\n  grand_parent_id: 'grand_parent1',\n  parent_contexts: [\n    {\n      parent_id: 'parent1',\n      child_contexts: [\n  "
  },
  {
    "path": "test/_files/grandparent_context.mustache",
    "chars": 183,
    "preview": "{{grand_parent_id}}\n{{#parent_contexts}}\n{{grand_parent_id}}\n{{parent_id}}\n{{#child_contexts}}\n{{grand_parent_id}}\n{{par"
  },
  {
    "path": "test/_files/grandparent_context.txt",
    "chars": 206,
    "preview": "grand_parent1\ngrand_parent1\nparent1\ngrand_parent1\nparent1\nparent1-child1\ngrand_parent1\nparent1\nparent1-child2\ngrand_pare"
  },
  {
    "path": "test/_files/higher_order_sections.js",
    "chars": 190,
    "preview": "({\n  name: 'Tater',\n  helper: 'To tinker?',\n  bolder: function () {\n    return function (text, render) {\n      return te"
  },
  {
    "path": "test/_files/higher_order_sections.mustache",
    "chars": 35,
    "preview": "{{#bolder}}Hi {{name}}.{{/bolder}}\n"
  },
  {
    "path": "test/_files/higher_order_sections.txt",
    "chars": 44,
    "preview": "Hi {{name}}. => <b>Hi Tater.</b> To tinker?\n"
  },
  {
    "path": "test/_files/implicit_iterator.js",
    "chars": 86,
    "preview": "({\n  data: {\n    author: {\n      twitter_id: 819606,\n      name: 'janl'\n    }\n  }\n});\n"
  },
  {
    "path": "test/_files/implicit_iterator.mustache",
    "chars": 198,
    "preview": "{{# data.author.twitter_id }}\n<meta name=\"twitter:site:id\" content=\"{{.}}\">\n{{/ data.author.twitter_id }}\n\n{{# data.auth"
  },
  {
    "path": "test/_files/implicit_iterator.txt",
    "chars": 90,
    "preview": "<meta name=\"twitter:site:id\" content=\"819606\">\n\n<meta name=\"twitter:site\" content=\"janl\">\n"
  },
  {
    "path": "test/_files/included_tag.js",
    "chars": 37,
    "preview": "({\n  html: 'I like {{mustache}}'\n});\n"
  },
  {
    "path": "test/_files/included_tag.mustache",
    "chars": 28,
    "preview": "You said \"{{{html}}}\" today\n"
  },
  {
    "path": "test/_files/included_tag.txt",
    "chars": 37,
    "preview": "You said \"I like {{mustache}}\" today\n"
  },
  {
    "path": "test/_files/inverted_section.js",
    "chars": 21,
    "preview": "({\n  'repos': []\n});\n"
  },
  {
    "path": "test/_files/inverted_section.mustache",
    "chars": 97,
    "preview": "{{#repos}}<b>{{name}}</b>{{/repos}}\n{{^repos}}No repos :({{/repos}}\n{{^nothin}}Hello!{{/nothin}}\n"
  },
  {
    "path": "test/_files/inverted_section.txt",
    "chars": 20,
    "preview": "\nNo repos :(\nHello!\n"
  },
  {
    "path": "test/_files/keys_with_questionmarks.js",
    "chars": 42,
    "preview": "({\n  'person?': {\n    name: 'Jon'\n  }\n});\n"
  },
  {
    "path": "test/_files/keys_with_questionmarks.mustache",
    "chars": 41,
    "preview": "{{#person?}}\n  Hi {{name}}!\n{{/person?}}\n"
  },
  {
    "path": "test/_files/keys_with_questionmarks.txt",
    "chars": 10,
    "preview": "  Hi Jon!\n"
  },
  {
    "path": "test/_files/malicious_template.js",
    "chars": 6,
    "preview": "({});\n"
  },
  {
    "path": "test/_files/malicious_template.mustache",
    "chars": 203,
    "preview": "{{\"+(function () {throw \"evil\"})()+\"}}\n{{{\"+(function () {throw \"evil\"})()+\"}}}\n{{> \"+(function () {throw \"evil\"})()+\"}}"
  },
  {
    "path": "test/_files/malicious_template.txt",
    "chars": 2,
    "preview": "\n\n"
  },
  {
    "path": "test/_files/multiline_comment.js",
    "chars": 6,
    "preview": "({});\n"
  },
  {
    "path": "test/_files/multiline_comment.mustache",
    "chars": 52,
    "preview": "{{!\n\nThis is a multi-line comment.\n\n}}\nHello world!\n"
  },
  {
    "path": "test/_files/multiline_comment.txt",
    "chars": 13,
    "preview": "Hello world!\n"
  },
  {
    "path": "test/_files/nested_dot.js",
    "chars": 21,
    "preview": "({ name: 'Bruno' });\n"
  },
  {
    "path": "test/_files/nested_dot.mustache",
    "chars": 29,
    "preview": "{{#name}}Hello {{.}}{{/name}}"
  },
  {
    "path": "test/_files/nested_dot.txt",
    "chars": 11,
    "preview": "Hello Bruno"
  },
  {
    "path": "test/_files/nested_higher_order_sections.js",
    "chars": 150,
    "preview": "({\n  bold: function () {\n    return function (text, render) {\n      return '<b>' + render(text) + '</b>';\n    };\n  },\n  "
  },
  {
    "path": "test/_files/nested_higher_order_sections.mustache",
    "chars": 61,
    "preview": "{{#bold}}{{#person}}My name is {{name}}!{{/person}}{{/bold}}\n"
  },
  {
    "path": "test/_files/nested_higher_order_sections.txt",
    "chars": 25,
    "preview": "<b>My name is Jonas!</b>\n"
  },
  {
    "path": "test/_files/nested_iterating.js",
    "chars": 78,
    "preview": "({\n  inner: [{\n    foo: 'foo',\n    inner: [{\n      bar: 'bar'\n    }]\n  }]\n});\n"
  },
  {
    "path": "test/_files/nested_iterating.mustache",
    "chars": 55,
    "preview": "{{#inner}}{{foo}}{{#inner}}{{bar}}{{/inner}}{{/inner}}\n"
  },
  {
    "path": "test/_files/nested_iterating.txt",
    "chars": 7,
    "preview": "foobar\n"
  },
  {
    "path": "test/_files/nesting.js",
    "chars": 70,
    "preview": "({\n  foo: [\n    {a: {b: 1}},\n    {a: {b: 2}},\n    {a: {b: 3}}\n  ]\n});\n"
  },
  {
    "path": "test/_files/nesting.mustache",
    "chars": 46,
    "preview": "{{#foo}}\n  {{#a}}\n    {{b}}\n  {{/a}}\n{{/foo}}\n"
  },
  {
    "path": "test/_files/nesting.txt",
    "chars": 18,
    "preview": "    1\n    2\n    3\n"
  },
  {
    "path": "test/_files/nesting_same_name.js",
    "chars": 80,
    "preview": "({\n  items: [\n    {\n      name: 'name',\n      items: [1, 2, 3, 4]\n    }\n  ]\n});\n"
  },
  {
    "path": "test/_files/nesting_same_name.mustache",
    "chars": 54,
    "preview": "{{#items}}{{name}}{{#items}}{{.}}{{/items}}{{/items}}\n"
  },
  {
    "path": "test/_files/nesting_same_name.txt",
    "chars": 9,
    "preview": "name1234\n"
  },
  {
    "path": "test/_files/null_lookup_array.js",
    "chars": 148,
    "preview": "({\n  'name': 'David',\n  'twitter': '@dasilvacontin',\n  'farray': [\n    ['Flor', '@florrts'],\n    ['Miquel', null],\n    ["
  },
  {
    "path": "test/_files/null_lookup_array.mustache",
    "chars": 77,
    "preview": "{{#farray}}\n{{#.}}{{#.}}{{.}} {{/.}}{{^.}}no twitter{{/.}}{{/.}}\n{{/farray}}\n"
  },
  {
    "path": "test/_files/null_lookup_array.txt",
    "chars": 50,
    "preview": "Flor @florrts \nMiquel no twitter\nChris no twitter\n"
  },
  {
    "path": "test/_files/null_lookup_object.js",
    "chars": 480,
    "preview": "({\n  'name': 'David',\n  'twitter': '@dasilvacontin',\n  'fobject': [\n    {\n      'name': 'Flor',\n      'twitter': '@florr"
  },
  {
    "path": "test/_files/null_lookup_object.mustache",
    "chars": 506,
    "preview": "{{#fobject}}\n{{name}}'s twitter: {{#twitter}}{{.}}{{/twitter}}{{^twitter}}unknown{{/twitter}}.\n{{/fobject}}\n\n{{#mascot}}"
  },
  {
    "path": "test/_files/null_lookup_object.txt",
    "chars": 177,
    "preview": "Flor's twitter: @florrts.\nMiquel's twitter: unknown.\nChris's twitter: unknown.\n\nSquid's favorite color: orange.\nSquid's "
  },
  {
    "path": "test/_files/null_string.js",
    "chars": 137,
    "preview": "({\n  name: 'Elise',\n  glytch: true,\n  binary: false,\n  value: null,\n  undef: undefined,\n  numeric: function () {\n    ret"
  },
  {
    "path": "test/_files/null_string.mustache",
    "chars": 103,
    "preview": "Hello {{name}}\nglytch {{glytch}}\nbinary {{binary}}\nvalue {{value}}\nundef {{undef}}\nnumeric {{numeric}}\n"
  },
  {
    "path": "test/_files/null_string.txt",
    "chars": 63,
    "preview": "Hello Elise\nglytch true\nbinary false\nvalue \nundef \nnumeric NaN\n"
  },
  {
    "path": "test/_files/null_view.js",
    "chars": 38,
    "preview": "({\n  name: 'Joe',\n  friends: null\n});\n"
  },
  {
    "path": "test/_files/null_view.mustache",
    "chars": 54,
    "preview": "{{name}}'s friends: {{#friends}}{{name}}, {{/friends}}"
  },
  {
    "path": "test/_files/null_view.txt",
    "chars": 15,
    "preview": "Joe's friends: "
  },
  {
    "path": "test/_files/partial_array.js",
    "chars": 37,
    "preview": "({\n  array: ['1', '2', '3', '4']\n});\n"
  },
  {
    "path": "test/_files/partial_array.mustache",
    "chars": 12,
    "preview": "{{>partial}}"
  },
  {
    "path": "test/_files/partial_array.partial",
    "chars": 65,
    "preview": "Here's a non-sense array of values\n{{#array}}\n  {{.}}\n{{/array}}\n"
  },
  {
    "path": "test/_files/partial_array.txt",
    "chars": 51,
    "preview": "Here's a non-sense array of values\n  1\n  2\n  3\n  4\n"
  },
  {
    "path": "test/_files/partial_array_of_partials.js",
    "chars": 79,
    "preview": "({\n  numbers: [\n    {i: '1'},\n    {i: '2'},\n    {i: '3'},\n    {i: '4'}\n  ]\n});\n"
  },
  {
    "path": "test/_files/partial_array_of_partials.mustache",
    "chars": 59,
    "preview": "Here is some stuff!\n{{#numbers}}\n{{>partial}}\n{{/numbers}}\n"
  },
  {
    "path": "test/_files/partial_array_of_partials.partial",
    "chars": 6,
    "preview": "{{i}}\n"
  },
  {
    "path": "test/_files/partial_array_of_partials.txt",
    "chars": 28,
    "preview": "Here is some stuff!\n1\n2\n3\n4\n"
  },
  {
    "path": "test/_files/partial_array_of_partials_implicit.js",
    "chars": 39,
    "preview": "({\n  numbers: ['1', '2', '3', '4']\n});\n"
  },
  {
    "path": "test/_files/partial_array_of_partials_implicit.mustache",
    "chars": 59,
    "preview": "Here is some stuff!\n{{#numbers}}\n{{>partial}}\n{{/numbers}}\n"
  },
  {
    "path": "test/_files/partial_array_of_partials_implicit.partial",
    "chars": 6,
    "preview": "{{.}}\n"
  },
  {
    "path": "test/_files/partial_array_of_partials_implicit.txt",
    "chars": 28,
    "preview": "Here is some stuff!\n1\n2\n3\n4\n"
  },
  {
    "path": "test/_files/partial_empty.js",
    "chars": 16,
    "preview": "({\n  foo: 1\n});\n"
  },
  {
    "path": "test/_files/partial_empty.mustache",
    "chars": 25,
    "preview": "hey {{foo}}\n{{>partial}}\n"
  },
  {
    "path": "test/_files/partial_empty.partial",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/_files/partial_empty.txt",
    "chars": 6,
    "preview": "hey 1\n"
  },
  {
    "path": "test/_files/partial_template.js",
    "chars": 76,
    "preview": "({\n  title: function () {\n    return 'Welcome';\n  },\n  again: 'Goodbye'\n});\n"
  },
  {
    "path": "test/_files/partial_template.mustache",
    "chars": 32,
    "preview": "<h1>{{title}}</h1>\n{{>partial}}\n"
  },
  {
    "path": "test/_files/partial_template.partial",
    "chars": 18,
    "preview": "Again, {{again}}!\n"
  },
  {
    "path": "test/_files/partial_template.txt",
    "chars": 33,
    "preview": "<h1>Welcome</h1>\nAgain, Goodbye!\n"
  },
  {
    "path": "test/_files/partial_view.js",
    "chars": 250,
    "preview": "({\n  greeting: function () {\n    return 'Welcome';\n  },\n  farewell: function () {\n    return 'Fair enough, right?';\n  },"
  },
  {
    "path": "test/_files/partial_view.mustache",
    "chars": 57,
    "preview": "<h1>{{greeting}}</h1>\n{{>partial}}\n<h3>{{farewell}}</h3>\n"
  },
  {
    "path": "test/_files/partial_view.partial",
    "chars": 105,
    "preview": "Hello {{name}}\nYou have just won ${{value}}!\n{{#in_ca}}\nWell, ${{ taxed_value }}, after taxes.\n{{/in_ca}}"
  },
  {
    "path": "test/_files/partial_view.txt",
    "chars": 110,
    "preview": "<h1>Welcome</h1>\nHello Chris\nYou have just won $10000!\nWell, $6000, after taxes.\n<h3>Fair enough, right?</h3>\n"
  },
  {
    "path": "test/_files/partial_whitespace.js",
    "chars": 250,
    "preview": "({\n  greeting: function () {\n    return 'Welcome';\n  },\n  farewell: function () {\n    return 'Fair enough, right?';\n  },"
  },
  {
    "path": "test/_files/partial_whitespace.mustache",
    "chars": 65,
    "preview": "<h1>{{  greeting  }}</h1>\n{{> partial }}\n<h3>{{ farewell }}</h3>\n"
  },
  {
    "path": "test/_files/partial_whitespace.partial",
    "chars": 113,
    "preview": "Hello {{ name}}\nYou have just won ${{value }}!\n{{# in_ca  }}\nWell, ${{ taxed_value }}, after taxes.\n{{/  in_ca }}"
  },
  {
    "path": "test/_files/partial_whitespace.txt",
    "chars": 110,
    "preview": "<h1>Welcome</h1>\nHello Chris\nYou have just won $10000!\nWell, $6000, after taxes.\n<h3>Fair enough, right?</h3>\n"
  },
  {
    "path": "test/_files/recursion_with_same_names.js",
    "chars": 116,
    "preview": "({\n  name: 'name',\n  description: 'desc',\n  terms: [\n    {name: 't1', index: 0},\n    {name: 't2', index: 1}\n  ]\n});\n"
  },
  {
    "path": "test/_files/recursion_with_same_names.mustache",
    "chars": 75,
    "preview": "{{ name }}\n{{ description }}\n\n{{#terms}}\n  {{name}}\n  {{index}}\n{{/terms}}\n"
  },
  {
    "path": "test/_files/recursion_with_same_names.txt",
    "chars": 29,
    "preview": "name\ndesc\n\n  t1\n  0\n  t2\n  1\n"
  },
  {
    "path": "test/_files/reuse_of_enumerables.js",
    "chars": 77,
    "preview": "({\n  terms: [\n    {name: 't1', index: 0},\n    {name: 't2', index: 1}\n  ]\n});\n"
  },
  {
    "path": "test/_files/reuse_of_enumerables.mustache",
    "chars": 90,
    "preview": "{{#terms}}\n  {{name}}\n  {{index}}\n{{/terms}}\n{{#terms}}\n  {{name}}\n  {{index}}\n{{/terms}}\n"
  },
  {
    "path": "test/_files/reuse_of_enumerables.txt",
    "chars": 36,
    "preview": "  t1\n  0\n  t2\n  1\n  t1\n  0\n  t2\n  1\n"
  },
  {
    "path": "test/_files/section_as_context.js",
    "chars": 184,
    "preview": "({\n  a_object: {\n    title: 'this is an object',\n    description: 'one of its attributes is a list',\n    a_list: [\n     "
  },
  {
    "path": "test/_files/section_as_context.mustache",
    "chars": 144,
    "preview": "{{#a_object}}\n  <h1>{{title}}</h1>\n  <p>{{description}}</p>\n  <ul>\n    {{#a_list}}\n    <li>{{label}}</li>\n    {{/a_list}"
  },
  {
    "path": "test/_files/section_as_context.txt",
    "chars": 131,
    "preview": "  <h1>this is an object</h1>\n  <p>one of its attributes is a list</p>\n  <ul>\n    <li>listitem1</li>\n    <li>listitem2</l"
  },
  {
    "path": "test/_files/section_functions_in_partials.js",
    "chars": 120,
    "preview": "({\n  bold: function (){\n    return function (text, render) {\n      return '<b>' + render(text) + '</b>';\n    };\n  }\n});\n"
  },
  {
    "path": "test/_files/section_functions_in_partials.mustache",
    "chars": 37,
    "preview": "{{> partial}}\n\n<p>some more text</p>\n"
  },
  {
    "path": "test/_files/section_functions_in_partials.partial",
    "chars": 30,
    "preview": "{{#bold}}Hello There{{/bold}}\n"
  },
  {
    "path": "test/_files/section_functions_in_partials.txt",
    "chars": 42,
    "preview": "<b>Hello There</b>\n\n<p>some more text</p>\n"
  },
  {
    "path": "test/_files/simple.js",
    "chars": 132,
    "preview": "({\n  name: 'Chris',\n  value: 10000,\n  taxed_value: function () {\n    return this.value - (this.value * 0.4);\n  },\n  in_c"
  },
  {
    "path": "test/_files/simple.mustache",
    "chars": 106,
    "preview": "Hello {{name}}\nYou have just won ${{value}}!\n{{#in_ca}}\nWell, ${{ taxed_value }}, after taxes.\n{{/in_ca}}\n"
  },
  {
    "path": "test/_files/simple.txt",
    "chars": 64,
    "preview": "Hello Chris\nYou have just won $10000!\nWell, $6000, after taxes.\n"
  },
  {
    "path": "test/_files/string_as_context.js",
    "chars": 49,
    "preview": "({\n  a_string: 'aa',\n  a_list: ['a','b','c']\n});\n"
  }
]

// ... and 47 more files (download for full content)

About this extraction

This page contains the full source code of the janl/mustache.js GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 247 files (146.9 KB), approximately 48.1k tokens, and a symbol index with 36 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!