Blame Scripts/Bash/Cli/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
    # Build list of files to process.
d26634
    FILES=$(cli_getFilesList "${ACTIONVAL}" "${FLAG_FILTER}.*\.(svgz|svg)")
d26634
d26634
    # Set action preamble.
467208
    cli_printActionPreamble "${FILES}" '' ''
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
}