From ae2c2086279cb4e2f1439cd0a54ae11dff20884c Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Nov 08 2010 16:44:58 +0000 Subject: Add svg_vaccumDefs.sh function script to support Inkscape's `--vacuum-defs' option inside centos-art.sh `svg' functionality. The `--vacuum-defs' option removes all unused items from the defs section of the SVG files. --- diff --git a/Scripts/Bash/Functions/Svg/svg_getActions.sh b/Scripts/Bash/Functions/Svg/svg_getActions.sh index 6670793..2873b76 100755 --- a/Scripts/Bash/Functions/Svg/svg_getActions.sh +++ b/Scripts/Bash/Functions/Svg/svg_getActions.sh @@ -37,6 +37,11 @@ function svg_getActions { svg_updateMetadata ;; + '--vacuum-defs' ) + # Remove unused items inside svg files. + svg_vacuumDefs + ;; + * ) cli_printMessage "`eval_gettext "The option provided is not valid."`" ;; diff --git a/Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh b/Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh new file mode 100755 index 0000000..a2df515 --- /dev/null +++ b/Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# svg_vacuumDefs.sh -- This function removes all unused items from the +# defs section of the SVG file massively. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svg_vacuumDefs { + + for FILE in $FILES;do + cli_printMessage "$FILE" 'AsUpdatingLine' + inkscape --vacuum-defs $FILE &> /dev/null + done + +}