Comparing version 0.1.5 to 0.2.0
@@ -7,4 +7,4 @@ | ||
var ssi = function(inputDirectory, outputDirectory, matcher) { | ||
this.parser = new SSI(inputDirectory, outputDirectory, matcher); | ||
var ssi = function(inputDirectory, outputDirectory, matcher, loosenedSpace) { | ||
this.parser = new SSI(inputDirectory, outputDirectory, matcher, loosenedSpace); | ||
}; | ||
@@ -11,0 +11,0 @@ |
@@ -6,3 +6,2 @@ | ||
var DIRECTIVE_MATCHER = /<!--#([a-z]+)([ ]+([a-z]+)="(.+?)")* -->/g; | ||
var ATTRIBUTE_MATCHER = /([a-z]+)="(.+?)"/g; | ||
@@ -30,3 +29,3 @@ var INTERPOLATION_MATCHER = /\$\{(.+?)\}/g; | ||
var DirectiveHandler = function(ioUtils) { | ||
var DirectiveHandler = function(ioUtils, directiveRegex) { | ||
this.parser = undefined; | ||
@@ -36,2 +35,3 @@ this.ioUtils = ioUtils; | ||
this.currentConditional = undefined; | ||
this.directiveRegex = directiveRegex; | ||
}; | ||
@@ -260,3 +260,3 @@ | ||
if (this._parseExpression(conditional.getExpression()).truthy) { | ||
var directiveHandler = new DirectiveHandler(this.ioUtils); | ||
var directiveHandler = new DirectiveHandler(this.ioUtils, this.directiveRegex); | ||
var output = {output: "", variables: {}}; | ||
@@ -269,3 +269,3 @@ | ||
//noinspection JSValidateTypes | ||
var directiveName = new RegExp(DIRECTIVE_MATCHER).exec(directive)[1]; | ||
var directiveName = new RegExp(this.directiveRegex).exec(directive)[1]; | ||
@@ -272,0 +272,0 @@ var results = directiveHandler.handleDirective(directive, directiveName, currentFile, |
@@ -8,8 +8,6 @@ | ||
var DIRECTIVE_MATCHER = /<!--#([a-z]+)([ ]+([a-z]+)="(.+?)")* -->/g; | ||
(function() { | ||
"use strict"; | ||
var ssi = function(inputDirectory, outputDirectory, matcher) { | ||
var ssi = function(inputDirectory, outputDirectory, matcher, loosenedSpace) { | ||
this.inputDirectory = inputDirectory; | ||
@@ -20,4 +18,6 @@ this.documentRoot = inputDirectory; | ||
this.directiveRegex = loosenedSpace ? /<!--[ ]*#([a-z]+)([ ]+([a-z]+)="(.+?)")*[ ]*-->/g : /<!--#([a-z]+)([ ]+([a-z]+)="(.+?)")* -->/g; | ||
this.ioUtils = new IOUtils(this.documentRoot); | ||
this.directiveHandler = new DirectiveHandler(this.ioUtils); | ||
this.directiveHandler = new DirectiveHandler(this.ioUtils, this.directiveRegex); | ||
this.directiveHandler.parser = this; | ||
@@ -45,3 +45,3 @@ }; | ||
contents = contents.replace(new RegExp(DIRECTIVE_MATCHER), function(directive, directiveName) { | ||
contents = contents.replace(new RegExp(instance.directiveRegex), function(directive, directiveName) { | ||
var data = instance.directiveHandler.handleDirective(directive, directiveName, filename, variables); | ||
@@ -68,2 +68,1 @@ | ||
})(); | ||
{ | ||
"name": "ssi", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"description": "Server Side Includes for NodeJS", | ||
"author": "Glenn Nelson <glenn@hexcoder.us> (glenn@hexcoder.us)", | ||
"author": "Chen-Heng Chang <wandererm@gmail.com> (http://kidwm.net/)", | ||
"main": "index.js", | ||
@@ -13,17 +13,15 @@ "keywords": [ | ||
"type": "git", | ||
"url": "https://github.com/67726e/node-ssi.git" | ||
"url": "https://github.com/kidwm/node-ssi.git" | ||
}, | ||
"license": "MIT", | ||
"readmeFilename": "README.md", | ||
"gitHead": "d99f35decc10fbcd2406b2bb7ee23e80b6f23661", | ||
"dependencies": { | ||
"mkdirp": "~0.3.5", | ||
"glob": "~3.2.1" | ||
"glob": "^6.0.1", | ||
"mkdirp": "^0.5.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.10.0" | ||
"mocha": "^2.3.4" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha" | ||
} | ||
} |
node-ssi | ||
======== | ||
[![Build Status](https://travis-ci.org/67726e/node-ssi.png)](https://travis-ci.org/67726e/node-ssi) | ||
[![Build Status](https://travis-ci.org/kidwm/node-ssi.png)](https://travis-ci.org/kidwm/node-ssi) | ||
@@ -27,3 +27,3 @@ Server Side Includes for NodeJS | ||
```bash | ||
npm install ssi | ||
npm install ssi | ||
``` | ||
@@ -44,2 +44,4 @@ | ||
If you want to support loosened spaces in directive like `<!-- #include file="" -->` or `<!-- #include file="" -->`, just enable the fourth argument: `new ssi(inputDirectory, outputDirectory, matcher, true)`. | ||
### Methods | ||
@@ -61,2 +63,1 @@ | ||
MIT | ||
@@ -7,3 +7,3 @@ | ||
describe("", function() { | ||
describe("Nested", function() { | ||
"use strict"; | ||
@@ -13,3 +13,3 @@ | ||
it("", function() { | ||
it("netsted folder", function() { | ||
var filename = "test/html/nested-parent.html"; | ||
@@ -16,0 +16,0 @@ var contents = fs.readFileSync(filename, {encoding: "utf8"}); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
27280
40
614
61
9
2
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedglob@6.0.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedglob@3.2.11(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.3.0(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedsigmund@1.0.1(transitive)
Updatedglob@^6.0.1
Updatedmkdirp@^0.5.1