Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mozilla/nunjucks
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b045b8759988eea7a2d2f0ffbd86c67cddeca527
Choose a base ref
...
head repository: mozilla/nunjucks
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fd500902d7c88672470c87170796de52fc0f791a
Choose a head ref

Commits on Oct 29, 2015

  1. Copy the full SHA
    e7d29b4 View commit details

Commits on Jan 6, 2016

  1. Copy the full SHA
    d353626 View commit details
  2. Add test for "sum" filter

    lazopm committed Jan 6, 2016
    Copy the full SHA
    bd06894 View commit details
  3. Fix "sum" filter argument order

    Pablo Lazo committed Jan 6, 2016
    Copy the full SHA
    0f9f948 View commit details
  4. Copy the full SHA
    c85ceb6 View commit details
  5. Merge branch '2.x'

    * 2.x:
      Bump version to 2.4.0-dev.1.
      Update maintenance docs.
      Prep for v2.3.0 release.
      Revert "Fix: [Breaking Change] filter.escape should not escape SafeString (#168)"
    carljm committed Jan 6, 2016
    Copy the full SHA
    56ba335 View commit details
  6. Fix changelog.

    carljm committed Jan 6, 2016
    Copy the full SHA
    6b89b04 View commit details

Commits on Jan 7, 2016

  1. Added test for throwing errors from globals

    Konstantin Burkalev authored and Konstantin Burkalev committed Jan 7, 2016
    Copy the full SHA
    ab6b4ba View commit details
  2. Merge remote-tracking branch 'upstream/master'

    Konstantin Burkalev authored and Konstantin Burkalev committed Jan 7, 2016
    Copy the full SHA
    18c7cde View commit details

Commits on Jan 8, 2016

  1. Copy the full SHA
    0d82f39 View commit details
  2. Merge pull request #631 from oyyd/fix

    Fix unexpected whitespace control behavior, close #595.
    carljm committed Jan 8, 2016
    Copy the full SHA
    430e2fc View commit details
  3. Update changelog.

    carljm committed Jan 8, 2016
    Copy the full SHA
    212b56d View commit details
  4. slightly improved test

    Konstantin Burkalev authored and Konstantin Burkalev committed Jan 8, 2016
    Copy the full SHA
    51b033e View commit details
  5. Tests cleanup. Closes #626

    Konstantin Burkalev authored and Konstantin Burkalev committed Jan 8, 2016
    Copy the full SHA
    ad7e48d View commit details

Commits on Jan 10, 2016

  1. Copy the full SHA
    48be86e View commit details
  2. code style

    oyyd committed Jan 10, 2016
    Copy the full SHA
    fc50f44 View commit details

Commits on Jan 11, 2016

  1. Copy the full SHA
    b5cbabc View commit details
  2. fix asyncif eating error

    oyyd committed Jan 11, 2016
    Copy the full SHA
    89cbe61 View commit details
  3. Merge remote-tracking branch 'upstream/master'

    Konstantin Burkalev authored and Konstantin Burkalev committed Jan 11, 2016
    Copy the full SHA
    19bbb94 View commit details

Commits on Jan 13, 2016

  1. Merge pull request #632 from oyyd/fix

    Support whitespace control in comment blocks, close #332
    carljm committed Jan 13, 2016
    Copy the full SHA
    0b6dd68 View commit details

Commits on Jan 14, 2016

  1. Update changelog.

    carljm committed Jan 14, 2016
    Copy the full SHA
    a90a606 View commit details
  2. Merge pull request #634 from oyyd/fix-asyncif-err

    fix #571, make asyncif handle error
    carljm committed Jan 14, 2016
    Copy the full SHA
    02a69d5 View commit details
  3. Update changelog.

    carljm committed Jan 14, 2016
    Copy the full SHA
    8a6acc3 View commit details
  4. Copy the full SHA
    b45db7a View commit details

Commits on Jan 16, 2016

  1. Fix 'sum' filter test results

    lazopm committed Jan 16, 2016
    Copy the full SHA
    c56f6f4 View commit details

Commits on Jan 18, 2016

  1. Makes urlize conserve any white space char

    Paulo Bu committed Jan 18, 2016
    Copy the full SHA
    efdd638 View commit details

Commits on Jan 19, 2016

  1. fix range template global to work with zero stop-value, for counting …

    …up from a negative number
    devoidfury committed Jan 19, 2016
    Copy the full SHA
    53a9b75 View commit details
  2. Merge pull request #629 from lazopm/master

    Add "sum" filter
    carljm committed Jan 19, 2016
    Copy the full SHA
    2d2f5dd View commit details
  3. Update changelog.

    carljm committed Jan 19, 2016
    Copy the full SHA
    13abcba View commit details
  4. break backwards compatibility for undefined behavior in range (passin…

    …g null, empty string, false as second value)
    devoidfury committed Jan 19, 2016
    Copy the full SHA
    2a7d1b2 View commit details
  5. Merge pull request #637 from pbu88/urlize_keep_ws_chars

    Makes urlize conserve any white space char
    
    * pbu88/urlize_keep_ws_chars:
      Makes urlize conserve any white space char
    carljm committed Jan 19, 2016
    Copy the full SHA
    f715387 View commit details
  6. Merge pull request #638 from devoidfury/fix-range

    fix range template global to work with zero stop-value
    carljm committed Jan 19, 2016
    Copy the full SHA
    8984d58 View commit details
  7. Update changelog.

    carljm committed Jan 19, 2016
    Copy the full SHA
    49c2d02 View commit details

Commits on Jan 20, 2016

  1. Makes urlize conserve any white space char

    Update docs in french #637
    forresst committed Jan 20, 2016
    Copy the full SHA
    916a6e1 View commit details
  2. Merge pull request #640 from forresst/translate-in-french-637

    Makes urlize conserve any white space char
    carljm committed Jan 20, 2016
    Copy the full SHA
    13b384c View commit details
  3. Copy the full SHA
    d0400bb View commit details
  4. Update changelog.

    carljm committed Jan 20, 2016
    Copy the full SHA
    d4b3a07 View commit details

Commits on Jan 21, 2016

  1. enforce linux line endings for test files in order to guarantee test …

    …success on Windows
    jan.rehwaldt committed Jan 21, 2016
    Copy the full SHA
    42d9f13 View commit details
  2. Adds *failing* tests illustrating both issues mentioned in #576. The …

    …additional tests focus on template constructs within the filter block (`{% filter ... %}...{% endfilter %}` as introduced by #254):
    
    1. variable evaluation inside filter block
    2. block declaration inside filter block
    
    Both test are added to the list of `it('should handle filter blocks', ...`, which seems to be the project's convention for grouping tests by feature. Nonetheless, the two added test cases fail in different ways:
    1. The variable expression test fails due to the discarding of any but the first token. Its output is unexpected.
    2. The block declaration test fails due to a reference to undefined. It throws an error.
    
    Both issues are caused by the following line https://github.com/mozilla/nunjucks/blob/d4b3a07603b5a5c8adacb0c54aca53df8c931c73/src/parser.js#L1032. It can easily be seen that the given code comment is only true for text-only filter blocks.
    jan.rehwaldt committed Jan 21, 2016
    Copy the full SHA
    0c42cad View commit details
  3. Merge pull request #646 from jrehwaldt/tests-on-windows

    Tests may fail on Windows due to line ending issues
    carljm committed Jan 21, 2016
    Copy the full SHA
    6ed8d6b View commit details

Commits on Jan 22, 2016

  1. Improve docs for filters

    * add filters `dump` and `sum`
    * Sort list by alphabetical order
    forresst committed Jan 22, 2016
    Copy the full SHA
    fa1d10d View commit details

Commits on Jan 23, 2016

  1. Copy the full SHA
    c98b4ce View commit details

Commits on Jan 24, 2016

  1. Merge pull request #648 from forresst/improve-docs-filters

    Improve docs for filters
    carljm committed Jan 24, 2016
    Copy the full SHA
    8e086ae View commit details

Commits on Jan 25, 2016

  1. Copy the full SHA
    a582818 View commit details
  2. Merge pull request #649 from oyyd/cn-doc

    update Chinese documentation for builtin filters
    carljm committed Jan 25, 2016
    Copy the full SHA
    b9e04a0 View commit details

Commits on Jan 28, 2016

  1. do not resolve up in macro

    oyyd committed Jan 28, 2016
    Copy the full SHA
    6f78089 View commit details

Commits on Jan 29, 2016

  1. Copy the full SHA
    fe7e653 View commit details
  2. Merge pull request #653 from oyyd/macro-resolveup

    Do not resolve up when setting a variable in macro.
    carljm committed Jan 29, 2016
    Copy the full SHA
    a9b85a8 View commit details

Commits on Jan 30, 2016

  1. Copy the full SHA
    aeb4f6a View commit details
  2. Some code clean-up to conform the project's coding style. Also added …

    …one more test for set block assignments
    daniele-rapagnani committed Jan 30, 2016
    Copy the full SHA
    6dc41c3 View commit details
Showing with 16,857 additions and 40,028 deletions.
  1. +19 −0 .babelrc
  2. 0 .jshintignore → .eslintignore
  3. +52 −0 .eslintrc.js
  4. +6 −0 .gitattributes
  5. +23 −0 .github/PULL_REQUEST_TEMPLATE.md
  6. +43 −0 .github/workflows/tests.yml
  7. +10 −1 .gitignore
  8. +0 −31 .jshintrc
  9. +3 −0 .npmignore
  10. +0 −8 .travis.yml
  11. +234 −1 CHANGELOG.md
  12. +15 −0 CODE_OF_CONDUCT.md
  13. +40 −17 CONTRIBUTING.md
  14. +29 −6 README.md
  15. +5 −6 appveyor.yml
  16. +0 −8 bin/bundle
  17. +0 −88 bin/bundle.js
  18. +43 −55 bin/precompile
  19. +3 −2 bower.json
  20. +0 −2,678 browser/nunjucks-slim.js
  21. +0 −2 browser/nunjucks-slim.min.js
  22. +0 −6,330 browser/nunjucks.js
  23. +0 −4 browser/nunjucks.min.js
  24. +2 −0 codecov.yml
  25. +2 −2 docs/README.md
  26. +2 −1 docs/_config.yml
  27. +3 −1 docs/_layouts/page.html
  28. +60 −13 docs/api.md
  29. +12 −12 docs/cn/api.md
  30. +2 −2 docs/cn/getting-started.md
  31. +67 −27 docs/cn/templating.md
  32. +10 −1 docs/css/app.css
  33. +12 −2 docs/faq.md
  34. +45 −8 docs/fr/api.md
  35. +2 −1 docs/fr/faq.md
  36. +16 −12 docs/fr/getting-started.md
  37. +1,074 −113 docs/fr/templating.md
  38. +22 −0 docs/getting-started.md
  39. BIN docs/img/favicon.png
  40. +1 −30 docs/index.html
  41. +1,115 −76 docs/templating.md
  42. +0 −86 index.js
  43. +88 −0 nunjucks/index.js
  44. +1,200 −0 nunjucks/src/compiler.js
  45. +590 −0 nunjucks/src/environment.js
  46. +24 −0 nunjucks/src/express-app.js
  47. +648 −0 nunjucks/src/filters.js
  48. +73 −0 nunjucks/src/globals.js
  49. +305 −0 nunjucks/src/jinja-compat.js
  50. +539 −0 nunjucks/src/lexer.js
  51. +395 −0 nunjucks/src/lib.js
  52. +14 −0 nunjucks/src/loader.js
  53. 0 { → nunjucks}/src/loaders.js
  54. +150 −0 nunjucks/src/node-loaders.js
  55. +270 −0 nunjucks/src/nodes.js
  56. +85 −0 nunjucks/src/object.js
  57. +1,368 −0 nunjucks/src/parser.js
  58. +24 −0 nunjucks/src/precompile-global.js
  59. +134 −0 nunjucks/src/precompile.js
  60. +27 −0 nunjucks/src/precompiled-loader.js
  61. +380 −0 nunjucks/src/runtime.js
  62. +290 −0 nunjucks/src/tests.js
  63. +217 −0 nunjucks/src/transformer.js
  64. +95 −0 nunjucks/src/web-loaders.js
  65. +79 −14 package.json
  66. +3 −1 {tests/express-sample → samples/express}/js/app.js
  67. +48 −0 samples/express/js/extensions.js
  68. +37 −0 samples/express/main.js
  69. +28 −0 samples/express/pre.js
  70. +1 −1 {tests/express-sample → samples/express}/views/about.html
  71. 0 {tests/express-sample → samples/express}/views/base.html
  72. 0 {tests/express-sample → samples/express}/views/import-context-set.html
  73. +7 −0 samples/express/views/index.html
  74. 0 {tests/express-sample → samples/express}/views/item-base.html
  75. +1 −1 {tests/express-sample → samples/express}/views/item.html
  76. 0 {tests/express-sample → samples/express}/views/set.html
  77. +136 −0 scripts/bundle.js
  78. +17 −0 scripts/lib/arrow-function-coverage-fix.js
  79. +10 −0 scripts/lib/is-main-module.js
  80. +57 −0 scripts/lib/mocha-phantomjs.js
  81. +21 −0 scripts/lib/precompile.js
  82. +89 −0 scripts/lib/runtests.js
  83. +27 −0 scripts/lib/static-server.js
  84. +40 −0 scripts/lib/utils.js
  85. +36 −0 scripts/testrunner.js
  86. +0 −1,179 src/compiler.js
  87. +0 −589 src/environment.js
  88. +0 −577 src/filters.js
  89. +0 −79 src/globals.js
  90. +0 −156 src/jinja-compat.js
  91. +0 −514 src/lexer.js
  92. +0 −299 src/lib.js
  93. +0 −33 src/loader.js
  94. +0 −85 src/node-loaders.js
  95. +0 −303 src/nodes.js
  96. +0 −64 src/object.js
  97. +0 −1,284 src/parser.js
  98. +0 −24 src/precompile-global.js
  99. +0 −137 src/precompile.js
  100. +0 −22 src/precompiled-loader.js
  101. +0 −362 src/runtime.js
  102. +0 −239 src/transformer.js
  103. +0 −96 src/web-loaders.js
  104. +23 −0 tests/.eslintrc.js
  105. +93 −52 tests/api.js
  106. +0 −1,284 tests/browser/expect.js
  107. +17 −4 tests/browser/index.html
  108. +0 −246 tests/browser/mocha.css
  109. +0 −12,417 tests/browser/mocha.js
  110. +65 −0 tests/browser/slim.html
  111. +48 −0 tests/cli.js
  112. +2,124 −1,297 tests/compiler.js
  113. +76 −0 tests/core.js
  114. +0 −49 tests/express-sample/js/extensions.js
  115. +0 −4,913 tests/express-sample/js/nunjucks-dev.js
  116. +0 −1 tests/express-sample/js/nunjucks-min.js
  117. +0 −1,742 tests/express-sample/js/nunjucks.js
  118. +0 −36 tests/express-sample/js/require.js
  119. +0 −107 tests/express-sample/js/templates.js
  120. +0 −26 tests/express-sample/main.js
  121. +0 −16 tests/express-sample/pre.js
  122. +0 −7 tests/express-sample/views/index.html
  123. +45 −0 tests/express.js
  124. +0 −37 tests/express/express.js
  125. +1,008 −569 tests/filters.js
  126. +150 −141 tests/globals.js
  127. +126 −0 tests/jinja-compat.js
  128. +705 −369 tests/lexer.js
  129. +142 −59 tests/loader.js
  130. +925 −775 tests/parser.js
  131. +50 −19 tests/precompile.js
  132. +114 −64 tests/runtime.js
  133. +2 −0 tests/setup.js
  134. 0 tests/templates/{async.j2 → async.njk}
  135. +1 −1 tests/templates/{base-inherit.j2 → base-inherit.njk}
  136. +1 −1 tests/templates/{base-set-outside-block.j2 → base-set-and-show.njk}
  137. +1 −0 tests/templates/base-set-inside-block.njk
  138. 0 tests/templates/{base-set-wraps-block.j2 → base-set-wraps-block.njk}
  139. +1 −0 tests/templates/base-set.njk
  140. +1 −0 tests/templates/base-show.njk
  141. 0 tests/templates/{base.j2 → base.njk}
  142. 0 tests/templates/{base2.j2 → base2.njk}
  143. 0 tests/templates/{base3.j2 → base3.njk}
  144. +3 −0 tests/templates/broken-conditional-include.njk
  145. +2 −0 tests/templates/broken-import.njk
  146. 0 tests/templates/{for-async-content.j2 → for-async-content.njk}
  147. 0 tests/templates/{import-context-set.j2 → import-context-set.njk}
  148. 0 tests/templates/{import-context.j2 → import-context.njk}
  149. +1 −1 tests/templates/{import-macro-call-undefined-macro.j2 → import-macro-call-undefined-macro.njk}
  150. 0 tests/templates/{import.j2 → import.njk}
  151. 0 tests/templates/{include-in-loop.j2 → include-in-loop.njk}
  152. 0 tests/templates/{include-set.j2 → include-set.njk}
  153. 0 tests/templates/{include.j2 → include.njk}
  154. +130 −0 tests/templates/includeMany.njk
  155. 0 tests/templates/{item.j2 → item.njk}
  156. +1 −1 tests/templates/{macro-call-undefined-macro.j2 → macro-call-undefined-macro.njk}
  157. +0 −1 tests/templates/relative/dir1/index.j2
  158. +1 −0 tests/templates/relative/dir1/index.njk
  159. 0 tests/templates/relative/dir1/{macros.j2 → macros.njk}
  160. +0 −1 tests/templates/relative/dir2/index.j2
  161. +1 −0 tests/templates/relative/dir2/index.njk
  162. 0 tests/templates/relative/dir2/{macros.j2 → macros.njk}
  163. +0 −2 tests/templates/relative/test-cache.j2
  164. +2 −0 tests/templates/relative/test-cache.njk
  165. +1 −1 tests/templates/relative/{test1.j2 → test1.njk}
  166. +1 −1 tests/templates/relative/{test2.j2 → test2.njk}
  167. 0 tests/templates/{set.j2 → set.njk}
  168. 0 tests/templates/{simple-base.j2 → simple-base.njk}
  169. +1 −0 tests/templates/throws.njk
  170. 0 tests/templates/{undefined-macro.j2 → undefined-macro.njk}
  171. 0 tests/test-node-pkgs/dummy-pkg/index.js
  172. +12 −0 tests/test-node-pkgs/dummy-pkg/package.json
  173. +1 −0 tests/test-node-pkgs/dummy-pkg/simple-template.html
  174. +260 −0 tests/tests.js
  175. +197 −105 tests/util.js
19 changes: 19 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"presets": [
["@babel/env", {
"loose": true,
"targets": {
"browsers": ["last 2 versions", "safari >= 7", "ie 9"],
"node": "6"
}
}]
],
"env": {
"test": {
"plugins": ["./scripts/lib/arrow-function-coverage-fix", "istanbul"]
}
},
"ignore": [
"scripts/lib/arrow-function-coverage-fix.js"
]
}
File renamed without changes.
52 changes: 52 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module.exports = {
'extends': [
'airbnb-base/legacy',
],
'parserOptions': {
'sourceType': 'module',
'ecmaVersion': 2017,
},
'env': {
'node': true,
'es6': true,
},
"rules": {
// The one assertion of personal preference: no spaces before parentheses
// of anonymous functions
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
// Temporarily disabled rules
//
// no-use-before-define is a good rule, but it would make the diff for
// linting the code even more inscrutible than it already is.
'no-use-before-define': 'off',
// Relax some rules
'no-cond-assign': ['error', 'except-parens'],
'no-unused-vars': ['error', {
'args': 'none',
}],
// Disable some overly-strict airbnb style rules
'no-underscore-dangle': 'off',
'no-param-reassign': 'off',
'class-methods-use-this': 'off',
'function-paren-newline': 'off',
'no-plusplus': 'off',
'object-curly-spacing': 'off',
'no-multi-assign': 'off',
'no-else-return': 'off',
// While technically useless from the point of view of the regex parser,
// escaping characters inside character classes is more consistent. I
// would say that they make the regular expression more readable, if the
// idea of readable regular expressions wasn't absurd on its face.
'no-useless-escape': 'off',
// I'm inclined to reverse this rule to be ['error', 'always'], but not just yet
// IE 8 is a thing of the past and trailing commas are useful.
'comma-dangle': 'off',
},
'globals': {
'nunjucks': false,
},
};
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Checkout example and test fixtures with linux line ending
# to guarantee test successes
tests/** text eol=lf
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Summary

Proposed change:

<!--
Please replace this with a human-friendly description of your proposed change.
* If you have multiple changes, try to split them into separate PRs.
* If this change closes an issue, please write "Closes #{number}".
-->

Closes # .


## Checklist

I've completed the checklist below to ensure I didn't forget anything. This makes reviewing this PR as easy as possible for the maintainers. And it gets this change released as soon as possible.

* [ ] Proposed change helps towards [*purpose of this project*](https://github.com/mozilla/nunjucks/blob/master/CONTRIBUTING.md#purpose).
* [ ] [*Documentation*](https://github.com/mozilla/nunjucks/tree/master/docs/) is added / updated to describe proposed change.
* [ ] [*Tests*](https://github.com/mozilla/nunjucks/tree/master/tests) are added / updated to cover proposed change.
* [ ] [*Changelog*](https://github.com/mozilla/nunjucks/blob/master/CHANGELOG.md) has an entry for proposed change (if user-facing fix or feature).

<!-- Tick of items by replacing `[ ]` by `[x]` -->
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests

on:
push:
branches:
- '**'
pull_request:
branches:
- master
paths:
- '**/*.js'
- 'package.json'
- '**/*.njk'
- '**/*.yml'
- 'tests/**/*.html'

jobs:
tests:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [11.x, 10.x, 8.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
id: cache-node-modules
with:
path: node_modules
key: ${{ matrix.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
- run: npm install
if: steps.cache-node-modules.outputs.cache-hit != 'true'
- run: npm test
# Commented out until this action is added in organization settings
# - name: Report coverage
# if: success()
# uses: codecov/codecov-action@v1
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,13 @@ node_modules
coverage
.#*
docs/_site
docs/files
docs/files
/src/
/index.js
/index.js.map
/tests/browser/nunjucks*
.nyc_output
/browser
/tests/browser/precompiled-templates.js
/samples/express/js/nunjucks.js
/samples/express/js/templates.js
31 changes: 0 additions & 31 deletions .jshintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
node_modules
coverage
.nyc_output
docs
tests
bench
nunjucks
scripts
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

Loading