schnee effeckt und fehler Korektur
This commit is contained in:
41
node_modules/svgo/plugins/removeDesc.js
generated
vendored
41
node_modules/svgo/plugins/removeDesc.js
generated
vendored
@@ -1,16 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
exports.type = 'perItem';
|
||||
const { detachNodeFromParent } = require('../lib/xast.js');
|
||||
|
||||
exports.name = 'removeDesc';
|
||||
exports.type = 'visitor';
|
||||
exports.active = true;
|
||||
exports.description = 'removes <desc>';
|
||||
|
||||
exports.params = {
|
||||
removeAny: false
|
||||
};
|
||||
|
||||
exports.description = 'removes <desc> (only non-meaningful by default)';
|
||||
|
||||
var standardDescs = /^Created with/;
|
||||
const standardDescs = /^(Created with|Created using)/;
|
||||
|
||||
/**
|
||||
* Removes <desc>.
|
||||
@@ -19,14 +16,26 @@ var standardDescs = /^Created with/;
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc
|
||||
*
|
||||
* @param {Object} item current iteration item
|
||||
* @return {Boolean} if false, item will be filtered out
|
||||
*
|
||||
* @author Daniel Wabyick
|
||||
*
|
||||
* @type {import('../lib/types').Plugin<{ removeAny?: boolean }>}
|
||||
*/
|
||||
exports.fn = function(item, params) {
|
||||
|
||||
return !item.isElem('desc') || !(params.removeAny || item.isEmpty() ||
|
||||
standardDescs.test(item.content[0].text));
|
||||
|
||||
exports.fn = (root, params) => {
|
||||
const { removeAny = true } = params;
|
||||
return {
|
||||
element: {
|
||||
enter: (node, parentNode) => {
|
||||
if (node.name === 'desc') {
|
||||
if (
|
||||
removeAny ||
|
||||
node.children.length === 0 ||
|
||||
(node.children[0].type === 'text' &&
|
||||
standardDescs.test(node.children[0].value))
|
||||
) {
|
||||
detachNodeFromParent(node, parentNode);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user