diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ccd383d..8686324 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,34 +2,90 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -53,9 +109,8 @@ - - - + + @@ -63,9 +118,8 @@ - - - + + @@ -73,9 +127,8 @@ - - - + + @@ -83,9 +136,8 @@ - - - + + @@ -93,9 +145,8 @@ - - - + + @@ -103,51 +154,44 @@ - - - + + - - - - - - - - - - - - - - - - - - - - - - - + - - - + + - + - - + + + + + + + + + + + + + + + + + + + @@ -269,62 +313,22 @@ $PROJECT_DIR$/gulpfile.js - - - scripts - - - vendor - - - remote - - - styles - - - partials - - - index - - - clean - - - - - - default - - DEFINITION_ORDER - - - - - - - - - - - - + - @@ -340,44 +344,48 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -472,7 +480,6 @@ true - $USER_HOME$/.nvm/versions/node/v8.1.3/bin/node @@ -489,37 +496,33 @@ $PROJECT_DIR$ true - bdd DIRECTORY false - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - C:\Users\mdonnel\AppData\Roaming\Subversion 125 @@ -585,6 +588,9 @@ + + + 1471450226774 @@ -933,61 +939,63 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -1074,7 +1082,6 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1095,35 +1137,28 @@ - + - + - - - - - - - - + - + @@ -1131,283 +1166,189 @@ - - - - - - - - - - - - - - - + - + - + - + - + - + - + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - + + - + - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + - - + - - - - - - - - - - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/news.js b/news.js index 509312e..d0930ce 100644 --- a/news.js +++ b/news.js @@ -12,6 +12,31 @@ var logger = log4js.getLogger(); // feeds.simple_test_feed = require("./config/feed").feed; // Or define in-line +const f = ["http://qz.com/feed/", + "http://feeds2.feedburner.com/businessinsider", + "http://feeds.reuters.com/reuters/UKTopNews", + "http://feeds.reuters.com/reuters/UKdomesticNews", + "http://feeds.reuters.com/reuters/UKWorldNews", + "http://feeds.reuters.com/reuters/topNews", + "http://feeds.reuters.com/Reuters/worldNews", + "http://hosted2.ap.org/atom/APDEFAULT/cae69a7523db45408eeb2b3a98c0c9c5", + "http://www.cityam.com/feeds/main.xml", + "http://www.londonlovesbusiness.com/navrss?navsectioncode=121", + "http://www.ibtimes.co.uk/rss/uk", + "http://feeds.bbci.co.uk/news/rss.xml?edition=uk", + "http://feeds.bbci.co.uk/news/scotland/rss.xml?edition=uk", + "http://news.google.com/?output=rss", + "http://feeds.feedburner.com/TheAtlantic", + "http://www.telegraph.co.uk/news/rss.xml", + "http://www.guardian.co.uk/rssfeed/0,,1,00.xml", + "http://feeds.marketwatch.com/marketwatch/topstories", + "http://feeds.feedburner.com/wingsoverscotland/FgKv", + "http://bellacaledonia.org.uk/feed/", + "http://www.theweek.co.uk/feeds/all", + "http://fivethirtyeight.com/all/feed"]; + + + feeds.simple_test_feed = { 'feed_name': 'feed', 'default_count': 1, @@ -68,9 +93,9 @@ feeds.simple_test_feed = { 'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.theweek.co.uk%2Ffeeds%2Fall' }, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffivethirtyeight.com%2Fall%2Ffeed'}] -} +}; + -; var braider_options = { feeds: feeds, indent: ' ', diff --git a/node_modules/ejs/Jakefile b/node_modules/ejs/Jakefile index 28defba..225e3eb 100644 --- a/node_modules/ejs/Jakefile +++ b/node_modules/ejs/Jakefile @@ -1,10 +1,12 @@ -var fs = require('fs') - , buildOpts = { - printStdout: true - , printStderr: true - }; +var fs = require('fs'); +var execSync = require('child_process').execSync; +var exec = function (cmd) { + execSync(cmd, {stdio: 'inherit'}); +}; -task('build', ['browserify', 'minify'], function () { +/* global jake, task, desc, publishTask */ + +task('build', ['lint', 'clean', 'browserify', 'minify'], function () { console.log('Build completed.'); }); @@ -12,35 +14,57 @@ desc('Cleans browerified/minified files and package files'); task('clean', ['clobber'], function () { jake.rmRf('./ejs.js'); jake.rmRf('./ejs.min.js'); + console.log('Cleaned up compiled files.'); }); -task('browserify', {async: true}, function () { - jake.exec('./node_modules/browserify/bin/cmd.js lib/ejs.js > ejs.js', - buildOpts, function () { - console.log('Browserification completed.'); - setTimeout(complete, 0); - }); +desc('Lints the source code'); +task('lint', function () { + exec('./node_modules/.bin/eslint "**/*.js" Jakefile'); + console.log('Linting completed.'); }); -task('minify', {async: true}, function () { - jake.exec('./node_modules/uglify-js/bin/uglifyjs ejs.js > ejs.min.js', - buildOpts, function () { - console.log('Minification completed.'); - setTimeout(complete, 0); - }); +task('browserify', function () { + exec('./node_modules/browserify/bin/cmd.js --standalone ejs lib/ejs.js > ejs.js'); + console.log('Browserification completed.'); +}); + +task('minify', function () { + exec('./node_modules/uglify-js/bin/uglifyjs ejs.js > ejs.min.js'); + console.log('Minification completed.'); +}); + +task('doc', function (dev) { + jake.rmRf('out'); + var p = dev ? '-p' : ''; + exec('./node_modules/.bin/jsdoc ' + p + ' -c jsdoc.json lib/* docs/jsdoc/*'); + console.log('Documentation generated.'); +}); + +task('docPublish', ['doc'], function () { + fs.writeFileSync('out/CNAME', 'api.ejs.co'); + console.log('Pushing docs to gh-pages...'); + exec('./node_modules/.bin/git-directory-deploy --directory out/'); + console.log('Docs published to gh-pages.'); +}); + +task('test', ['lint'], function () { + exec('./node_modules/.bin/mocha'); }); publishTask('ejs', ['build'], function () { this.packageFiles.include([ - 'Jakefile' - , 'README.md' - , 'LICENSE' - , 'package.json' - , 'ejs.js' - , 'ejs.min.js' - , 'lib/**' - , 'test/**' + 'Jakefile', + 'README.md', + 'LICENSE', + 'package.json', + 'ejs.js', + 'ejs.min.js', + 'lib/**' ]); }); - +jake.Task.publish.on('complete', function () { + console.log('Updating hosted docs...'); + console.log('If this fails, run jake docPublish to re-try.'); + jake.Task.docPublish.invoke(); +}); diff --git a/node_modules/ejs/README.md b/node_modules/ejs/README.md index b88b7b4..30e697f 100644 --- a/node_modules/ejs/README.md +++ b/node_modules/ejs/README.md @@ -3,7 +3,8 @@ Embedded JavaScript templates [![Build Status](https://img.shields.io/travis/mde/ejs/master.svg?style=flat)](https://travis-ci.org/mde/ejs) -[![Developing Dependencies](https://img.shields.io/david/dev/mde/ejs.svg?style=flat)](https://david-dm.org/mde/ejs#info=devDependencies) +[![Developing Dependencies](https://img.shields.io/david/dev/mde/ejs.svg?style=flat)](https://david-dm.org/mde/ejs?type=dev) +[![Known Vulnerabilities](https://snyk.io/test/npm/ejs/badge.svg?style=flat-square)](https://snyk.io/test/npm/ejs) ## Installation @@ -18,7 +19,7 @@ $ npm install ejs * Unescaped raw output with `<%- %>` * Newline-trim mode ('newline slurping') with `-%>` ending tag * Whitespace-trim mode (slurp all whitespace) for control flow with `<%_ _%>` - * Custom delimiters (e.g., use '' instead of '<% %>') + * Custom delimiters (e.g., use `` instead of `<% %>`) * Includes * Client-side support * Static caching of intermediate JavaScript @@ -33,10 +34,12 @@ $ npm install ejs <% } %> ``` +Try EJS online at: https://ionicabizau.github.io/ejs-playground/. + ## Usage ```javascript -var template = ejs.compile(str, options); +let template = ejs.compile(str, options); template(data); // => Rendered HTML string @@ -50,35 +53,43 @@ ejs.renderFile(filename, data, options, function(err, str){ It is also possible to use `ejs.render(dataAndOptions);` where you pass everything in a single object. In that case, you'll end up with local variables -for all the passed options. However, be aware that your code could break if we +for all the passed options. However, be aware that your code could break if we add an option with the same name as one of your data object's properties. Therefore, we do not recommend using this shortcut. ## Options - - `cache` Compiled functions are cached, requires `filename` - - `filename` The name of the file being rendered. Not required if you + - `cache` Compiled functions are cached, requires `filename` + - `filename` The name of the file being rendered. Not required if you are using `renderFile()`. Used by `cache` to key caches, and for includes. - - `context` Function execution context - - `compileDebug` When `false` no debug instrumentation is compiled - - `client` When `true`, compiles a function that can be rendered - in the browser without needing to load the EJS Runtime + - `root` Set project root for includes with an absolute path (/file.ejs). + - `context` Function execution context + - `compileDebug` When `false` no debug instrumentation is compiled + - `client` When `true`, compiles a function that can be rendered + in the browser without needing to load the EJS Runtime ([ejs.min.js](https://github.com/mde/ejs/releases/latest)). - - `delimiter` Character to use with angle brackets for open/close - - `debug` Output generated function body - - `strict` When set to `true`, generated function is in strict mode - - `_with` Whether or not to use `with() {}` constructs. If `false` then the locals will be stored in the `locals` object. Set to `false` in strict mode. - - `localsName` Name to use for the object storing local variables when not using `with` Defaults to `locals` - - `rmWhitespace` Remove all safe-to-remove whitespace, including leading + - `delimiter` Character to use with angle brackets for open/close + - `debug` Output generated function body + - `strict` When set to `true`, generated function is in strict mode + - `_with` Whether or not to use `with() {}` constructs. If `false` + then the locals will be stored in the `locals` object. Set to `false` in strict mode. + - `localsName` Name to use for the object storing local variables when not using + `with` Defaults to `locals` + - `rmWhitespace` Remove all safe-to-remove whitespace, including leading and trailing whitespace. It also enables a safer version of `-%>` line slurping for all scriptlet tags (it does not strip new lines of tags in the middle of a line). - - `escape` The escaping function used with `<%=` construct. It is - used in rendering and is `.toString()`ed in the generation of client functions. (By default escapes XML). + - `escape` The escaping function used with `<%=` construct. It is + used in rendering and is `.toString()`ed in the generation of client functions. + (By default escapes XML). + - `outputFunctionName` Set to a string (e.g., 'echo' or 'print') for a function to print + output inside scriptlet tags. + - `async` When `true`, EJS will use an async function for rendering. (Depends + on async/await support in the JS runtime. -This project uses [JSDoc](http://usejsdoc.org/). For the full public API -documentation, clone the repository and run `npm run doc`. This will run JSDoc -with the proper options and output the documentation to `out/`. If you want +This project uses [JSDoc](http://usejsdoc.org/). For the full public API +documentation, clone the repository and run `npm run doc`. This will run JSDoc +with the proper options and output the documentation to `out/`. If you want the both the public & private API docs, run `npm run devdoc` instead. ## Tags @@ -89,6 +100,7 @@ the both the public & private API docs, run `npm run devdoc` instead. - `<%-` Outputs the unescaped value into the template - `<%#` Comment tag, no execution, no output - `<%%` Outputs a literal '<%' + - `%%>` Outputs a literal '%>' - `%>` Plain ending tag - `-%>` Trim-mode ('newline slurp') tag, trims following newline - `_%>` 'Whitespace Slurping' ending tag, removes all whitespace after it @@ -98,11 +110,11 @@ For the full syntax documentation, please see [docs/syntax.md](https://github.co ## Includes Includes either have to be an absolute path, or, if not, are assumed as -relative to the template with the `include` call. For example if you are -including `./views/user/show.ejs` from `./views/users.ejs` you would +relative to the template with the `include` call. For example if you are +including `./views/user/show.ejs` from `./views/users.ejs` you would use `<%- include('user/show') %>`. -You must specify the `filename` option for the template with the `include` +You must specify the `filename` option for the template with the `include` call unless you are using `renderFile()`. You'll likely want to use the raw output tag (`<%-`) with your include to avoid @@ -129,7 +141,7 @@ still supported. Custom delimiters can be applied on a per-template basis, or globally: ```javascript -var ejs = require('ejs'), +let ejs = require('ejs'), users = ['geddy', 'neil', 'alex']; // Just one template @@ -149,8 +161,8 @@ functions used to render templates. It's easy to plug in LRU caching using Node's `lru-cache` library: ```javascript -var ejs = require('ejs') - , LRU = require('lru-cache'); +let ejs = require('ejs'), + LRU = require('lru-cache'); ejs.cache = LRU(100); // LRU cache with 100-item limit ``` @@ -158,6 +170,21 @@ If you want to clear the EJS cache, call `ejs.clearCache`. If you're using the LRU cache and need a different limit, simple reset `ejs.cache` to a new instance of the LRU. +## Custom file loader + +The default file loader is `fs.readFileSync`, if you want to customize it, you can set ejs.fileLoader. + +```javascript +let ejs = require('ejs'); +let myFileLoad = function (filePath) { + return 'myFileLoad: ' + fs.readFileSync(filePath); +}; + +ejs.fileLoader = myFileLoad; +``` + +With this feature, you can preprocess the template before reading it. + ## Layouts EJS does not specifically support blocks, but layouts can be implemented by @@ -178,8 +205,8 @@ including headers and footers, like so: ## Client-side support Go to the [Latest Release](https://github.com/mde/ejs/releases/latest), download -`./ejs.js` or `./ejs.min.js`. Alternately, you can compile it yourself by cloning -the repository and running `jake build` (or `$(npm bin)/jake build` if jake is +`./ejs.js` or `./ejs.min.js`. Alternately, you can compile it yourself by cloning +the repository and running `jake build` (or `$(npm bin)/jake build` if jake is not installed globally). Include one of these files on your page, and `ejs` should be available globally. @@ -190,7 +217,7 @@ Include one of these files on your page, and `ejs` should be available globally.