mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
17
node_modules/addressparser/.jshintrc
generated
vendored
Normal file
17
node_modules/addressparser/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"indent": 4,
|
||||
"node": true,
|
||||
"globalstrict": true,
|
||||
"evil": true,
|
||||
"unused": true,
|
||||
"undef": true,
|
||||
"newcap": true,
|
||||
"esnext": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
|
||||
"predef": [
|
||||
"describe",
|
||||
"it"
|
||||
]
|
||||
}
|
||||
3
node_modules/addressparser/.npmignore
generated
vendored
Normal file
3
node_modules/addressparser/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.travis.yml
|
||||
test
|
||||
Gruntfile.js
|
||||
6
node_modules/addressparser/CHANGELOG.md
generated
vendored
Normal file
6
node_modules/addressparser/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
## v0.3.2 2015-01-07
|
||||
|
||||
* Added changelog
|
||||
* Allow semicolon (;) as address separator in addition to comma (,). Backport from https://github.com/whiteout-io/addressparser/pull/5
|
||||
16
node_modules/addressparser/LICENSE
generated
vendored
Normal file
16
node_modules/addressparser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
Copyright (c) 2014 Andris Reinman
|
||||
|
||||
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 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.
|
||||
64
node_modules/addressparser/README.md
generated
vendored
Normal file
64
node_modules/addressparser/README.md
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# addressparser
|
||||
|
||||
Parse e-mail address fields. Input can be a single address (`"andris@kreata.ee"`), a formatted address (`"Andris Reinman <andris@kreata.ee>"`), comma separated list of addresses (`"andris@kreata.ee, andris.reinman@kreata.ee"`), an address group (`"disclosed-recipients:andris@kreata.ee;"`) or a mix of all the formats.
|
||||
|
||||
In addition to comma the semicolon is treated as the list delimiter as well (except when used in the group syntax), so a value `"andris@kreata.ee; andris.reinman@kreata.ee"` is identical to `"andris@kreata.ee, andris.reinman@kreata.ee"`.
|
||||
|
||||
## Installation
|
||||
|
||||
Install with npm
|
||||
|
||||
```
|
||||
npm install addressparser
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Include the module
|
||||
|
||||
```javascript
|
||||
var addressparser = require('addressparser');
|
||||
```
|
||||
|
||||
Parse some address strings with `addressparser(field)`
|
||||
|
||||
```javascript
|
||||
var addresses = addressparser('andris <andris@tr.ee>');
|
||||
console.log(addresses); // [{name: "andris", address:"andris@tr.ee"}]
|
||||
```
|
||||
|
||||
And when using groups
|
||||
|
||||
```javascript
|
||||
addressparser('Composers:"Bach, Sebastian" <sebu@example.com>, mozart@example.com (Mozzie);');
|
||||
```
|
||||
|
||||
the result would be
|
||||
|
||||
```
|
||||
[
|
||||
{
|
||||
name: "Composers",
|
||||
group: [
|
||||
{
|
||||
address: "sebu@example.com",
|
||||
name: "Bach, Sebastian"
|
||||
},
|
||||
{
|
||||
address: "mozart@example.com",
|
||||
name: "Mozzie"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
> Be prepared though that groups might be nested.
|
||||
|
||||
## Notes
|
||||
|
||||
This module does not decode any mime-word or punycode encoded strings, it is only a basic parser for parsing the base data, you need to decode the encoded parts later by yourself
|
||||
|
||||
## License
|
||||
|
||||
**MIT**
|
||||
75
node_modules/addressparser/package.json
generated
vendored
Normal file
75
node_modules/addressparser/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"addressparser@^0.3.2",
|
||||
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/buildmail"
|
||||
]
|
||||
],
|
||||
"_from": "addressparser@>=0.3.2 <0.4.0",
|
||||
"_id": "addressparser@0.3.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/addressparser",
|
||||
"_npmUser": {
|
||||
"email": "andris@node.ee",
|
||||
"name": "andris"
|
||||
},
|
||||
"_npmVersion": "1.4.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "addressparser",
|
||||
"raw": "addressparser@^0.3.2",
|
||||
"rawSpec": "^0.3.2",
|
||||
"scope": null,
|
||||
"spec": ">=0.3.2 <0.4.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/buildmail"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/addressparser/-/addressparser-0.3.2.tgz",
|
||||
"_shasum": "59873f35e8fcf6c7361c10239261d76e15348bb2",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "addressparser@^0.3.2",
|
||||
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/buildmail",
|
||||
"author": {
|
||||
"name": "Andris Reinman"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/andris9/addressparser/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Parse e-mail addresses",
|
||||
"devDependencies": {
|
||||
"chai": "^1.10.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-contrib-jshint": "^0.10.0",
|
||||
"grunt-mocha-test": "^0.12.4",
|
||||
"mocha": "^2.1.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "59873f35e8fcf6c7361c10239261d76e15348bb2",
|
||||
"tarball": "http://registry.npmjs.org/addressparser/-/addressparser-0.3.2.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/andris9/addressparser",
|
||||
"license": "MIT",
|
||||
"main": "src/addressparser.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "andris",
|
||||
"email": "andris@node.ee"
|
||||
}
|
||||
],
|
||||
"name": "addressparser",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/andris9/addressparser.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt"
|
||||
},
|
||||
"version": "0.3.2"
|
||||
}
|
||||
286
node_modules/addressparser/src/addressparser.js
generated
vendored
Normal file
286
node_modules/addressparser/src/addressparser.js
generated
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
'use strict';
|
||||
|
||||
// expose to the world
|
||||
module.exports = addressparser;
|
||||
|
||||
/**
|
||||
* Parses structured e-mail addresses from an address field
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 'Name <address@domain>'
|
||||
*
|
||||
* will be converted to
|
||||
*
|
||||
* [{name: 'Name', address: 'address@domain'}]
|
||||
*
|
||||
* @param {String} str Address field
|
||||
* @return {Array} An array of address objects
|
||||
*/
|
||||
function addressparser(str) {
|
||||
var tokenizer = new Tokenizer(str),
|
||||
tokens = tokenizer.tokenize();
|
||||
|
||||
var addresses = [],
|
||||
address = [],
|
||||
parsedAddresses = [];
|
||||
|
||||
tokens.forEach(function(token) {
|
||||
if (token.type === 'operator' && (token.value === ',' || token.value === ';')) {
|
||||
if (address.length) {
|
||||
addresses.push(address);
|
||||
}
|
||||
address = [];
|
||||
} else {
|
||||
address.push(token);
|
||||
}
|
||||
});
|
||||
|
||||
if (address.length) {
|
||||
addresses.push(address);
|
||||
}
|
||||
|
||||
addresses.forEach(function(address) {
|
||||
address = _handleAddress(address);
|
||||
if (address.length) {
|
||||
parsedAddresses = parsedAddresses.concat(address);
|
||||
}
|
||||
});
|
||||
|
||||
return parsedAddresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts tokens for a single address into an address object
|
||||
*
|
||||
* @param {Array} tokens Tokens object
|
||||
* @return {Object} Address object
|
||||
*/
|
||||
function _handleAddress(tokens) {
|
||||
var token,
|
||||
isGroup = false,
|
||||
state = 'text',
|
||||
address,
|
||||
addresses = [],
|
||||
data = {
|
||||
address: [],
|
||||
comment: [],
|
||||
group: [],
|
||||
text: []
|
||||
},
|
||||
i, len;
|
||||
|
||||
// Filter out <addresses>, (comments) and regular text
|
||||
for (i = 0, len = tokens.length; i < len; i++) {
|
||||
token = tokens[i];
|
||||
|
||||
if (token.type === 'operator') {
|
||||
switch (token.value) {
|
||||
case '<':
|
||||
state = 'address';
|
||||
break;
|
||||
case '(':
|
||||
state = 'comment';
|
||||
break;
|
||||
case ':':
|
||||
state = 'group';
|
||||
isGroup = true;
|
||||
break;
|
||||
default:
|
||||
state = 'text';
|
||||
}
|
||||
} else {
|
||||
if (token.value) {
|
||||
data[state].push(token.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there is no text but a comment, replace the two
|
||||
if (!data.text.length && data.comment.length) {
|
||||
data.text = data.comment;
|
||||
data.comment = [];
|
||||
}
|
||||
|
||||
if (isGroup) {
|
||||
// http://tools.ietf.org/html/rfc2822#appendix-A.1.3
|
||||
data.text = data.text.join(' ');
|
||||
addresses.push({
|
||||
name: data.text || (address && address.name),
|
||||
group: data.group.length ? addressparser(data.group.join(',')) : []
|
||||
});
|
||||
} else {
|
||||
// If no address was found, try to detect one from regular text
|
||||
if (!data.address.length && data.text.length) {
|
||||
for (i = data.text.length - 1; i >= 0; i--) {
|
||||
if (data.text[i].match(/^[^@\s]+@[^@\s]+$/)) {
|
||||
data.address = data.text.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var _regexHandler = function(address) {
|
||||
if (!data.address.length) {
|
||||
data.address = [address.trim()];
|
||||
return ' ';
|
||||
} else {
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
// still no address
|
||||
if (!data.address.length) {
|
||||
for (i = data.text.length - 1; i >= 0; i--) {
|
||||
data.text[i] = data.text[i].replace(/\s*\b[^@\s]+@[^@\s]+\b\s*/, _regexHandler).trim();
|
||||
if (data.address.length) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there's still is no text but a comment exixts, replace the two
|
||||
if (!data.text.length && data.comment.length) {
|
||||
data.text = data.comment;
|
||||
data.comment = [];
|
||||
}
|
||||
|
||||
// Keep only the first address occurence, push others to regular text
|
||||
if (data.address.length > 1) {
|
||||
data.text = data.text.concat(data.address.splice(1));
|
||||
}
|
||||
|
||||
// Join values with spaces
|
||||
data.text = data.text.join(' ');
|
||||
data.address = data.address.join(' ');
|
||||
|
||||
if (!data.address && isGroup) {
|
||||
return [];
|
||||
} else {
|
||||
address = {
|
||||
address: data.address || data.text || '',
|
||||
name: data.text || data.address || ''
|
||||
};
|
||||
|
||||
if (address.address === address.name) {
|
||||
if ((address.address || '').match(/@/)) {
|
||||
address.name = '';
|
||||
} else {
|
||||
address.address = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addresses.push(address);
|
||||
}
|
||||
}
|
||||
|
||||
return addresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Tokenizer object for tokenizing address field strings
|
||||
*
|
||||
* @constructor
|
||||
* @param {String} str Address field string
|
||||
*/
|
||||
function Tokenizer(str) {
|
||||
this.str = (str || '').toString();
|
||||
this.operatorCurrent = '';
|
||||
this.operatorExpecting = '';
|
||||
this.node = null;
|
||||
this.escaped = false;
|
||||
|
||||
this.list = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Operator tokens and which tokens are expected to end the sequence
|
||||
*/
|
||||
Tokenizer.prototype.operators = {
|
||||
'"': '"',
|
||||
'(': ')',
|
||||
'<': '>',
|
||||
',': '',
|
||||
':': ';',
|
||||
// Semicolons are not a legal delimiter per the RFC2822 grammar other
|
||||
// than for terminating a group, but they are also not valid for any
|
||||
// other use in this context. Given that some mail clients have
|
||||
// historically allowed the semicolon as a delimiter equivalent to the
|
||||
// comma in their UI, it makes sense to treat them the same as a comma
|
||||
// when used outside of a group.
|
||||
';': ''
|
||||
};
|
||||
|
||||
/**
|
||||
* Tokenizes the original input string
|
||||
*
|
||||
* @return {Array} An array of operator|text tokens
|
||||
*/
|
||||
Tokenizer.prototype.tokenize = function() {
|
||||
var chr, list = [];
|
||||
for (var i = 0, len = this.str.length; i < len; i++) {
|
||||
chr = this.str.charAt(i);
|
||||
this.checkChar(chr);
|
||||
}
|
||||
|
||||
this.list.forEach(function(node) {
|
||||
node.value = (node.value || '').toString().trim();
|
||||
if (node.value) {
|
||||
list.push(node);
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if a character is an operator or text and acts accordingly
|
||||
*
|
||||
* @param {String} chr Character from the address field
|
||||
*/
|
||||
Tokenizer.prototype.checkChar = function(chr) {
|
||||
if ((chr in this.operators || chr === '\\') && this.escaped) {
|
||||
this.escaped = false;
|
||||
} else if (this.operatorExpecting && chr === this.operatorExpecting) {
|
||||
this.node = {
|
||||
type: 'operator',
|
||||
value: chr
|
||||
};
|
||||
this.list.push(this.node);
|
||||
this.node = null;
|
||||
this.operatorExpecting = '';
|
||||
this.escaped = false;
|
||||
return;
|
||||
} else if (!this.operatorExpecting && chr in this.operators) {
|
||||
this.node = {
|
||||
type: 'operator',
|
||||
value: chr
|
||||
};
|
||||
this.list.push(this.node);
|
||||
this.node = null;
|
||||
this.operatorExpecting = this.operators[chr];
|
||||
this.escaped = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.escaped && chr === '\\') {
|
||||
this.escaped = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.node) {
|
||||
this.node = {
|
||||
type: 'text',
|
||||
value: ''
|
||||
};
|
||||
this.list.push(this.node);
|
||||
}
|
||||
|
||||
if (this.escaped && chr !== '\\') {
|
||||
this.node.value += '\\';
|
||||
}
|
||||
|
||||
this.node.value += chr;
|
||||
this.escaped = false;
|
||||
};
|
||||
Reference in New Issue
Block a user