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

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