diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImages.sh b/Scripts/Bash/Functions/Render/render_doIdentityImages.sh index 513a82f..95b704b 100644 --- a/Scripts/Bash/Functions/Render/render_doIdentityImages.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImages.sh @@ -29,6 +29,7 @@ function render_doIdentityImages { local EXPORTID='' local EXTERNALFILES='' local EXTERNALFILE='' + local COMMONDIRCOUNT=0 # Export id used inside design templates. This value defines the # design area we want to export. @@ -121,27 +122,50 @@ function render_doIdentityImages { # Output separator line. cli_printMessage '-' 'AsSeparatorLine' - done - - # Define and execute possible last-rendition actions for image - # rendeirng base action. - for ACTION in "${LASTACTIONS[@]}"; do - - case "$ACTION" in - - renderKSplash ) - render_doIdentityImageKsplash - ;; - - renderDm:* ) - render_doIdentityImageDm "$ACTION" - ;; - - groupByType:* ) - render_doIdentityGroupByType "$ACTION" - ;; + # Apply last-rendition actions. As convenction, last-rendition + # actions are applied after all images inside the same + # directory structure have been produced. Notice that, in + # order to apply last-rendition actions correctly, + # centos-art.sh needs to "predict" what the last file in the + # same directory structure would be. There is no magic here, + # so we need to previously define which are the common + # directory structures centos-art.sh could produce content + # for inside an array variable. Later, using the index of that + # array variable we could check the next item in the array + # against the file being currently produced. If they match, we + # haven't reached the end of the same directory structure, but + # if they don't match, we do have reach the end of the same + # directory structure and it is time for last-rendition + # actions to be evaluated before go producing the next + # directory structure in the list of files to process. + if [[ ${COMMONDIRS[$((COMMONDIRCOUNT + 1))]} != $(dirname $TRANSLATION) ]];then + # At this point centos-art.sh is producing the last file + # from the same unique directory structure, so, before + # producing images for the next directory structure lets + # evaluate last-rendition actions for the current + # directory structure. + for ACTION in "${LASTACTIONS[@]}"; do + + case "$ACTION" in + + renderKSplash ) + render_doIdentityImageKsplash + ;; + + renderDm:* ) + render_doIdentityImageDm "$ACTION" + ;; + + groupByType:* ) + render_doIdentityGroupByType "$ACTION" + ;; + + esac + done + fi - esac + # Increment common directory counter. + COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) done diff --git a/Scripts/Bash/Functions/Render/render_getFilesList.sh b/Scripts/Bash/Functions/Render/render_getFilesList.sh index 7ea6422..84233e4 100644 --- a/Scripts/Bash/Functions/Render/render_getFilesList.sh +++ b/Scripts/Bash/Functions/Render/render_getFilesList.sh @@ -27,6 +27,9 @@ function render_getFilesList { + local COMMONDIR='' + local COMMONDIRCOUNT=0 + # Define source location to look files for. In order to define # source location we evaluate both matching list and translation # path information, and based on them, we set which is the source @@ -71,4 +74,13 @@ function render_getFilesList { # Define list of files to process. cli_getFilesList "$LOCATION" + # Define common absolute paths in order to know when centos-art.sh + # is leaving a directory structure and entering into another. This + # information is required in order for centos-art.sh to know when + # to apply last-rendition actions. + for COMMONDIR in $(dirname "$FILES" | sort | uniq);do + COMMONDIRS[$COMMONDIRCOUNT]=$(dirname $COMMONDIR) + COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) + done + } diff --git a/Scripts/Bash/Functions/Render/render_getIdentityBase.sh b/Scripts/Bash/Functions/Render/render_getIdentityBase.sh index 7ae43fb..017577b 100755 --- a/Scripts/Bash/Functions/Render/render_getIdentityBase.sh +++ b/Scripts/Bash/Functions/Render/render_getIdentityBase.sh @@ -26,15 +26,15 @@ function render_getIdentityBase { - # Define variables as local to avoid conflicts outside. local TRANSLATIONPATH='' local SVG='' local IMG='' local PARENTDIR='' + local FILES='' + local FILTER='' local LOCATION='' local EXTENSION='' - local FILTER='' - local FILES='' + local -a COMMONDIRS # Redefine absolute path to artwork's related translation entry. render_getIdentityDirTranslation