2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-11 18:02:26 +03:00
Files
bbob/packages/bbob-preset-html5/src/index.js
T
Nikolay Kostyurin 32a7fb51da refactor(*): convert to babel and generation to lib, es, dist folders (#2)
* refactor(*): convert to babel and generation to lib, es, dist

* chore(*): remove generated files

* fix(*): lint run command
2018-09-09 23:55:28 +02:00

26 lines
605 B
JavaScript

/* eslint-disable indent */
import { isTagNode } from '@bbob/plugin-helper';
import defaultTags from './defaultTags';
function process(tags, tree, core) {
tree.walk(node => (isTagNode(node) && tags[node.tag]
? tags[node.tag](node, core)
: node));
}
function html5Preset(opts = {}) {
const tags = Object.assign({}, defaultTags, opts.tags || {});
return (tree, core) => process(tags, tree, core);
}
function extend(callback) {
const tags = callback(defaultTags);
return () => (tree, core) => process(tags, tree, core);
}
html5Preset.extend = extend;
export default html5Preset;