progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/posthtml-parser
7
assets_old/node_modules/posthtml-parser/.npmignore
generated
vendored
Normal file
7
assets_old/node_modules/posthtml-parser/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
node_modules/
|
||||
test/
|
||||
npm-debug.log
|
||||
.editorconfig
|
||||
.jscsrc
|
||||
.jshintignore
|
||||
.jshintrc
|
14
assets_old/node_modules/posthtml-parser/.travis.yml
generated
vendored
Normal file
14
assets_old/node_modules/posthtml-parser/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.1"
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
|
||||
env:
|
||||
global:
|
||||
- ISTANBUL_COVERAGE: yes
|
||||
|
||||
after_success:
|
||||
- npm i coveralls
|
||||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && echo "Coverage data was sent to coveralls!"
|
22
assets_old/node_modules/posthtml-parser/LICENSE
generated
vendored
Normal file
22
assets_old/node_modules/posthtml-parser/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Ivan Voischev <voischev.ivan@ya.ru>
|
||||
|
||||
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.
|
5
assets_old/node_modules/posthtml-parser/MAINTAINERS
generated
vendored
Normal file
5
assets_old/node_modules/posthtml-parser/MAINTAINERS
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
voischev
|
||||
awinogradov
|
||||
zxqfox
|
||||
Yeti-or
|
||||
jescalan
|
82
assets_old/node_modules/posthtml-parser/README.md
generated
vendored
Normal file
82
assets_old/node_modules/posthtml-parser/README.md
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
# posthtml-parser
|
||||
[](http://badge.fury.io/js/posthtml-parser)
|
||||
[](https://travis-ci.org/posthtml/posthtml-parser?branch=master)
|
||||
[](https://coveralls.io/r/posthtml/posthtml-parser?branch=master)
|
||||
|
||||
Parse HTML/XML to [PostHTML AST](https://github.com/posthtml/posthtml-parser#posthtml-ast-format).
|
||||
More about [PostHTML](https://github.com/posthtml/posthtml#readme)
|
||||
|
||||
## Install
|
||||
|
||||
[NPM](http://npmjs.com) install
|
||||
```
|
||||
$ npm install posthtml-parser
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
#### Input HTML
|
||||
```html
|
||||
<a class="animals" href="#">
|
||||
<span class="animals__cat" style="background: url(cat.png)">Cat</span>
|
||||
</a>
|
||||
```
|
||||
```js
|
||||
const parser = require('posthtml-parser')
|
||||
const fs = require('fs')
|
||||
const html = fs.readFileSync('path/to/input.html').toString()
|
||||
|
||||
console.log(parser(html)) // Logs a PostHTML AST
|
||||
```
|
||||
|
||||
#### input HTML
|
||||
```html
|
||||
<a class="animals" href="#">
|
||||
<span class="animals__cat" style="background: url(cat.png)">Cat</span>
|
||||
</a>
|
||||
```
|
||||
|
||||
#### Result PostHTMLTree
|
||||
```js
|
||||
[{
|
||||
tag: 'a',
|
||||
attrs: {
|
||||
class: 'animals',
|
||||
href: '#'
|
||||
},
|
||||
content: [
|
||||
'\n ',
|
||||
{
|
||||
tag: 'span',
|
||||
attrs: {
|
||||
class: 'animals__cat',
|
||||
style: 'background: url(cat.png)'
|
||||
},
|
||||
content: ['Cat']
|
||||
},
|
||||
'\n'
|
||||
]
|
||||
}]
|
||||
```
|
||||
|
||||
## PostHTML AST Format
|
||||
|
||||
Any parser being used with PostHTML should return a standard PostHTML [Abstract Syntax Tree](https://www.wikiwand.com/en/Abstract_syntax_tree) (AST). Fortunately, this is a very easy format to produce and understand. The AST is an array that can contain strings and objects. Any strings represent plain text content to be written to the output. Any objects represent HTML tags.
|
||||
|
||||
Tag objects generally look something like this:
|
||||
|
||||
```js
|
||||
{
|
||||
tag: 'div',
|
||||
attrs: {
|
||||
class: 'foo'
|
||||
},
|
||||
content: ['hello world!']
|
||||
}
|
||||
```
|
||||
|
||||
Tag objects can contain three keys. The `tag` key takes the name of the tag as the value. This can include custom tags. The optional `attrs` key takes an object with key/value pairs representing the attributes of the html tag. A boolean attribute has an empty string as its value. Finally, the optional `content` key takes an array as its value, which is a PostHTML AST. In this manner, the AST is a tree that should be walked recursively.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
103
assets_old/node_modules/posthtml-parser/index.js
generated
vendored
Normal file
103
assets_old/node_modules/posthtml-parser/index.js
generated
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
'use strict';
|
||||
|
||||
var htmlparser = require('htmlparser2');
|
||||
var isObject = require('isobject');
|
||||
|
||||
/**
|
||||
* @see https://github.com/fb55/htmlparser2/wiki/Parser-options
|
||||
*/
|
||||
var defaultOptions = {lowerCaseTags: false, lowerCaseAttributeNames: false};
|
||||
|
||||
/**
|
||||
* Parse html to PostHTMLTree
|
||||
* @param {String} html
|
||||
* @param {Object} [options=defaultOptions]
|
||||
* @return {PostHTMLTree}
|
||||
*/
|
||||
function postHTMLParser(html, options) {
|
||||
var bufArray = [],
|
||||
results = [];
|
||||
|
||||
bufArray.last = function() {
|
||||
return this[this.length - 1];
|
||||
};
|
||||
|
||||
var parser = new htmlparser.Parser({
|
||||
onprocessinginstruction: function(name, data) {
|
||||
if (name.toLowerCase() === '!doctype') {
|
||||
results.push('<' + data + '>');
|
||||
}
|
||||
},
|
||||
oncomment: function(data) {
|
||||
var comment = '<!--' + data + '-->',
|
||||
last = bufArray.last();
|
||||
|
||||
if (!last) {
|
||||
results.push(comment);
|
||||
return;
|
||||
}
|
||||
|
||||
last.content || (last.content = []);
|
||||
last.content.push(comment);
|
||||
},
|
||||
onopentag: function(tag, attrs) {
|
||||
var buf = { tag: tag };
|
||||
|
||||
if (Object.keys(attrs).length) {
|
||||
buf.attrs = attrs;
|
||||
}
|
||||
|
||||
bufArray.push(buf);
|
||||
},
|
||||
onclosetag: function() {
|
||||
var buf = bufArray.pop();
|
||||
|
||||
if (!bufArray.length) {
|
||||
results.push(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
var last = bufArray.last();
|
||||
if (!Array.isArray(last.content)) {
|
||||
last.content = [];
|
||||
}
|
||||
|
||||
last.content.push(buf);
|
||||
},
|
||||
ontext: function(text) {
|
||||
var last = bufArray.last();
|
||||
if (!last) {
|
||||
results.push(text);
|
||||
return;
|
||||
}
|
||||
|
||||
last.content || (last.content = []);
|
||||
last.content.push(text);
|
||||
}
|
||||
}, options || defaultOptions);
|
||||
|
||||
parser.write(html);
|
||||
parser.end();
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parserWrapper() {
|
||||
var option;
|
||||
|
||||
function parser(html) {
|
||||
var opt = option || defaultOptions;
|
||||
return postHTMLParser(html, opt);
|
||||
}
|
||||
|
||||
if (arguments.length === 1 && isObject(arguments[0])) {
|
||||
option = arguments[0];
|
||||
return parser;
|
||||
}
|
||||
|
||||
option = arguments[1];
|
||||
return parser(arguments[0]);
|
||||
}
|
||||
|
||||
module.exports = parserWrapper;
|
||||
module.exports.defaultOptions = defaultOptions;
|
41
assets_old/node_modules/posthtml-parser/package.json
generated
vendored
Normal file
41
assets_old/node_modules/posthtml-parser/package.json
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "posthtml-parser",
|
||||
"version": "0.2.1",
|
||||
"description": "Parse HTML/XML to PostHTMLTree",
|
||||
"keywords": [
|
||||
"html",
|
||||
"xml",
|
||||
"parser",
|
||||
"posthtml",
|
||||
"posthtmltree"
|
||||
],
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "npm run lint && npm run coverage",
|
||||
"lint": "jshint . && jscs -v .",
|
||||
"coverage": "istanbul cover --report text --report html --report lcov node_modules/mocha/bin/_mocha",
|
||||
"preversion": "npm test",
|
||||
"postversion": "git push && git push --tags && rm -rf coverage"
|
||||
},
|
||||
"repository": "posthtml/posthtml-parser",
|
||||
"author": "Ivan Voischev <voischev.ivan@ya.ru>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/posthtml/posthtml-parser/issues"
|
||||
},
|
||||
"homepage": "https://github.com/posthtml/posthtml-parser#readme",
|
||||
"dependencies": {
|
||||
"htmlparser2": "^3.8.3",
|
||||
"isobject": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.3.0",
|
||||
"istanbul": "^0.4.0",
|
||||
"jscs": "^2.3.5",
|
||||
"jshint": "^2.8.0",
|
||||
"mocha": "^2.3.3",
|
||||
"rewire": "^2.5.2",
|
||||
"sinon": "^1.17.4",
|
||||
"sinon-chai": "^2.8.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue