🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

twig

Package Overview
Dependencies
Maintainers
7
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twig - npm Package Compare versions

Comparing version
1.17.1
to
2.0.0
+27
.github/contributing.md
# Contributing
There are a few steps to take to get twig.js building in your environment.
## Requirements
In order work on twig.js you will need node installed to run the tests and create the minified version of twig.js
## Building
1. Fork and clone the twig.js git repository.
2. Run `npm ci` to install the development dependencies.
3. Make your changes to the source files in `src/`.
4. Add/update tests in `test/`.
5. Run `npm run test` to make sure your tests pass.
6. Run `npm run build` to build the source.
## Contributing
1. If possible, create tests (in the `test/` directory) which test your changes. E.g. if you found and fixed a bug, create a test which fails in the buggy version.
2. Please commit only changes in the source code, not in the built files like `twig.js`, `twig.min.js`, etc. as they blow up the repository and create conflicts when merging pull requests. We build a final file when releasing a new version.
3. If possible, rebase your changes to the current master.
4. Tidy up your commit history. It's important to have distinct commits so that you can follow development process.
5. Push a branch to your fork on Github and create a pull request.
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages
on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [write-docs-using-vitepress]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci
working-directory: docs
- name: Build with VitePress
run: npm run docs:build
working-directory: docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

Sorry, the diff of this file is not supported yet

import js from "@eslint/js";
import globals from "globals";
import {defineConfig} from "eslint/config";
export default defineConfig([
{
files: ["src/*.{js}", "test/*.{js}", "bin/*.{js}"],
plugins: {js},
extends: ["js/recommended"],
languageOptions: {globals: globals.browser}
},
]);
# Upgrading
This covers how to upgrade between versions when there are breaking changes. General changelog notices can be found on the [Releases page on GitHub](https://github.com/twigjs/twig.js/releases).
## 2.0.0
- Ensure you are using Node.js >= 20
+3
-9

@@ -17,11 +17,5 @@ name: "tests"

node_js:
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 20
- 22
- 24

@@ -28,0 +22,0 @@ steps:

@@ -5,3 +5,3 @@ {

"description": "JS port of the Twig templating language.",
"version": "1.17.1",
"version": "2.0.0",
"homepage": "https://github.com/twigjs/twig.js",

@@ -21,3 +21,3 @@ "license": "BSD-2-Clause",

"engines": {
"node": ">=10"
"node": ">=20"
},

@@ -33,8 +33,9 @@ "bin": {

"build": "node node/build.js",
"posttest": "xo src lib bin"
"posttest": "npm run lint",
"lint": "eslint"
},
"dependencies": {
"@babel/runtime": "^7.8.4",
"locutus": "^2.0.11",
"minimatch": "3.0.x",
"locutus": "^3.0.9",
"minimatch": "^10",
"walk": "2.3.x"

@@ -46,34 +47,19 @@ },

"@babel/preset-env": "^7.8.4",
"babel-loader": "^8.0.6",
"eslint-plugin-mocha": "^6.3.0",
"mocha": "^9.0.0",
"@eslint/js": "^9.39.3",
"babel-loader": "^10.0.0",
"eslint": "^9.39.3",
"globals": "^17.4.0",
"mocha": "12.0.0-beta-10",
"path-browserify": "^1.0.1",
"should": "^13.2.3",
"should-sinon": "0.0.6",
"sinon": "^9.0.0",
"sinon": "^21.0.0",
"terser-webpack-plugin": "^5.3.6",
"tokenizer2": "^2.0.1",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"xo": "^0.26.1"
"webpack-cli": "^6.0.1"
},
"browser": {
"fs": false
},
"xo": {
"space": 4,
"envs": [
"browser",
"node",
"mocha"
],
"plugins": [
"mocha"
],
"rules": {
"promise/prefer-await-to-then": 0,
"prefer-arrow-callback": 0,
"mocha/prefer-arrow-callback": 2
}
}
}

@@ -1468,5 +1468,3 @@ // ## twig.core.js

/* eslint-disable no-new-wrappers, unicorn/new-for-builtins */
const output = new String(content);
/* eslint-enable */
output.twigMarkup = (typeof strategy === 'undefined') ? true : strategy;

@@ -1473,0 +1471,0 @@

@@ -217,3 +217,3 @@ // ## twig.expression.js

// and, or, in, not in, matches, starts with, ends with can be followed by a space or parenthesis
regex: /(^\?\?|^\?:|^(b-and)|^(b-or)|^(b-xor)|^[+\-~%?]|^(<=>)|^[:](?!\d\])|^[!=]==?|^[!<>]=?|^\*\*?|^\/\/?|^(and)[(|\s+]|^(or)[(|\s+]|^(in)[(|\s+]|^(not in)[(|\s+]|^(matches)|^(starts with)|^(ends with)|^\.\.)/,
regex: /(^\?\?|^\?\s*:|^(b-and)|^(b-or)|^(b-xor)|^[+\-~%?]|^(<=>)|^[:](?!\d\])|^[!=]==?|^[!<>]=?|^\*\*?|^\/\/?|^(and)[(|\s+]|^(or)[(|\s+]|^(in)[(|\s+]|^(not in)[(|\s+]|^(matches)|^(starts with)|^(ends with)|^\.\.)/,
next: Twig.expression.set.expressions,

@@ -236,2 +236,6 @@ transform(match, tokens) {

if (token.value.match(/^\?\s*:/)) {
token.value = '?:';
}
token.value = token.value.trim();

@@ -238,0 +242,0 @@ const {value} = token;

@@ -308,3 +308,2 @@ // ## twig.expression.operator.js

case '==':
/* eslint-disable-next-line eqeqeq */
stack.push(a == b);

@@ -318,3 +317,2 @@ break;

case '!=':
/* eslint-disable-next-line eqeqeq */
stack.push(a != b);

@@ -321,0 +319,0 @@ break;

@@ -6,3 +6,3 @@ // ## twig.factory.js

const Twig = {
VERSION: '1.17.1'
VERSION: '2.0.0'
};

@@ -9,0 +9,0 @@

@@ -144,3 +144,2 @@ // ## twig.filters.js

},
/* eslint-disable-next-line camelcase */
url_encode(value) {

@@ -226,3 +225,2 @@ if (value === undefined || value === null) {

},
/* eslint-disable-next-line camelcase */
json_encode(value) {

@@ -349,3 +347,2 @@ if (value === undefined || value === null) {

},
/* eslint-disable-next-line camelcase */
date_modify(value, params) {

@@ -395,3 +392,3 @@ if (value === undefined || value === null) {

format(value, params) {
if (value === undefined || value === null) {
if (value === undefined || value === null || value === '') {
return;

@@ -545,3 +542,2 @@ }

*/
/* eslint-disable-next-line camelcase */
number_format(value, params) {

@@ -548,0 +544,0 @@ let number = value;

@@ -209,3 +209,2 @@ // ## twig.functions.js

},
/* eslint-disable-next-line camelcase */
template_from_string(template) {

@@ -212,0 +211,0 @@ const state = this;

@@ -10,14 +10,19 @@ // ## twig.lib.js

module.exports = function (Twig) {
const { sprintf, vsprintf, strip_tags } = require('locutus/php/strings/index');
const { round, min, max } = require('locutus/php/math/index');
const { strtotime, date } = require('locutus/php/datetime/index');
const { boolval } = require('locutus/php/var/index');
// Namespace for libraries
Twig.lib = { };
Twig.lib.sprintf = require('locutus/php/strings/sprintf');
Twig.lib.vsprintf = require('locutus/php/strings/vsprintf');
Twig.lib.round = require('locutus/php/math/round');
Twig.lib.max = require('locutus/php/math/max');
Twig.lib.min = require('locutus/php/math/min');
Twig.lib.stripTags = require('locutus/php/strings/strip_tags');
Twig.lib.strtotime = require('locutus/php/datetime/strtotime');
Twig.lib.date = require('locutus/php/datetime/date');
Twig.lib.boolval = require('locutus/php/var/boolval');
Twig.lib.sprintf = sprintf;
Twig.lib.vsprintf = vsprintf;
Twig.lib.round = round;
Twig.lib.max = max;
Twig.lib.min = min;
Twig.lib.stripTags = strip_tags;
Twig.lib.strtotime = strtotime;
Twig.lib.date = date;
Twig.lib.boolval = boolval;

@@ -24,0 +29,0 @@ Twig.lib.is = function (type, obj) {

@@ -719,3 +719,2 @@ // ## twig.logic.js

};
/* eslint-disable-next-line no-unused-vars */
} catch (error) {

@@ -722,0 +721,0 @@ return acc;

Version 1.17.0, release 2023-11-16
----------------------------------
Major improvements:
* Add string position of tokens in token trees by @synga-nl in https://github.com/twigjs/twig.js/pull/859
* Allow multiple spaces after elseif statement. by @antoineveldhoven in https://github.com/twigjs/twig.js/pull/870
* Make is empty return false for boolean true. by @antoineveldhoven in https://github.com/twigjs/twig.js/pull/869
* Add support for spaceship operator by @antoineveldhoven in https://github.com/twigjs/twig.js/pull/873
* Allow colon inside Twig.expression.type.key.brackets. by @antoineveldhoven in https://github.com/twigjs/twig.js/pull/879
* Support variables in slice filter shorthand by @antoineveldhoven in https://github.com/twigjs/twig.js/pull/881
Minor improvements:
* Bump @babel/traverse from 7.12.5 to 7.23.2 by @dependabot in https://github.com/twigjs/twig.js/pull/877
Version 1.16.0, release 2023-02-27
----------------------------------
Major improvements:
* Fix passing context around by @willrowe in https://github.com/twigjs/twig.js/pull/850
* Add namespace support to `source` function by @willrowe in https://github.com/twigjs/twig.js/pull/823
* Use src/twig.js as package's main script instead of the compiled twig.js by @RobLoach in https://github.com/twigjs/twig.js/pull/829
Minor improvements:
* Fix macro changing context in loop by @mihkeleidast in https://github.com/twigjs/twig.js/pull/773
* Imported function PATHS.strip_slash() missing by @murageyun in https://github.com/twigjs/twig.js/pull/770
* Convert non-string values to string before replacing by @kmonahan in https://github.com/twigjs/twig.js/pull/797
* Add GitHub actions test workflow by @willrowe in https://github.com/twigjs/twig.js/pull/817
* Fix date parsing with timezones by @plepe in https://github.com/twigjs/twig.js/pull/765
* Fixed Twig official's URL on README.md by @Geolim4 in https://github.com/twigjs/twig.js/pull/822
* Add tests for whitespace in paths by @willrowe in https://github.com/twigjs/twig.js/pull/824
* Fix multiple includes with embeds by @willrowe in https://github.com/twigjs/twig.js/pull/828
* Update to Mocha 9.x by @RobLoach in https://github.com/twigjs/twig.js/pull/831
* Add test for issue #767 by @willrowe in https://github.com/twigjs/twig.js/pull/837
* Add support for `divisible by` test by @willrowe in https://github.com/twigjs/twig.js/pull/838
* Add support for `with` tag without context or `only` keyword by @willrowe in https://github.com/twigjs/twig.js/pull/839
* Use v3 of `actions/checkout` by @willrowe in https://github.com/twigjs/twig.js/pull/846
* Test on more node versions by @willrowe in https://github.com/twigjs/twig.js/pull/847
* Fix webpack 5 compatibility by @willrowe in https://github.com/twigjs/twig.js/pull/849
* Add test to confirm `renderFile` error handling by @willrowe in https://github.com/twigjs/twig.js/pull/851
* Fix casing of variables in docs by @willrowe in https://github.com/twigjs/twig.js/pull/852
* Bumped dependencies by @dependabot
Version 1.15.4, released 2020-11-27
-----------------------------------
Minor improvements:
* Fix lost context when calling a macro multiple times ([#727](https://github.com/twigjs/twig.js/pull/727)) by [mihkeleidast ](https://github.com/mihkeleidast)
Version 1.15.3, released 2020-11-05
-----------------------------------
Minor improvements:
* Fix documentation of browser usage ([#755](https://github.com/twigjs/twig.js/pull/755)) by [odebparla](https://github.com/obedparla)
* Add support for template arrays when using extends ([#754](https://github.com/twigjs/twig.js/pull/754)) by [justafish](https://github.com/justafish)
Version 1.15.2, released 2020-08-19
-----------------------------------
Minor improvements:
* Specify MimeType to always use for AJAX templates ([#742](https://github.com/twigjs/twig.js/pull/742)) by [MasterOdin](https://github.com/MasterOdin)
* Added token count validation ([#745](https://github.com/twigjs/twig.js/pull/742)) by [HakS](https://github.com/haks)
* Async renderFile error callback ([#748](https://github.com/twigjs/twig.js/pull/748)) by [ArnauMrJeff](https://github.com/ArnauMrJeff)
* Ternary operator overrides context fix ([#737](https://github.com/twigjs/twig.js/issues/737)) by [oleg-andreyev](https://github.com/oleg-andreyev)
* Update lodash to `4.17.19`
* Update elliptic to `6.5.3`
Version 1.15.1, released 2020-04-16
-----------------------------------
Major improvements:
* Make "js" escaped strings embeddable in JSON ([#724](https://github.com/twigjs/twig.js/pull/724) by [@dorian-marchal])
Minor improvements:
* Fix parsing expression when value is `null` ([#735](https://github.com/twigjs/twig.js/pull/735) by [@RobLoach])
Version 1.15.0, released 2020-02-20
-----------------------------------
Major improvements:
* Add support for arrays with `include` ([#681](https://github.com/twigjs/twig.js/pull/681) by [@justafish](https://github.com/justafish))
* Add babel preset on serverBuild ([#707](https://github.com/twigjs/twig.js/pull/707) by [@stephane-r](https://github.com/stephane-r))
* Support for "do" tag ([#703](https://github.com/twigjs/twig.js/pull/703) by [@drzraf](https://github.com/drzraf))
* Update [`xo`](https://www.npmjs.com/package/xo) and code syntax by [@RobLoach](https://github.com/robloach)
* Deprecate Node.js 8 from testing by [@RobLoach](https://github.com/robloach)
* Support for Source Maps ([#700](https://github.com/twigjs/twig.js/pull/700) by [@drzraf](https://github.com/drzraf))
* Search for block within all ascendants instead of parent only ([#698](https://github.com/twigjs/twig.js/pull/698) by [@drzraf](https://github.com/drzraf))
Minor improvements:
* Fix autoescape for empty includes ([#687](https://github.com/twigjs/twig.js/pull/687) by [@tgabi333](https://github.com/tgabi333))
* Fix filters with empty string input ([#690](https://github.com/twigjs/twig.js/pull/690) by [@tbence94](https://github.com/tbence94))
Version 1.14.0, released 2019-11-13
-----------------------------------
Major improvements:
* Add [Babel](https://babeljs.io) to the webpack build
Minor improvements:
* Add `apply` tag ([#656](https://github.com/twigjs/twig.js/pull/656) by [@maxhelias](https://github.com/maxhelias))
* Add `spaceless` filter ([#655](https://github.com/twigjs/twig.js/pull/655) by [@maxhelias](https://github.com/maxhelias))
* Add `deprecated` tag ([#675](https://github.com/twigjs/twig.js/pull/675) by [@josephineb](https://github.com/josephineb))
* Fix `starts with` and `ends with` expressions ([#661](https://github.com/twigjs/twig.js/pull/661) by [@ilkkave](https://github.com/ilkkave))
* Add `package.json` license field to fix npm warning ([#672](https://github.com/twigjs/twig.js/pull/672) by [@WietseWind](https://github.com/WietseWind))
* Update `strict_variables` option to match Twig's strict messages ([#674](https://github.com/twigjs/twig.js/pull/674) by [@toptalo](https://github.com/toptalo))
* Fix `??` operator when used with arrays to return the array rather than its length ([#653](https://github.com/twigjs/twig.js/pull/653) by [@diegorales](https://github.com/diegomorales))
Version 1.13.3, released 2019-05-03
-----------------------------------
Minor improvements:
* Allow project development on Windows ([#611](https://github.com/twigjs/twig.js/pull/611))
* Add possibility to define namespace without slash at the end of the path ([#609](https://github.com/twigjs/twig.js/pull/609))
* Update `verbatim` tag ([#584](https://github.com/twigjs/twig.js/pull/584))
Version 1.13.2, released 2019-01-22
-----------------------------------
Minor improvements:
* fix for not autoescaping includes having a parent ([#606](https://github.com/twigjs/twig.js/pull/606))
Version 1.13.1, released 2019-01-19
-----------------------------------
Minor improvements:
* Fix for not autoescaping includes ([#604](https://github.com/twigjs/twig.js/pull/604))
Version 1.13.0, released 2019-01-09
-----------------------------------
Major improvements:
* Unminified sources in the npm package ([#598](https://github.com/twigjs/twig.js/pull/598))
Minor improvements:
* Multiple namespace performance improvement ([#580](https://github.com/twigjs/twig.js/pull/580))
* `|url_encode` can now extend parameters ([#588](https://github.com/twigjs/twig.js/pull/588))
* Fix `.startsWith` and `.endsWith` with `.indexOf` for IE ([#587](https://github.com/twigjs/twig.js/pull/587))
* Autoescaping improvement ([#577](https://github.com/twigjs/twig.js/pull/577))
* Support null-coalescing operator `??` ([#575](https://github.com/twigjs/twig.js/pull/575))
* Add `verbatim` tag ([#574](https://github.com/twigjs/twig.js/pull/574))
* Fix bug in `for` loop ([#573](https://github.com/twigjs/twig.js/pull/573))
* Fix twig `{% if(x) %}` and `{% elseif(x) %}` blocks parsing error ([#570](https://github.com/twigjs/twig.js/pull/570))
Version 1.12.0, released 2018-06-11
-----------------------------------
Major improvements:
* Fix array declaration on multiple lines (#546)
* Fix extend when add is null (#559)
Minor improvements:
* Improve namespaces support (#556)
* Allow express to render async (#558)
Version 1.11.1, released 2018-05-22
-----------------------------------
Major improvements:
* Upgrade to Webpack 4 (#542)
* Fix embed blocks logic (#537)
Minor improvements:
* Improve detection of when a block is in a loop (#541)
* Add possibility to set default value for a macro parameter (#544)
Version 1.11.0, released 2018-04-10
-----------------------------------
Major improvements:
* Add support for 'with' tag (#497)
* Add date support for json_encode filter (#515)
* Fix 'embed' tag options (#534)
* Performance improvements when including templates (#492)
Minor improvements:
* Fix incorrect 'and' and 'or' behaviour when comparing variables (#481)
* Remove 'trim' filter autoescape (#488)
* Fix empty output from loop with async call (#538)
* Add allowable tags to strip tags filter (#524)
Version 1.10.5, released 2017-05-24
-----------------------------------
Minor improvements:
* Template id is now returned as part of the error when an exception is thrown (#464)
* Test result no longer dependent on the name of the test file (#465)
* Fix unexpected 'const' (#471)
Version 1.10.4, released 2017-03-02
-----------------------------------
Minor improvements:
* Fixed missing changelog updates
Version 1.10.3, released 2017-03-02
-----------------------------------
Major improvements:
* Async rendering and filters (#457)
* From aliases (#438)
* Bitwise operators (#443)
* Fix object method context (#455)
Minor improvements:
* Readme updates (#454)
* 'not' unary can be more widely used (#444)
* Fix `importFile` relative path handling (#449)
Version 0.10.3, released 2016-12-09
-----------------------------------
Minor improvements:
* Spaceless tag no longer escapes Static values (#435)
* Inline includes now load (#433)
* Errors during async fs loading use error callback (#431)
Version 0.10.2, released 2016-11-23
-----------------------------------
Minor improvements:
* Support 'same as' (#429)
* Fix windows colon colon namespace (#430)
Version 0.10.1, released 2016-11-18
-----------------------------------
Minor improvements:
* Fixed missing changelog updates
* Fixed incorrect versions in source
* Rethrow errors when option to do so is set (#422)
Version 0.10.0, released 2016-10-28
-----------------------------------
Bower is no longer supported
Major improvements:
* Updated to locutus which replaces phpjs
* elseif now accepts truthy values (#370)
* Use PHP style falsy matching (#383)
* Fix 'not' after binary expressions (#385)
* Use current context when parsing an include (#395)
* Correct handling of 'ignore missing' in embed and include (#424)
Minor improvements:
* Documentation updates
* Refreshed dependencies
Version 0.9.5, released 2016-05-14
-----------------------------------
Minor improvements:
* Templates that are included via "extends" now populate the parent template context
Version 0.9.4, released 2016-05-13
-----------------------------------
Parentheses parsing has undergone quite a large refactoring, but nothing should have explicitly broken.
Major improvements:
* Subexpressions are now supported and parsed differently from function parameters
Version 0.9.3, released 2016-05-12
-----------------------------------
Fix missing changelog updates
Version 0.9.2, released 2016-05-12
-----------------------------------
Minor improvements:
* Empty strings can now be passed to the date filter
* Twig.expression.resolve keeps the correct context for `this`
Version 0.9.1, released 2016-05-10
-----------------------------------
Fixed changelog versioning
Version 0.9.0, released 2016-05-10
-----------------------------------
Theoretically no breaking changes, but lots of things have changed so it is possible something has slipped through.
Dependencies have been updated. You should run `npm install` to update these.
Major improvements:
* Webpack is now used for builds
* phpjs is now a dependency and replaces our reimplementation of PHP functions (#343)
* Arrays are now cast to booleans unless accessing their contents
* in/not in operator precedence changed (#344)
* Expressions can now be keys (#350)
* The extended ternary operator is now supported (#354)
* Expressions can now appear after period accessor (#356)
* The slice shorthand is now supported (#362)
Minor improvements:
* Twig.exports.renderFile now returns a string rather than a String (#348)
* The value of context is now cloned when setting a variable to context (#345)
* Negative numbers are now correctly parsed (#353)
* The // operator now works correctly (#353)
Version 0.8.9, released 2016-03-18
-----------------------------
Dependencies have been updated to current versions. You should run `npm install` to update these. (#313)
Major improvements:
* Twig's `source` function is now supported (#309)
* It is possible to add additional parsers using Twig.Templates.registerParser() (currently available: twig, source). If you are using a custom loader, please investigate src/twig.loader.fs.js how to call the requested parser. (#309)
* `undefined` and `null` values now supported in the `in` operator (#311)
* Namespaces can now be defined using the '@' symbol (#328)
Minor improvements:
* Undefined object properties now have the value of `undefined` rather than `null` (#311)
* Improved browser tests (#325, #310)
* IE8 fix (#324)
* Path resolution has been refactored to its own module (#323)
Version 0.8.8, released 2016-02-13
----------------------------------
Major improvements:
* Support for [block shortcuts](http://twig.sensiolabs.org/doc/tags/extends.html#block-shortcuts): `{% block title page_title|title %}` (#304)
* Define custom template loaders, by registering them via `Twig.Templates.registerLoader()` (#301)
Minor improvements:
* Some mocha tests didn't work in browsers (#281)
* Fix Twig.renderFile (#303)
[All issues of this milestone](https://github.com/justjohn/twig.js/issues?q=milestone%3A0.8.8)
Version 0.8.7, released 2016-01-20
----------------------------------
Major improvements:
* The `autoescape` option now supports all strategies which are supported by the `escape` filter (#299)
Minor improvements:
* The `date` filter now recognises unix timestamps as input, when they are passed as string (#296)
* The `default` filter now allows to be called without parameters (it will return an empty string in that case) (#295)
* Normalize provided template paths (this generated problems when using nodejs under Windows) (#252, #300)
Version 0.8.6, released 2016-01-05
----------------------------------
Major improvements:
* The `escape` filter now supports the strategy parameter: `{{ var|escape('css') }}` with the following available strategies: html (default), js, css, url, html_attr. (#289)
Minor improvements:
* The filter `url_encode` now also encodes apostrophe (as in Twig.php) (#288)
* Minor bugfixes (#290, #291)
Version 0.8.5, released 2015-12-24
----------------------------------
From 0.8.5 on, a summary of changes between each version will be included in the CHANGELOG.md file.
There were some changes to the [Contribution guidelines](https://github.com/justjohn/twig.js/wiki/Contributing): please commit only changes to source files, the files `twig.js` and `twig.min.js` will be rebuilt when a new version gets released. Therefore you need to run `make` after cloning resp. pulling (if you want to use the development version).
Major improvements:
* Implement `min` and `max` functions (#164)
* Support for the whitespace control modifier: `{{- -}}` (#266)
* `sort` filter: try to cast values to match type (numeric values to number, string otherwise) (#278)
* Support for twig namespaces (#195, #251)
* Support for expressions as object keys: `{% set foo = { (1 + 1): 'bar' } %}` (#284)
Minor improvements:
* Allow integer 0 as key in objects: `{ 0: "value" }` (#186)
* `json_encode` filter: always return objects in order of keys, also ignore the internal key `_keys` for nested objects (#279)
* `date` filter: update to current strtotime() function from phpjs: now support ISO8601 dates as input on Mozilla Firefox. (#276)
* Validate template IDs only when caching is enabled (#233, #259)
* Support xmlhttp.status==0 when using cordova (#240)
* Improved sub template file loading (#264)
* Ignore quotes between `{% raw %}` and `{% endraw %}` (#286)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display