'use strict';

/**
 * Requirements
 * @ignore
 */
const Filter = require('./Filter.js').Filter;
const urls = require('../../utils/urls.js');


/**
 * Generates a svg spritesheet url.
 *
 * @memberOf nunjucks.filter
 */
class SvgUrlFilter extends Filter
{
    /**
     * @inheritDoc
     */
    constructor(baseUrl)
    {
        super();
        this._name = 'svgUrl';

        // Assign options
        this._baseUrl = baseUrl || '/';
    }


    /**
     * @inheritDoc
     */
    static get injections()
    {
        return { 'parameters': ['nunjucks.filter/SvgUrlFilter.baseUrl'] };
    }


    /**
     * @inheritDoc
     */
    static get className()
    {
        return 'nunjucks.filter/SvgUrlFilter';
    }


    /**
     * @type {String}
     */
    get baseUrl()
    {
        if (this.environment &&
            this.environment.buildConfiguration)
        {
            return this.environment.buildConfiguration.get('filters.svgUrl', this._baseUrl);
        }
        return this._baseUrl;
    }


    /**
     * @inheritDoc
     */
    filter(value)
    {
        const scope = this;
        return function(value)
        {
            return urls.concat(scope.baseUrl, value + '.svg#icon');
        };
    }
}


/**
 * Exports
 * @ignore
 */
module.exports.SvgUrlFilter = SvgUrlFilter;

@@ -1146,22 +1146,30 @@
         
-return
+const result =
  urls.co
@@ -1210,16 +1210,94 @@
 icon');%0A
+            return scope.applyCallbacks(result, arguments, %7B asset: value %7D);%0A
         

add filter callback