Blame Scripts/Functions/Render/render_svg_doPostActions.sh

8af4d8
#!/bin/bash
8af4d8
#
ccc633
# render_svg_doPostActions.sh -- This function performs
8af4d8
# post-rendition actions for SVG files.
8af4d8
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
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
ccc633
function render_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.
ccc633
    POSTACTIONS[((++${#POSTACTIONS[*]}))]="doPostActions:png:mogrify -comment '$COMMENT'"
ccc633
    [[ $FLAG_POSTRENDITION != '' ]] && POSTACTIONS[((++${#POSTACTIONS[*]}))]="doPostActions: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
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngTo:jpg'
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_groupBy:png jpg'
ccc633
        elif [[ $TEMPLATE =~ "Concept/.+\.svg$" ]];then
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngTo:jpg pdf'
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngToThumbnail:250'
ccc633
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Syslinux/.+\.svg$" ]];then
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngToSyslinux:'
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngToSyslinux:-floyd'
ccc633
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Grub/.+\.svg$" ]];then
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngToGrub:'
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngToGrub:-floyd'
ccc633
        elif [[ $TEMPLATE =~ "Posters/.+\.svg$" ]];then
ccc633
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngTo:jpg pdf'
f191e9
        elif [[ $TEMPLATE =~ "trunk/Identity/Models/Brands/.+\.svg$" ]];then
f191e9
            POSTACTIONS[((++${#POSTACTIONS[*]}))]='svg_convertPngToBrands'
ccc633
        fi
05d9ae
    fi
dc167f
fc1ac6
    # Execute SVG post-rendition actions.
8af4d8
    for ACTION in "${POSTACTIONS[@]}"; do
fc1ac6
        ${FUNCNAM}_$(echo "$ACTION" | cut -d: -f1)
8af4d8
    done
8af4d8
8af4d8
}