Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

greshunkel

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

greshunkel - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.travis.yml

7

CHANGELOG.md

@@ -8,2 +8,6 @@ # Changelog

## [0.0.2] - 2016-01-21
### Added
- Layouts.
## [0.0.1] - 2016-01-20

@@ -13,3 +17,4 @@ ### Added

[Unreleased]: https://github.com/maxdeviant/greshunkel/compare/v0.0.1...HEAD
[Unreleased]: https://github.com/maxdeviant/greshunkel/compare/v0.0.2...HEAD
[0.0.2]: https://github.com/maxdeviant/greshunkel/compare/v0.0.1...v0.0.2
[0.0.1]: https://github.com/maxdeviant/greshunkel/compare/e8c19f3...v0.0.1

@@ -19,6 +19,18 @@ 'use strict';

return new Promise((resolve, reject) => {
this._loadTemplate(template).then((content) => {
content = this._interpolate(content, variables);
variables = variables || {};
return resolve(content);
let html;
this._loadTemplate(template).then((templateHtml) => {
html = templateHtml;
return this._compileLayout(html);
}).then((layoutHtml) => {
if (layoutHtml) {
html = layoutHtml;
}
html = this._interpolate(html, variables);
return resolve(html);
}).catch((err) => {

@@ -30,4 +42,23 @@ return reject(err);

_compileLayout(content) {
return new Promise((resolve, reject) => {
let pattern = /xXx\s*PARENT\s*=\s*([\w\/\.]+)\s*xXx/g;
let match = pattern.exec(content);
if (!match) {
return resolve(content);
}
let layoutTag = new RegExp(match[0], 'g');
let layoutPath = match[1];
this._loadTemplate(layoutPath).then((layoutHtml) => {
return resolve(layoutHtml);
});
});
}
_interpolate(content, variables) {
let pattern = /xXx.*@([A-Za-z]+).*xXx/g;
let pattern = /xXx\s*@([\w\/]+)\s*xXx/g;

@@ -53,14 +84,14 @@ let match;

return new Promise((resolve, reject) => {
template = template.endsWith('.gshkl') ? template : template + '.gshkl';
template = this._appendFileExtension(template);
let templatePath = path.join(this.options.directory, template);
let reader = fs.createReadStream(templatePath, 'utf-8');
let content = '';
let html = '';
reader.on('data', (data) => {
content += data;
html += data;
});
reader.on('close', () => {
return resolve(content);
return resolve(html);
});

@@ -74,2 +105,6 @@

_appendFileExtension(filePath) {
return filePath.endsWith('.gshkl') ? filePath : filePath + '.gshkl';
}
}

@@ -76,0 +111,0 @@

18

package.json
{
"name": "greshunkel",
"version": "0.0.1",
"version": "0.0.2",
"description": "A templating language for the V O I D.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./node_modules/mocha/bin/mocha"
},

@@ -14,8 +14,8 @@ "repository": {

"keywords": [
"html",
"templating",
"template",
"merveilles",
"void",
"infoforcefeed",
"merveilles",
"template",
"templating",
"html"
"infoforcefeed"
],

@@ -30,3 +30,7 @@ "author": "Marshall Bowers <elliott.codes@gmail.com>",

"lodash": "^4.0.0"
},
"devDependencies": {
"mocha": "^2.3.4",
"should": "^8.1.1"
}
}
# greshunkel
[![forthebadge](http://forthebadge.com/images/badges/fuck-it-ship-it.svg)](http://forthebadge.com)
[![Travis](https://img.shields.io/travis/maxdeviant/greshunkel.svg?style=flat-square)](https://travis-ci.org/maxdeviant/greshunkel)
[![npm](https://img.shields.io/npm/v/greshunkel.svg?style=flat-square)](https://www.npmjs.com/package/greshunkel)
Wally [requested](https://twitter.com/WAallLy/status/687059807518367744) this, so this is me delivering.

@@ -7,4 +13,5 @@

- [x] Variable Interpolation
- [x] Layouts
## TODO
- [ ] Implement everything in the [Greshunkel spec](http://38-moths.shithouse.tv/greshunkel.html)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc