Blame Scripts/Functions/Render/Backends/Svg/svg_doPostActions.sh

8af4d8
#!/bin/bash
8af4d8
#
5eb9ec
# svg_doPostActions.sh -- This function performs post-rendition
5eb9ec
# actions for SVG files.
8af4d8
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
8af4d8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8af4d8
# General Public License for more details.
8af4d8
#
8af4d8
# You should have received a copy of the GNU General Public License
8af4d8
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
8af4d8
# ----------------------------------------------------------------------
8af4d8
# $Id$
8af4d8
# ----------------------------------------------------------------------
8af4d8
5eb9ec
function svg_doPostActions {
8af4d8
8af4d8
    local ACTION=''
ccc633
ccc633
    # Redefine SVG post-rendition actions as local to avoid undesired
ccc633
    # concatenation when massive rendition is performed.
05d9ae
    local -a POSTACTIONS
05d9ae
ccc633
    # Define default comment written to base-rendition output.
ccc633
    local COMMENT="`gettext "Created in CentOS Arwork Repository"` ($(cli_printUrl '--projects-artwork'))"
ccc633
ccc633
    # Define SVG post-rendition actions. Since these actions are
ccc633
    # applied to base-rendition output and base-rendition output is
ccc633
    # used as reference to perform directory-specific rendition, these
ccc633
    # action must be defined before directory-specific rendition.
ccc633
    # Otherwise it wouldn't be possible to propagate changes impossed
ccc633
    # by these actions to new files produced as result of
ccc633
    # directory-specific rendition.
5eb9ec
    POSTACTIONS[((++${#POSTACTIONS[*]}))]="doPostCommand:png:mogrify -comment '$COMMENT'"
5eb9ec
    [[ $FLAG_POSTRENDITION != '' ]] && POSTACTIONS[((++${#POSTACTIONS[*]}))]="doPostCommand:png:${FLAG_POSTRENDITION}"
fc1ac6
fc1ac6
    # Define SVG directory-specific rendition. Directory-specfic
fc1ac6
    # rendition provides a predictable way of producing content inside
fc1ac6
    # the repository.
ccc633
    if [[ $FLAG_DONT_DIRSPECIFIC == 'false' ]];then
ccc633
        if [[ $TEMPLATE =~ "Backgrounds/.+\.svg$" ]];then
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg'
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='groupBy:png jpg'
ccc633
        elif [[ $TEMPLATE =~ "Concept/.+\.svg$" ]];then
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf'
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToThumbnail:250'
ccc633
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Syslinux/.+\.svg$" ]];then
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToSyslinux:'
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToSyslinux:-floyd'
ccc633
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Grub/.+\.svg$" ]];then
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToGrub:'
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToGrub:-floyd'
ccc633
        elif [[ $TEMPLATE =~ "Posters/.+\.svg$" ]];then
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf'
f191e9
        elif [[ $TEMPLATE =~ "trunk/Identity/Models/Brands/.+\.svg$" ]];then
5eb9ec
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToBrands'
ccc633
        fi
05d9ae
    fi
dc167f
fc1ac6
    # Execute SVG post-rendition actions.
8af4d8
    for ACTION in "${POSTACTIONS[@]}"; do
5eb9ec
        ${RENDER_BACKEND}_$(echo "$ACTION" | cut -d: -f1)
8af4d8
    done
8af4d8
8af4d8
}