1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-12 18:52:50 +00:00

updated bunch of file paths and changed the way posts are loaded

This commit is contained in:
2016-01-05 12:28:04 -06:00
parent 719ae331ae
commit c96a84d0ff
13249 changed files with 317868 additions and 2101398 deletions

19
node_modules/jstransformer/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2014 Forbes Lindesay
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.

103
node_modules/jstransformer/README.md generated vendored Normal file
View File

@@ -0,0 +1,103 @@
<p align="center"><img src="https://cdn.rawgit.com/jstransformers/jstransformer/2bb6dc6c410e8683a17a4af5f1b73bcbee95aada/logo.svg" width="300px" height="299px" /></p>
<h1 align="center">JSTransformer</h1>
<p align="center">Normalize the API of any jstransformer</p>
<p align="center"><a href="https://travis-ci.org/jstransformers/jstransformer"><img src="https://img.shields.io/travis/jstransformers/jstransformer/master.svg" alt="Build Status"></a>
<a href="https://gemnasium.com/jstransformers/jstransformer"><img src="https://img.shields.io/gemnasium/jstransformers/jstransformer.svg" alt="Dependency Status"></a>
<a href="https://coveralls.io/r/jstransformers/jstransformer?branch=master"><img src="https://img.shields.io/coveralls/jstransformers/jstransformer/master.svg" alt="Coverage Status"></a>
<a href="https://www.npmjs.org/package/jstransformer"><img src="https://img.shields.io/npm/v/jstransformer.svg" alt="NPM version"></a></p>
## Installation
npm install jstransformer
## Usage
```js
var transformer = require('jstransformer');
var marked = transformer(require('jstransformer-marked'));
var options = {};
var res = marked.render('Some **markdown**', options);
// => {body: 'Some <strong>markdown</strong>', dependencies: []}
```
This gives the same API regardless of the jstransformer passed in.
## API
A transformer, once normalised using this module, will implement the following methods. Note that if the underlying transformer cannot be used to implement the functionality, it may ultimately just throw an error.
### Returned object from `.render*`
```js
{body: String, dependencies: Array.<String>}
```
- `body` represents the result as a string
- `dependencies` is an array of files that were read in as part of the render process (or an empty array if there were no dependencies)
### `.render`
```js
transformer.render(str, options, locals);
=> {body: String, dependencies: Array.<String>}
```
_requires the underlying transform to implement `.render` or `.compile`_
Transform a string and return an object.
### `.renderAsync`
```js
transformer.renderAsync(str[, options], locals, callback);
```
```js
transformer.renderAsync(str[, options], locals);
=> Promise({body: String, dependencies: Array.<String>})
```
_requires the underlying transform to implement `.renderAsync` or `.render`_
Transform a string asynchronously. If a callback is provided, it is called as `callback(err, data)`, otherwise a Promise is returned.
### `.renderFile`
```js
transformer.renderFile(filename, options, locals)
=> {body: String, dependencies: Array.<String>}
```
_requires the underlying transform to implement `.renderFile`, `.render`, `.compileFile`, or `.compile`_
Transform a file and return an object.
### `.renderFileAsync`
```js
transformer.renderFileAsync(filename[, options], locals, callback);
```
```js
transformer.renderFileAsync(filename[, options], locals);
=> Promise({body: String, dependencies: Array.<String>})
```
_requires the underlying transform to implement `.renderFileAsync`, `.renderFile`, `.renderAsync`, `.render`, `.compileFileAsync`, `.compileFile`, `.compileAsync`, or `.compileFile`_
Transform a file asynchronously. If a callback is provided, it is called as `callback(err, data)`, otherwise a Promise is returned.
### `.inputFormats`
```js
var formats = transformer.inputFormats;
=> ['md', 'markdown']
```
Returns an array of strings representing potential input formats for the transform. If not provided directly by the transform, results in an array containing the name of the transform.
## License
MIT

328
node_modules/jstransformer/index.js generated vendored Normal file
View File

@@ -0,0 +1,328 @@
'use strict';
var fs = require('fs');
var assert = require('assert');
var Promise = require('promise');
var isPromise = require('is-promise');
var tr = (module.exports = function (transformer) {
return new Transformer(transformer);
});
tr.Transformer = Transformer;
tr.normalizeFn = normalizeFn;
tr.normalizeFnAsync = normalizeFnAsync;
tr.normalize = normalize;
tr.normalizeAsync = normalizeAsync;
tr.readFile = Promise.denodeify(fs.readFile);
tr.readFileSync = fs.readFileSync;
function normalizeFn(result) {
if (typeof result === 'function') {
return {fn: result, dependencies: []};
} else if (result && typeof result === 'object' && typeof result.fn === 'function') {
if ('dependencies' in result) {
if (!Array.isArray(result.dependencies)) {
throw new Error('Result should have a dependencies property that is an array');
}
} else {
result.dependencies = [];
}
return result;
} else {
throw new Error('Invalid result object from transform.');
}
}
function normalizeFnAsync(result, cb) {
return Promise.resolve(result).then(function (result) {
if (result && isPromise(result.fn)) {
return result.fn.then(function (fn) {
result.fn = fn;
return result;
});
}
return result;
}).then(tr.normalizeFn).nodeify(cb);
}
function normalize(result) {
if (typeof result === 'string') {
return {body: result, dependencies: []};
} else if (result && typeof result === 'object' && typeof result.body === 'string') {
if ('dependencies' in result) {
if (!Array.isArray(result.dependencies)) {
throw new Error('Result should have a dependencies property that is an array');
}
} else {
result.dependencies = [];
}
return result;
} else {
throw new Error('Invalid result object from transform.');
}
}
function normalizeAsync(result, cb) {
return Promise.resolve(result).then(function (result) {
if (result && isPromise(result.body)) {
return result.body.then(function (body) {
result.body = body;
return result;
});
}
return result;
}).then(tr.normalize).nodeify(cb);
}
function Transformer(tr) {
assert(tr, 'Transformer must be an object');
assert(typeof tr.name === 'string', 'Transformer must have a name');
assert(typeof tr.outputFormat === 'string', 'Transformer must have an output format');
assert([
'compile',
'compileAsync',
'compileFile',
'compileFileAsync',
'compileClient',
'compileClientAsync',
'compileFileClient',
'compileFileClientAsync',
'render',
'renderAsync',
'renderFile',
'renderFileAsync'
].some(function (method) {
return typeof tr[method] === 'function';
}), 'Transformer must implement at least one of the potential methods.');
this._tr = tr;
this.name = this._tr.name;
this.outputFormat = this._tr.outputFormat;
this.inputFormats = this._tr.inputFormats || [this.name];
}
var fallbacks = {
compile: ['compile'],
compileAsync: ['compileAsync', 'compile'],
compileFile: ['compileFile', 'compile'],
compileFileAsync: ['compileFileAsync', 'compileFile', 'compileAsync', 'compile'],
compileClient: ['compileClient'],
compileClientAsync: ['compileClientAsync', 'compileClient'],
compileFileClient: ['compileFileClient', 'compileClient'],
compileFileClientAsync: [
'compileFileClientAsync', 'compileFileClient', 'compileClientAsync', 'compileClient'
],
render: ['render', 'compile'],
renderAsync: ['renderAsync', 'render', 'compileAsync', 'compile'],
renderFile: ['renderFile', 'render', 'compileFile', 'compile'],
renderFileAsync: [
'renderFileAsync', 'renderFile', 'renderAsync', 'render',
'compileFileAsync', 'compileFile', 'compileAsync', 'compile'
]
};
Transformer.prototype._hasMethod = function (method) {
return typeof this._tr[method] === 'function';
};
Transformer.prototype.can = function (method) {
return fallbacks[method].some(function (method) {
return this._hasMethod(method);
}.bind(this));
};
/* COMPILE */
Transformer.prototype.compile = function (str, options) {
if (!this.can('compile')) {
if (this.can('compileAsync')) {
throw new Error('The Transform "' + this.name + '" does not support synchronous compilation');
} else if (this.can('compileFileAsync')) {
throw new Error('The Transform "' + this.name + '" does not support compiling plain strings');
} else {
throw new Error('The Transform "' + this.name + '" does not support compilation');
}
}
return tr.normalizeFn(this._tr.compile(str, options));
};
Transformer.prototype.compileAsync = function (str, options, cb) {
if (!this.can('compileAsync')) {
if (this.can('compileFileAsync')) {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support compiling plain strings')).nodeify(cb);
} else {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support compilation')).nodeify(cb);
}
}
if (this._hasMethod('compileAsync')) {
return tr.normalizeFnAsync(this._tr.compileAsync(str, options), cb);
} else {
return tr.normalizeFnAsync(this._tr.compile(str, options), cb);
}
};
Transformer.prototype.compileFile = function (filename, options) {
if (!this.can('compileFile')) {
if (this.can('compileFileAsync')) {
throw new Error('The Transform "' + this.name + '" does not support synchronous compilation');
} else {
throw new Error('The Transform "' + this.name + '" does not support compilation');
}
}
if (this._hasMethod('compileFile')) {
return tr.normalizeFn(this._tr.compileFile(filename, options));
} else {
return tr.normalizeFn(this._tr.compile(tr.readFileSync(filename, 'utf8'), options));
}
};
Transformer.prototype.compileFileAsync = function (filename, options, cb) {
if (!this.can('compileFileAsync')) {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support compilation'));
}
if (this._hasMethod('compileFileAsync')) {
return tr.normalizeFnAsync(this._tr.compileFileAsync(filename, options), cb);
} else if (this._hasMethod('compileFile')) {
return tr.normalizeFnAsync(this._tr.compileFile(filename, options), cb);
} else {
return tr.normalizeFnAsync(tr.readFile(filename, 'utf8').then(function (str) {
if (this._hasMethod('compileAsync')) {
return this._tr.compileAsync(str, options);
} else {
return this._tr.compile(str, options);
}
}.bind(this)), cb);
}
};
/* COMPILE CLIENT */
Transformer.prototype.compileClient = function (str, options) {
if (!this.can('compileClient')) {
if (this.can('compileClientAsync')) {
throw new Error('The Transform "' + this.name + '" does not support compiling for the client synchronously.');
} else if (this.can('compileFileClientAsync')) {
throw new Error('The Transform "' + this.name + '" does not support compiling for the client from a string.');
} else {
throw new Error('The Transform "' + this.name + '" does not support compiling for the client');
}
}
return tr.normalize(this._tr.compileClient(str, options));
};
Transformer.prototype.compileClientAsync = function (str, options, cb) {
if (!this.can('compileClientAsync')) {
if (this.can('compileFileClientAsync')) {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support compiling for the client from a string.')).nodeify(cb);
} else {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support compiling for the client')).nodeify(cb);
}
}
if (this._hasMethod('compileClientAsync')) {
return tr.normalizeAsync(this._tr.compileClientAsync(str, options), cb);
} else {
return tr.normalizeAsync(this._tr.compileClient(str, options), cb);
}
};
Transformer.prototype.compileFileClient = function (filename, options) {
if (!this.can('compileFileClient')) {
if (this.can('compileFileClientAsync')) {
throw new Error('The Transform "' + this.name + '" does not support compiling for the client synchronously.');
} else {
throw new Error('The Transform "' + this.name + '" does not support compiling for the client');
}
}
if (this._hasMethod('compileFileClient')) {
return tr.normalize(this._tr.compileFileClient(filename, options));
} else {
return tr.normalize(this._tr.compileClient(tr.readFileSync(filename, 'utf8'), options));
}
};
Transformer.prototype.compileFileClientAsync = function (filename, options, cb) {
if (!this.can('compileFileClientAsync')) {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support compiling for the client')).nodeify(cb)
}
if (this._hasMethod('compileFileClientAsync')) {
return tr.normalizeAsync(this._tr.compileFileClientAsync(filename, options), cb);
} else if (this._hasMethod('compileFileClient')) {
return tr.normalizeAsync(this._tr.compileFileClient(filename, options), cb);
} else {
return tr.normalizeAsync(tr.readFile(filename, 'utf8').then(function (str) {
if (this._hasMethod('compileClientAsync')) {
return this._tr.compileClientAsync(str, options);
} else {
return this._tr.compileClient(str, options);
}
}.bind(this)), cb);
}
};
/* RENDER */
Transformer.prototype.render = function (str, options, locals) {
if (!this.can('render')) {
if (this.can('renderAsync')) {
throw new Error('The Transform "' + this.name + '" does not support rendering synchronously.');
} else if (this.can('renderFileAsync')) {
throw new Error('The Transform "' + this.name + '" does not support rendering from a string.');
} else {
throw new Error('The Transform "' + this.name + '" does not support rendering');
}
}
if (this._hasMethod('render')) {
return tr.normalize(this._tr.render(str, options, locals));
} else {
var compiled = tr.normalizeFn(this._tr.compile(str, options));
var body = compiled.fn(options || locals);
if (typeof body !== 'string') {
throw new Error('The Transform "' + this.name + '" does not support rendering synchronously.');
}
return tr.normalize({body: body, dependencies: compiled.dependencies});
}
};
Transformer.prototype.renderAsync = function (str, options, locals, cb) {
if (typeof locals === 'function') {
cb = locals;
locals = options;
}
if (!this.can('renderAsync')) {
if (this.can('renderFileAsync')) {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support rendering from a string.')).nodeify(cb);
} else {
return Promise.reject(new Error('The Transform "' + this.name + '" does not support rendering')).nodeify(cb);
}
}
if (this._hasMethod('renderAsync')) {
return tr.normalizeAsync(this._tr.renderAsync(str, options, locals), cb);
} else if (this._hasMethod('render')) {
return tr.normalizeAsync(this._tr.render(str, options, locals), cb);
} else {
return tr.normalizeAsync(this.compileAsync(str, options).then(function (compiled) {
return {body: compiled.fn(options || locals), dependencies: compiled.dependencies};
}), cb);
}
};
Transformer.prototype.renderFile = function (filename, options, locals) {
if (typeof this._tr.renderFile === 'function') {
return tr.normalize(this._tr.renderFile(filename, options, locals));
} else if (typeof this._tr.render === 'function') {
return tr.normalize(this._tr.render(tr.readFileSync(filename, 'utf8'), options, locals));
} else if (this._hasMethod('compile') || this._hasMethod('compileFile')) {
var compiled = this.compileFile(filename, options);
return tr.normalize({body: compiled.fn(options || locals), dependencies: compiled.dependencies});
} else {
return Promise.reject(new Error('This transform does not support synchronous rendering'));
}
};
Transformer.prototype.renderFileAsync = function (filename, options, locals, cb) {
if (typeof locals === 'function') {
cb = locals;
locals = options;
}
if (typeof this._tr.renderFileAsync === 'function') {
return tr.normalizeAsync(this._tr.renderFileAsync(filename, options, locals), cb);
} else if (typeof this._tr.renderFile === 'function') {
return tr.normalizeAsync(this._tr.renderFile(filename, options, locals), cb);
} else if (this._hasMethod('compile') || this._hasMethod('compileAsync')
|| this._hasMethod('compileFile') || this._hasMethod('compileFileAsync')) {
return tr.normalizeAsync(this.compileFileAsync(filename, options).then(function (compiled) {
return {body: compiled.fn(options || locals), dependencies: compiled.dependencies};
}), cb);
} else {
return tr.normalizeAsync(tr.readFile(filename, 'utf8').then(function (str) {
return this.renderAsync(str, options, locals);
}.bind(this)), cb);
}
};

86
node_modules/jstransformer/package.json generated vendored Normal file
View File

@@ -0,0 +1,86 @@
{
"_args": [
[
"jstransformer@0.0.2",
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/jade"
]
],
"_from": "jstransformer@0.0.2",
"_id": "jstransformer@0.0.2",
"_inCache": true,
"_installable": true,
"_location": "/jstransformer",
"_nodeVersion": "1.6.2",
"_npmUser": {
"email": "forbes@lindesay.co.uk",
"name": "forbeslindesay"
},
"_npmVersion": "2.7.1",
"_phantomChildren": {},
"_requested": {
"name": "jstransformer",
"raw": "jstransformer@0.0.2",
"rawSpec": "0.0.2",
"scope": null,
"spec": "0.0.2",
"type": "version"
},
"_requiredBy": [
"/jade"
],
"_resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-0.0.2.tgz",
"_shasum": "7aae29a903d196cfa0973d885d3e47947ecd76ab",
"_shrinkwrap": null,
"_spec": "jstransformer@0.0.2",
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/jade",
"author": {
"name": "ForbesLindesay"
},
"bugs": {
"url": "https://github.com/jstransformers/jstransformer/issues"
},
"dependencies": {
"is-promise": "^2.0.0",
"promise": "^6.0.1"
},
"description": "Normalize the API of any jstransformer",
"devDependencies": {
"coveralls": "^2.11.2",
"istanbul": "^0.3.5",
"testit": "^1.2.0"
},
"directories": {},
"dist": {
"shasum": "7aae29a903d196cfa0973d885d3e47947ecd76ab",
"tarball": "http://registry.npmjs.org/jstransformer/-/jstransformer-0.0.2.tgz"
},
"files": [
"LICENSE",
"index.js"
],
"gitHead": "99b40c1aa9fa984585aa50f4618d97a0287495c1",
"homepage": "https://github.com/jstransformers/jstransformer",
"keywords": [
"jstransformer"
],
"license": "MIT",
"maintainers": [
{
"name": "forbeslindesay",
"email": "forbes@lindesay.co.uk"
}
],
"name": "jstransformer",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/jstransformers/jstransformer.git"
},
"scripts": {
"coverage": "istanbul cover test",
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
"test": "node test"
},
"version": "0.0.2"
}