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-svg-mode/lib
11
assets_old/node_modules/posthtml-svg-mode/lib/parser.js
generated
vendored
Normal file
11
assets_old/node_modules/posthtml-svg-mode/lib/parser.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
const createParser = require('posthtml-parser');
|
||||
|
||||
/**
|
||||
* @see https://github.com/fb55/htmlparser2/wiki/Parser-options
|
||||
*/
|
||||
module.exports = createParser(({
|
||||
xmlMode: true,
|
||||
lowerCaseTags: false,
|
||||
decodeEntities: false,
|
||||
lowerCaseAttributeNames: false
|
||||
}));
|
70
assets_old/node_modules/posthtml-svg-mode/lib/processor.js
generated
vendored
Normal file
70
assets_old/node_modules/posthtml-svg-mode/lib/processor.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
const PostHTML = require('posthtml');
|
||||
const parser = require('./parser');
|
||||
const renderer = require('./renderer');
|
||||
|
||||
/**
|
||||
* @typedef {Object} PostHTMLTree
|
||||
* @see https://github.com/posthtml/posthtml/blob/master/docs/tree.md#json
|
||||
*/
|
||||
|
||||
class PostHTMLProcessingResult {
|
||||
constructor(tree) {
|
||||
this.tree = tree;
|
||||
}
|
||||
|
||||
get html() {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
toString() {
|
||||
return renderer(this.tree, this.tree.options);
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class Processor {
|
||||
/**
|
||||
* @param {Array<Function>} [plugins]
|
||||
*/
|
||||
constructor(plugins) {
|
||||
const posthtml = this.posthtml = PostHTML(plugins);
|
||||
this.version = posthtml.version;
|
||||
this.name = posthtml.name;
|
||||
this.plugins = posthtml.plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {...Function} plugins
|
||||
* @return {Processor}
|
||||
*/
|
||||
use(...plugins) {
|
||||
this.posthtml.use.apply(this, ...plugins);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string|PostHTMLTree} ast
|
||||
* @param {Object} options {@see https://github.com/posthtml/posthtml-render#options}
|
||||
* @return {Promise<PostHTMLProcessingResult>}
|
||||
*/
|
||||
process(ast, options = null) {
|
||||
const opts = Object.assign({ parser }, options);
|
||||
return this.posthtml.process(ast, opts).then(({ tree }) => new PostHTMLProcessingResult(tree));
|
||||
}
|
||||
}
|
||||
|
||||
Processor.parser = parser;
|
||||
Processor.render = renderer;
|
||||
|
||||
/**
|
||||
* @param {Array<Function>} [plugins]
|
||||
* @return {Processor}
|
||||
*/
|
||||
module.exports = plugins => new Processor(plugins);
|
||||
module.exports.parser = parser;
|
||||
module.exports.renderer = renderer;
|
||||
module.exports.Processor = Processor;
|
||||
module.exports.Result = PostHTMLProcessingResult;
|
49
assets_old/node_modules/posthtml-svg-mode/lib/renderer.js
generated
vendored
Normal file
49
assets_old/node_modules/posthtml-svg-mode/lib/renderer.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
const merge = require('merge-options');
|
||||
const renderer = require('posthtml-render');
|
||||
const api = require('posthtml/lib/api');
|
||||
|
||||
const defaultOptions = {
|
||||
closingSingleTag: 'slash',
|
||||
singleTags: [
|
||||
'circle',
|
||||
'path',
|
||||
'ellipse',
|
||||
'line',
|
||||
'path',
|
||||
'polygon',
|
||||
'polyline',
|
||||
'rect',
|
||||
'use',
|
||||
'animateTransform',
|
||||
'stop'
|
||||
]
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {PostHTMLTree} tree
|
||||
* @param {Object|null} [options] {@see https://github.com/posthtml/posthtml-render#options}
|
||||
*/
|
||||
module.exports = function xmlRenderer(tree, options) {
|
||||
const opts = merge(defaultOptions, options || {});
|
||||
|
||||
/**
|
||||
* Workaround for https://github.com/fb55/htmlparser2/issues/187
|
||||
* Also see https://github.com/fb55/htmlparser2/pull/129
|
||||
*/
|
||||
opts.singleTags = opts.singleTags.filter((tag) => {
|
||||
let hasContent = false;
|
||||
|
||||
api.match.call(tree, { tag }, (node) => {
|
||||
if (typeof node.content !== 'undefined' && !hasContent) {
|
||||
hasContent = true;
|
||||
}
|
||||
return node;
|
||||
});
|
||||
|
||||
return !hasContent;
|
||||
});
|
||||
|
||||
return renderer(tree, opts);
|
||||
};
|
||||
|
||||
module.exports.defaultOptions = defaultOptions;
|
Loading…
Add table
Add a link
Reference in a new issue