This method is to provide a simple interface so one could call `var cleanedSvgString = require('svg-cleaner').clean(svgString, options)`
485683
function clean(svgString, options) {
  var aSVGCleaner = new SVGCleaner(options);
  aSVGCleaner.load(svgString);
  return aSVGCleaner.clean().svgString();
}
580819
function SVGLoader(loadItem, preferXHR) {
		this.AbstractLoader_constructor(loadItem, preferXHR, createjs.Types.SVG);

		// public properties
		this.resultFormatter = this._formatResult;

		// protected properties
		this._tagSrcAttribute = "data";

		if (preferXHR) {
			this.setTag(createjs.Elements.svg());
		} else {
			this.setTag(createjs.Elements.object());
			this.getTag().type = "image/svg+xml";
		}
	}
598123
function convertSVGToPNG(source, dest, options) {
    if (!fs.existsSync(source)) return Promise.reject(new error.FileNotFoundError({ filename: source }));

    return command.spawn('svgexport', [source, dest])
    .fail(function(err) {
        if (err.code == 'ENOENT') {
            err = error.RequireInstallError({
                cmd: 'svgexport',
                install: 'Install it using: "npm install svgexport -g"'
            });
        }
        throw err;
    })
    .then(function() {
        if (fs.existsSync(dest)) return;

        throw new Error('Error converting '+source+' into '+dest);
    });
}
541817
function process (svg, { prefix }) {
  // Inject a <style> in the SVG document to allow changing colors
  svg = svg.replace(/<(path|circle) /gi, (_, tag) => `<${tag} fill="__COLOR__" `)

  // Since this is a data: URI, we want to encode it with %23 and such
  svg = encodeURIComponent(svg)

  // We want the #{...} interpolation to be outside the URI encoding
  svg = svg.replace(/__COLOR__/g, '#{' + prefix + '-fix-color($color)}')

  svg = 'data:image/svg+xml;charset=utf-8,' + svg

  return svg
}
579756
function injectSvg(){
      // set base before <style> element creating, because IE9+ set baseURI
      // for <style> element on element creation
      setBase(this.baseURI);

      // create <style> element for first time
      if (!this.element)
      {
        this.element = document.createElement('span');

        /** @cut */ this.element.setAttribute('src', this.url);
      }

      // add element to document
      svgStorageElement.appendChild(this.element);

      this.syncSvgText();

      restoreBase();
    }
676011
def svg(file, svg_args, box, paint, trans)
      Squib.logger.debug {"Rendering: #{file}, id: #{id} @#{x},#{y} #{width}x#{height}, alpha: #{alpha}, blend: #{blend}, angle: #{angle}, mask: #{mask}"}
      Squib.logger.warn 'Both an SVG file and SVG data were specified' unless file.to_s.empty? || svg_args.data.to_s.empty?
      return if (file.nil? or file.eql? '') and svg_args.data.nil? # nothing specified TODO Move this out to arg validator
      svg_args.data = File.read(file) if svg_args.data.to_s.empty?
      begin
        svg = Rsvg::Handle.new_from_data(svg_args.data)
      rescue Rsvg::Error::Failed
        Squib.logger.error "Invalid SVG data. Is '#{file}' a valid svg file?"
        return
      end
      box.width    = svg.width  if box.width == :native
      box.height   = svg.height if box.height == :native
      box.width  = svg.width.to_f * box.height.to_f / svg.height.to_f if box.width == :scale
      box.height = svg.height.to_f * box.width.to_f / svg.width.to_f  if box.height == :scale
      scale_width  = box.width.to_f / svg.width.to_f
      scale_height = box.height.to_f / svg.height.to_f
      use_cairo do |cc|
        cc.translate(box.x, box.y)
        cc.flip(trans.flip_vertical, trans.flip_horizontal, box.width / 2, box.height / 2)
        cc.rotate(trans.angle)
        cc.scale(scale_width, scale_height)

        trans.crop_width  = box.width  if trans.crop_width  == :native
        trans.crop_height = box.height if trans.crop_height == :native
        cc.rounded_rectangle(0, 0, trans.crop_width / scale_width, trans.crop_height / scale_height, trans.crop_corner_x_radius, trans.crop_corner_y_radius)
        cc.clip
        cc.translate(-trans.crop_x, -trans.crop_y)

        cc.operator = paint.blend unless paint.blend == :none
        if paint.mask.to_s.empty?
          cc.render_rsvg_handle(svg, id: svg_args.id)
        else
          tmp = Cairo::ImageSurface.new(box.width / scale_width, box.height / scale_height)
          tmp_cc = Cairo::Context.new(tmp)
          tmp_cc.render_rsvg_handle(svg, id: svg_args.id)
          cc.set_source_squibcolor(paint.mask)
          cc.mask(tmp, 0, 0)
        end
      end
    end
1241567
function ( obj, key ) {
		var target;

		if ( regex.svg.test( obj.namespaceURI ) ) {
			obj.removeAttributeNS( obj.namespaceURI, key );
		}
		else {
			if ( obj.nodeName === "SELECT" && key === "selected") {
				target = utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0];

				if ( target !== undefined ) {
					target.selected = false;
					target.removeAttribute( "selected" );
				}
			}
			else {
				obj.removeAttribute( key );
			}
		}

		return obj;
	}
1233372
function svgs(req, res) {
  const bundle = new Bundle(
    req.url.slice(1, -5).split('-').map(function map(name) {
      return assets[name];
    })
  );

  bundle.run(function (err, output) {
    if (err) throw err;

    res.setHeader('Content-Length', Buffer(output).length);
    res.writeHead(200, { 'Content-Type': 'text/plain' });

    res.end(output);
  });
}
847999
function() {
        var svgFeature = "http://www.w3.org/TR/SVG11/feature#";
        return (document.implementation && 
           (document.implementation.hasFeature("org.w3c.svg", "1.0") || 
            document.implementation.hasFeature(svgFeature + "SVG", "1.1") || 
            document.implementation.hasFeature(svgFeature + "BasicStructure", "1.1") ));
    }
130083
def optimize_svg_for_uri_escaping!(svg)
      # Remove comments, xml meta, and doctype
      svg.gsub!(/<!--.*?-->|<\?.*?\?>|<!.*?>/m, '')
      # Replace consecutive whitespace and newlines with a space
      svg.gsub!(/\s+/, ' ')
      # Collapse inter-tag whitespace
      svg.gsub!('> <', '><')
      # Replace " with '
      svg.gsub!(/([\w:])="(.*?)"/, "\\1='\\2'")
      svg.strip!
    end
677712
function inspect(options){
   options = normalize(options);

   return function(files, metalsmith, done) {

      if (options.disable)
      return done();

      //try {
         var bigJSObject = {};

         if (options.includeMetalsmith) {
            bigJSObject[options.includeMetalsmith] = metalsmith.metadata();
         }

         Object.keys(files).forEach(function(filePath){
            var inData = files[filePath];

            if (options.fileFilter(filePath, inData, metalsmith)) {
               var outData = {};
               Object.keys(inData).forEach(function(key) {
                  if (options.accept(key, inData)) {
                     outData[key] = inData[key];
                  }
               });

               if (!options.contentsAsBuffer && outData.contents)
               outData.contents = inData.contents.toString();

               bigJSObject[filePath] = outData;
            }

         });

         options.printfn(bigJSObject);
         done();

   //   }
   //   catch (err) {
   //      done(err);
   //   }
  };

/**
 * Normalize an `options` dictionary.
 *
 * @param {Object} options
 */

 function normalize(options){
    options = options || {};

    options.printfn = options.printfn || function(obj) {
      console.dir(obj, {colors: true});
    };

   if (!options.accept) {
      if (options.include) {
         options.accept = function(propKey) { return options.include.indexOf(propKey) >= 0; };
      }
      else if (options.exclude){
         options.accept = function(propKey) { return options.exclude.indexOf(propKey) < 0; };
      }
      else {
         options.accept = function() { return true; };
      }
   }

   options.fileFilter = fileFilter(options.filter);

   return options;
};


/* calculate file filter function */
function fileFilter(filter) {
  if (filter) {
     if (typeof filter === 'string') {
        var regex = new RegExp(filter);
        return function(filePath) { return regex.test(filePath); }
     }
     else if (filter instanceof RegExp)
        return function(filePath) { return filter.test(filePath); }
     else {   // must be a function itself
        return filter;
     }
   }
   else  // none, return "pass all"
      return function() { return true; };
}



}
877179
function cleanPath(p) {
  p = JSON.stringify(p);
  return p.slice(1, p.length - 1);
}
729952
function processSVGContent(text) {
        if (destroyed) {
            return;
        }

        var query = config.queryString.replace('&', '&#38;'),
            dataUrlCount;

        dataUrlCount = util.countInStr(text, 'xlink:href="data:image');
        // remove data:urls from the SVG content if the number exceeds MAX_DATA_URLS
        if (dataUrlCount > MAX_DATA_URLS) {
            // remove all data:url images that are smaller than 5KB
            text = text.replace(/<image[\s\w-_="]*xlink:href="data:image\/[^"]{0,5120}"[^>]*>/ig, '');
        }

        // @TODO: remove this, because we no longer use any external assets in this way
        // modify external asset urls for absolute path
        text = text.replace(/href="([^"#:]*)"/g, function (match, group) {
            return 'href="' + config.url + group + query + '"';
        });

        return scope.get('stylesheet').then(function (cssText) {
            return interpolateCSSText(text, cssText);
        });
    }
490185
function(options, rawArgs) {
    var cordovaArgSanitizer = new SanitizeArgs({
      rawArgs: rawArgs,
      varOpts: options.variable,
      api: 'plugin'
    });

    var pluginTask = new CordovaRawTask({
      project: this.project,
      rawApi: 'plugins'
    });

    return cordovaArgSanitizer.run()
      .then(function(validated) {
        logger.info(
          'Preparing to ' + validated.action + ' plugins ' + rawArgs
        );

        return pluginTask.run(validated.action, validated.name, {
          save: options.save,
          searchpath: options.searchpath,
          noregistry: options.noregistry,
          nohooks: options.nohooks,
          browserify: options.browserify,
          link: options.link,
          force: options.force,
          cli_variables: validated.varOpts
        });

      }).catch(function(err) {
        logger.error(err);
      });
  }
537080
function ( obj, key, value ) {
		var target, result;

		if ( regex.svg.test( obj.namespaceURI ) ) {
			if ( value === undefined ) {
				result = obj.getAttributeNS( obj.namespaceURI, key );

				if ( result === null || string.isEmpty( result ) ) {
					result = undefined;
				}
				else {
					result = utility.coerce( result );
				}
			}
			else {
				obj.setAttributeNS( obj.namespaceURI, key, value );
			}
		}
		else {
			if ( typeof value === "string" ) {
				value = string.trim( value );
			}

			if ( regex.checked_disabled.test( key ) && value === undefined ) {
				return utility.coerce( obj[key] );
			}
			else if ( regex.checked_disabled.test( key ) && value !== undefined ) {
				obj[key] = value;
			}
			else if ( obj.nodeName === "SELECT" && key === "selected" && value === undefined) {
				return utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0] || utility.$( "#" + obj.id + " option" )[0];
			}
			else if ( obj.nodeName === "SELECT" && key === "selected" && value !== undefined ) {
				target = utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0];

				if ( target !== undefined ) {
					target.selected = false;
					target.removeAttribute( "selected" );
				}

				target = utility.$( "#" + obj.id + " option[value=\"" + value + "\"]" )[0];
				target.selected = true;
				target.setAttribute( "selected", "selected" );
			}
			else if ( value === undefined ) {
				result = obj.getAttribute( key );

				if ( result === null || string.isEmpty( result ) ) {
					result = undefined;
				}
				else {
					result = utility.coerce( result );
				}

				return result;
			}
			else {
				obj.setAttribute( key, value );
			}
		}

		return obj;
	}
260552
function ( src ) {
		var cuts = src.split ( "/" );
		var name = cuts.pop ();
		var dots = src.split ( "." );
		var type = dots.pop ();
		new gui.Request(src).acceptText().get().then(function(status, data) {
			this._output(name, type, data);
		}, this);
	}
517138
def wash_for_js(text):
    
    from invenio_utils.html import escape_javascript_string
    if isinstance(text, six.string_types):
        return '"%s"' % escape_javascript_string(
            text,
            escape_for_html=False,
            escape_CDATA=False,
            escape_script_tag_with_quote=None)
    else:
        return text