Blame Scripts/Bash/Functions/Render/render_getDirTemplate.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# render_getDirTemplate.sh -- This function defines the way renderable
878a2b
# directories are processed inside the repository.  Inside the
878a2b
# repository, renderable directories are processed either through
878a2b
# direct or theme-specific rendition.
878a2b
#
878a2b
# Direct rendition takes one XML file from design model
819c26
# (`Identity/Models') directory structure and produces one file
819c26
# in `Identity/Images' directory strucutre. In this
878a2b
# configuration, the organization used to stored the design model is
878a2b
# taken as reference to build the path required to store the image
819c26
# related to it under `Identity/Images' directory structure.
878a2b
#
878a2b
# Theme-specific rendition takes one design model from
819c26
# `Identity/Models/Themes' directory structure to produce one or
819c26
# more images in `Identity/Images/Themes/$THEME/$VERSION/$MODEL'
878a2b
# directory structure. In this configuration we have many different
878a2b
# artistic motifs that use one unique design model directory structure
878a2b
# as reference to produce images. 
878a2b
#
878a2b
# Since theme design models are unified to be reused by more
878a2b
# than one artistic motif, it is not possible to render artistic
878a2b
# motifs in a lineal manner (i.e., as we do with direct rendition)
878a2b
# because we need to establish the relation between the artistic motif
878a2b
# renderable directory structure and the design model first and that
878a2b
# relation happens when renderable directory structures inside
878a2b
# artistic motifs are processed individually.
878a2b
#
878a2b
# In the first rendition category, we use a design model directory
878a2b
# structure as reference to produce images one by one. In the second
878a2b
# rendition category, we can't use the same procedure because one
878a2b
# design model directory structure is used to produce several
878a2b
# renderable directory structures, not just one.
878a2b
#
e6bbbf
# Copyright (C) 2009-2013 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 render_getDirTemplate {
878a2b
878a2b
    # Initialize design models location used as reference to process
878a2b
    # renderable directory structures.
878a2b
    TEMPLATE=$ACTIONVAL
878a2b
878a2b
    # Define absolute path to input files using absolute path from
878a2b
    # output files.
878a2b
    if [[ -d ${TEMPLATE}/Tpl ]];then
878a2b
        TEMPLATE=${TEMPLATE}/Tpl
878a2b
    else
878a2b
        TEMPLATE=$(echo "$TEMPLATE" | sed -r \
878a2b
            -e "s!/Themes/$(cli_getPathComponent $ACTIONVAL --motif)!/Themes/${FLAG_THEME_MODEL}!" \
511811
            -e "s!/(Manuals|Images)!/Models!")
878a2b
    fi
878a2b
878a2b
    # Verify absolute path to input file. This verification is
878a2b
    # specially needed in those situations when the artistic motif
878a2b
    # directory structure has an organization different to that in
878a2b
    # design models directory structure. Since the path to design
878a2b
    # models is built from artistic motif directory structure, if
878a2b
    # artistic motifs directory structure is different from design
878a2b
    # model directory structure, as result we'll have a path to a
878a2b
    # design model that may not exist and that would make
878a2b
    # centos-art.sh script to fail. So, verify the absolute path to
878a2b
    # the input file and stop script execution if it doesn't exist.
2a057c
    cli_checkFiles -e $TEMPLATE
878a2b
878a2b
}