-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix nunjucks for windows: relative paths and tests #391
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dda4e84
Fix escape for windows path
SamyPesse f08182c
Add method to normalize EOL in tests
SamyPesse 5b48f29
Improve EOL normalization for tests
SamyPesse f58fd64
Add appveyor.yml for windows testing
SamyPesse 3b2f4ea
Remove make as testing dependency
SamyPesse 7ff10e3
Use explicit path to mocha bin in test script
SamyPesse ff075af
Fix #392: fix precompile.js for strict mode
SamyPesse ce18959
Add very simple test for precompile
SamyPesse 41dd01c
Disable windows tests for node 0.8
SamyPesse 0f8b21b
Simplify EOL norm regex in tests
SamyPesse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Fix line endings in Windows. (runs before repo cloning) | ||
init: | ||
- git config --global core.autocrlf input | ||
|
||
# Test against these versions of Node.js. | ||
environment: | ||
matrix: | ||
- nodejs_version: "0.11" | ||
- nodejs_version: "0.10" | ||
|
||
# Install scripts. (runs after repo cloning) | ||
install: | ||
# Get the latest stable version of Node.js or io.js | ||
- ps: Install-Product node $env:nodejs_version | ||
# install modules | ||
- npm install | ||
|
||
# Post-install test scripts. | ||
test_script: | ||
# Output useful info for debugging. | ||
- node --version | ||
- npm --version | ||
# run tests | ||
- npm test | ||
|
||
# Don't actually build. | ||
build: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
var expect, precompile, precompileString; | ||
|
||
if(typeof require !== 'undefined') { | ||
expect = require('expect.js'); | ||
precompile = require('../src/precompile').precompile; | ||
precompileString = require('../src/precompile').precompileString; | ||
} | ||
else { | ||
expect = window.expect; | ||
precompile = nunjucks.precompile; | ||
precompileString = nunjucks.precompileString | ||
} | ||
|
||
describe('precompile', function() { | ||
it('should return a string', function() { | ||
expect(precompileString("{{ test }}", { name: "test.html" })).to.be.an('string'); | ||
}); | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use
JSON.stringify
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we need to escape the
templateName
to be work in a javascript string, I think it's most secure way to do it, we need to handle\
,"
,'
, ...By using
.replace
, we may forget one case or not handle the combinaison.What is you suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other solution could be the use of https://github.com/joliss/js-string-escape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sound good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
JSON.stringify
is ok in this case that is only replace"
originally.