Template Upload
This commit is contained in:
14
node_modules/preserve/.gitattributes
generated
vendored
Normal file
14
node_modules/preserve/.gitattributes
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# Enforce Unix newlines
|
||||
*.* text eol=lf
|
||||
*.css text eol=lf
|
||||
*.html text eol=lf
|
||||
*.js text eol=lf
|
||||
*.json text eol=lf
|
||||
*.less text eol=lf
|
||||
*.md text eol=lf
|
||||
*.yml text eol=lf
|
||||
|
||||
*.jpg binary
|
||||
*.gif binary
|
||||
*.png binary
|
||||
*.jpeg binary
|
24
node_modules/preserve/.jshintrc
generated
vendored
Normal file
24
node_modules/preserve/.jshintrc
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"asi": false,
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"esnext": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"laxcomma": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"node": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"globals": {
|
||||
"define": true,
|
||||
"before": true,
|
||||
"after": true,
|
||||
"describe": true,
|
||||
"it": true
|
||||
}
|
||||
}
|
53
node_modules/preserve/.npmignore
generated
vendored
Normal file
53
node_modules/preserve/.npmignore
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# Numerous always-ignore extensions
|
||||
*.csv
|
||||
*.dat
|
||||
*.diff
|
||||
*.err
|
||||
*.gz
|
||||
*.log
|
||||
*.orig
|
||||
*.out
|
||||
*.pid
|
||||
*.rar
|
||||
*.rej
|
||||
*.seed
|
||||
*.swo
|
||||
*.swp
|
||||
*.vi
|
||||
*.yo-rc.json
|
||||
*.zip
|
||||
*~
|
||||
.ruby-version
|
||||
lib-cov
|
||||
npm-debug.log
|
||||
|
||||
# Always-ignore dirs
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
/temp/
|
||||
/tmp/
|
||||
/vendor/
|
||||
_gh_pages
|
||||
|
||||
# OS or Editor folders
|
||||
*.esproj
|
||||
*.komodoproject
|
||||
.komodotools
|
||||
*.sublime-*
|
||||
._*
|
||||
.cache
|
||||
.DS_Store
|
||||
.idea
|
||||
.project
|
||||
.settings
|
||||
.tmproj
|
||||
nbproject
|
||||
Thumbs.db
|
||||
|
||||
# grunt-html-validation
|
||||
validation-status.json
|
||||
validation-report.json
|
||||
|
||||
# misc
|
||||
TODO.md
|
||||
benchmark
|
3
node_modules/preserve/.travis.yml
generated
vendored
Normal file
3
node_modules/preserve/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
59
node_modules/preserve/.verb.md
generated
vendored
Normal file
59
node_modules/preserve/.verb.md
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
# {%= name %} {%= badge("fury") %}
|
||||
|
||||
> {%= description %}
|
||||
|
||||
Useful for protecting tokens, like templates in HTML, from being mutated when the string is transformed in some way, like from a formatter/beautifier.
|
||||
|
||||
**Example without `preserve`**
|
||||
|
||||
Let's say you want to use [js-beautify] on a string of html with Lo-Dash/Underscore templates, such as: `<ul><li><%= name %></li></ul>`:
|
||||
|
||||
js-beautify will render the template unusable (and apply incorrect formatting because of the unfamiliar syntax from the Lo-Dash template):
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li>
|
||||
<%=n ame %>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
**Example with `preserve`**
|
||||
|
||||
Correct.
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li><%= name %></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
For the record, this is just a random example, I've had very few issues with js-beautify in general. But with or without js-beautify, this kind of token mangling does happen sometimes when you use formatters, beautifiers or similar tools.
|
||||
|
||||
## Install
|
||||
{%= include("install-npm", {save: true}) %}
|
||||
|
||||
## Run tests
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
## API
|
||||
{%= apidocs("index.js") %}
|
||||
|
||||
## Contributing
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %})
|
||||
|
||||
## Author
|
||||
{%= include("author") %}
|
||||
|
||||
## License
|
||||
{%= copyright() %}
|
||||
{%= license() %}
|
||||
|
||||
***
|
||||
|
||||
{%= include("footer") %}
|
||||
|
||||
[js-beautify]: https://github.com/beautify-web/js-beautify
|
24
node_modules/preserve/LICENSE
generated
vendored
Normal file
24
node_modules/preserve/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
|
||||
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.
|
90
node_modules/preserve/README.md
generated
vendored
Normal file
90
node_modules/preserve/README.md
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
# preserve [](http://badge.fury.io/js/preserve)
|
||||
|
||||
> Temporarily substitute tokens in the given `string` with placeholders, then put them back after transforming the string.
|
||||
|
||||
Useful for protecting tokens, like templates in HTML, from being mutated when the string is transformed in some way, like from a formatter/beautifier.
|
||||
|
||||
**Example without `preserve`**
|
||||
|
||||
Let's say you want to use [js-beautify] on a string of html with Lo-Dash/Underscore templates, such as: `<ul><li><%= name %></li></ul>`:
|
||||
|
||||
js-beautify will render the template unusable (and apply incorrect formatting because of the unfamiliar syntax from the Lo-Dash template):
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li>
|
||||
<%=n ame %>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
**Example with `preserve`**
|
||||
|
||||
Correct.
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li><%= name %></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
For the record, this is just a random example, I've had very few issues with js-beautify in general. But with or without js-beautify, this kind of token mangling does happen sometimes when you use formatters, beautifiers or similar tools.
|
||||
|
||||
## Install
|
||||
## Install with [npm](npmjs.org)
|
||||
|
||||
```bash
|
||||
npm i preserve --save
|
||||
```
|
||||
|
||||
## Run tests
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
## API
|
||||
### [.before](index.js#L23)
|
||||
|
||||
Replace tokens in `str` with a temporary, heuristic placeholder.
|
||||
|
||||
* `str` **{String}**
|
||||
* `returns` **{String}**: String with placeholders.
|
||||
|
||||
```js
|
||||
tokens.before('{a\\,b}');
|
||||
//=> '{__ID1__}'
|
||||
```
|
||||
|
||||
### [.after](index.js#L44)
|
||||
|
||||
Replace placeholders in `str` with original tokens.
|
||||
|
||||
* `str` **{String}**: String with placeholders
|
||||
* `returns` **{String}** `str`: String with original tokens.
|
||||
|
||||
```js
|
||||
tokens.after('{__ID1__}');
|
||||
//=> '{a\\,b}'
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/preserve/issues)
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
Copyright (c) 2015-2015, Jon Schlinkert.
|
||||
Released under the MIT license
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb](https://github.com/assemble/verb) on January 10, 2015._
|
||||
|
||||
[js-beautify]: https://github.com/beautify-web/js-beautify
|
54
node_modules/preserve/index.js
generated
vendored
Normal file
54
node_modules/preserve/index.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/*!
|
||||
* preserve <https://github.com/jonschlinkert/preserve>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Replace tokens in `str` with a temporary, heuristic placeholder.
|
||||
*
|
||||
* ```js
|
||||
* tokens.before('{a\\,b}');
|
||||
* //=> '{__ID1__}'
|
||||
* ```
|
||||
*
|
||||
* @param {String} `str`
|
||||
* @return {String} String with placeholders.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.before = function before(str, re) {
|
||||
return str.replace(re, function (match) {
|
||||
var id = randomize();
|
||||
cache[id] = match;
|
||||
return '__ID' + id + '__';
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Replace placeholders in `str` with original tokens.
|
||||
*
|
||||
* ```js
|
||||
* tokens.after('{__ID1__}');
|
||||
* //=> '{a\\,b}'
|
||||
* ```
|
||||
*
|
||||
* @param {String} `str` String with placeholders
|
||||
* @return {String} `str` String with original tokens.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.after = function after(str) {
|
||||
return str.replace(/__ID(.{5})__/g, function (_, id) {
|
||||
return cache[id];
|
||||
});
|
||||
};
|
||||
|
||||
function randomize() {
|
||||
return Math.random().toString().slice(2, 7);
|
||||
}
|
||||
|
||||
var cache = {};
|
95
node_modules/preserve/package.json
generated
vendored
Normal file
95
node_modules/preserve/package.json
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"preserve@^0.2.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\braces"
|
||||
]
|
||||
],
|
||||
"_from": "preserve@>=0.2.0-0 <0.3.0-0",
|
||||
"_id": "preserve@0.2.0",
|
||||
"_inCache": true,
|
||||
"_location": "/preserve",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "1.4.23",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "preserve",
|
||||
"raw": "preserve@^0.2.0",
|
||||
"rawSpec": "^0.2.0",
|
||||
"scope": null,
|
||||
"spec": ">=0.2.0-0 <0.3.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/braces"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz",
|
||||
"_shasum": "815ed1f6ebc65926f865b310c0713bcb3315ce4b",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "preserve@^0.2.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\braces",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/preserve/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Temporarily substitute tokens in the given `string` with placeholders, then put them back after transforming the string.",
|
||||
"devDependencies": {
|
||||
"benchmarked": "^0.1.3",
|
||||
"chalk": "^0.5.1",
|
||||
"js-beautify": "^1.5.4",
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "815ed1f6ebc65926f865b310c0713bcb3315ce4b",
|
||||
"tarball": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"gitHead": "1bf405d35e4aea06a2ee83db2d34dc54abc0a1f9",
|
||||
"homepage": "https://github.com/jonschlinkert/preserve",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"escape",
|
||||
"format",
|
||||
"placeholder",
|
||||
"placeholders",
|
||||
"prettify",
|
||||
"regex",
|
||||
"replace",
|
||||
"template",
|
||||
"templates",
|
||||
"token",
|
||||
"tokens"
|
||||
],
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/jonschlinkert/preserve/blob/master/LICENSE-MIT"
|
||||
},
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
}
|
||||
],
|
||||
"name": "preserve",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jonschlinkert/preserve.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
},
|
||||
"version": "0.2.0"
|
||||
}
|
48
node_modules/preserve/test.js
generated
vendored
Normal file
48
node_modules/preserve/test.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* preserve <https://github.com/jonschlinkert/preserve>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var should = require('should');
|
||||
var tokens = require('./');
|
||||
|
||||
var re = /<%=\s*[^>]+%>/g;
|
||||
var pretty = function(str) {
|
||||
return require('js-beautify').html(str, {
|
||||
indent_char: ' ',
|
||||
indent_size: 2,
|
||||
});
|
||||
};
|
||||
|
||||
describe('preserve tokens', function () {
|
||||
var testRe = /__ID.{5}__\n__ID.{5}__\n__ID.{5}__/;
|
||||
var re = /<%=\s*[^>]+%>/g;
|
||||
|
||||
it('should (e.g. shouldn\'t, but will) mangle tokens in the given string', function () {
|
||||
var html = pretty('<ul><li><%= name %></li></ul>');
|
||||
html.should.equal('<ul>\n <li>\n <%=n ame %>\n </li>\n</ul>');
|
||||
});
|
||||
|
||||
it('should preserve tokens in the given string', function () {
|
||||
var html = tokens.after(pretty(tokens.before('<ul><li><%= name %></li></ul>', re)));
|
||||
html.should.equal('<ul>\n <li><%= name %></li>\n</ul>');
|
||||
});
|
||||
|
||||
describe('.before()', function () {
|
||||
it('should replace matches with placeholder tokens:', function () {
|
||||
tokens.before('<%= a %>\n<%= b %>\n<%= c %>', re).should.match(testRe);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tokens.after()', function () {
|
||||
it('should replace placeholder tokens with original values:', function () {
|
||||
var before = tokens.before('<%= a %>\n<%= b %>\n<%= c %>', re);
|
||||
before.should.match(testRe);
|
||||
tokens.after(before).should.equal('<%= a %>\n<%= b %>\n<%= c %>');
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user