Blame Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh

ae2c20
#!/bin/bash
ae2c20
#
ae2c20
# svg_vacuumDefs.sh -- This function removes all unused items from the
ae2c20
# <lt>defs<gt> section of the SVG file massively.
ae2c20
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
ae2c20
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (at your option) any later version.
ae2c20
# 
ae2c20
# This program is distributed in the hope that it will be useful, but
ae2c20
# WITHOUT ANY WARRANTY; without even the implied warranty of
ae2c20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ae2c20
# General Public License for more details.
ae2c20
#
ae2c20
# You should have received a copy of the GNU General Public License
ae2c20
# along with this program; if not, write to the Free Software
ae2c20
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
ae2c20
# USA.
7cd8e9
# 
ae2c20
# ----------------------------------------------------------------------
ae2c20
# $Id$
ae2c20
# ----------------------------------------------------------------------
ae2c20
ae2c20
function svg_vacuumDefs {
ae2c20
03a4b4
    local FILE=''
03a4b4
    local FILES=''
03a4b4
03a4b4
    # Redefine filter flag to specify the extension of scalable vector
03a4b4
    # graphics files we want to update metadata in.  Use action value
03a4b4
    # as reference to find out different shell files.
03a4b4
    FLAG_FILTER=".*${FLAG_FILTER}.*\.(svgz|svg)"
03a4b4
03a4b4
    # Build list of files to process.
a33931
    cli_getFilesList
a33931
a33931
    # Process list of files.
ae2c20
    for FILE in $FILES;do
3df173
3df173
        # Output action message.
ae2c20
        cli_printMessage "$FILE" 'AsUpdatingLine'
3df173
3df173
        # Vacuum unused svg definition using inkscape.
ae2c20
        inkscape --vacuum-defs $FILE &> /dev/null
3df173
ae2c20
    done
ae2c20
ae2c20
}