diff --git a/Automation/Modules/Render/Modules/Archive/archive.sh b/Automation/Modules/Render/Modules/Archive/archive.sh deleted file mode 100755 index f84125c..0000000 --- a/Automation/Modules/Render/Modules/Archive/archive.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Archive/archive.sh -- This file -# standardizes file archiving inside the centos-art.sh script. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function archive { - - tcar_printMessage "${TARGET}" --as-creating-line - - COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") - if [[ -z ${COMMAND} ]];then - COMMAND="/bin/tar --remove-files -czf" - fi - - # Let file names to be changed before compressing them. - for SOURCE in ${SOURCES[*]};do - FILE_LH=$(echo ${SOURCE} | gawk -F: '{ print $1 }') - tcar_checkFiles -ef ${FILE_LH} - FILE_RH=$(echo ${SOURCE} | gawk -F: '{ print $2 }') - cp ${FILE_LH} ${TCAR_SCRIPT_TEMPDIR}/${FILE_RH} - done - - pushd ${TCAR_SCRIPT_TEMPDIR} > /dev/null - - ${COMMAND} ${TARGET} * - - popd > /dev/null - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/Modules/Article/article.sh b/Automation/Modules/Render/Modules/Asciidoc/Modules/Article/article.sh deleted file mode 100755 index 310b9ab..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/Modules/Article/article.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -function article { - - asciidoc_setFormatsRendition - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/Modules/Book/book.sh b/Automation/Modules/Render/Modules/Asciidoc/Modules/Book/book.sh deleted file mode 100755 index 1c55acf..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/Modules/Book/book.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -function book { - - asciidoc_setFormatsRendition - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/Modules/Manpage/manpage.sh b/Automation/Modules/Render/Modules/Asciidoc/Modules/Manpage/manpage.sh deleted file mode 100755 index bb2b4c7..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/Modules/Manpage/manpage.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -function manpage { - - local MANSECT=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "mansect") - - tcar_checkFiles -m '[1-9]' "${MANSECT}" - - for FORMAT in ${FORMATS};do - - tcar_checkFiles -m '(xhtml|manpage)' "${FORMAT}" - - case ${FORMAT} in - - 'xhtml' ) - local HTML_TARGET="$(dirname ${TARGET})/htmlman${MANSECT}/$(basename ${TARGET}).${MANSECT}.html" - asciidoc_setXhtmlRendition "${HTML_TARGET}" - ;; - - 'manpage' ) - local MAN_TARGET="$(dirname ${TARGET})/man${MANSECT}/$(basename ${TARGET}).${MANSECT}" - if [[ ! -d $(dirname ${MAN_TARGET}) ]];then - mkdir -p $(dirname ${MAN_TARGET}) - fi - tcar_printMessage "${MAN_TARGET}" --as-creating-line - /usr/bin/xsltproc -o ${MAN_TARGET} --nonet \ - ${DOCBOOK_XSL}/docbook2manpage.xsl ${DOCBOOK_FILE} - ;; - esac - - done - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/asciidoc.sh b/Automation/Modules/Render/Modules/Asciidoc/asciidoc.sh deleted file mode 100755 index e7a8126..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/asciidoc.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Asciidoc/asciidoc.sh -- This function -# standardizes rendition of asciidoc files inside the centos-art.sh -# script. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function asciidoc { - - local DOCBOOK_VER="1.69.1" - local DOCBOOK_XSL="${TCAR_BASEDIR}/Artworks/Webenv/Docbook/${DOCBOOK_VER}/Xsl" - local DOCBOOK_CSS="${TCAR_BASEDIR}/Artworks/Webenv/Docbook/${DOCBOOK_VER}/Css" - - RENDER_FLOW=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" 'render-flow') - if [[ -z ${RENDER_FLOW} ]];then - RENDER_FLOW="article" - fi - tcar_checkFiles -m '^(article|book|manpage)$' "${RENDER_FLOW}" - - FORMATS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" 'formats') - if [[ -z ${FORMATS} ]];then - FORMATS='xhtml' - fi - - local -a SOURCE_INSTANCES - local -a TARGET_INSTANCES - - asciidoc_setBaseRendition - - unset SOURCE_INSTANCES - unset TARGET_INSTANCES - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setBaseRendition.sh b/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setBaseRendition.sh deleted file mode 100755 index bc72693..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setBaseRendition.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Asciidoc/Scripts/asciidoc_setBaseRendition.sh -# -- This function standardizes transformation of asciidoc files -# into docbook files. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function asciidoc_setBaseRendition { - - local COUNTER=0 - - while [[ ${COUNTER} -lt ${#SOURCES[*]} ]];do - - tcar_checkFiles -ef -m '\.asciidoc$' "${SOURCES[${COUNTER}]}" - - # Define file name for design model instances. We need to use - # a random string in from of it to prevent duplication. - # Remember that different files can have the same name in - # different locations. Use the correct file information. - SOURCE_INSTANCES[${COUNTER}]=$(tcar_getTemporalFile "${RANDOM}-$(basename ${SOURCES[${COUNTER}]})") - - # Define file name for image instances. We need to use a - # random string in from of it to prevent duplication. - # Remember that different files can have the same name in - # different locations. Use the correct file information. - TARGET_INSTANCES[${COUNTER}]=$(tcar_getTemporalFile "${RANDOM}-$(basename ${SOURCES[${COUNTER}]} \ - | sed -r 's/\.asciidoc$/.docbook/')") - - /usr/bin/asciidoc --backend="docbook" --doctype="${RENDER_FLOW}" \ - --out-file="${SOURCE_INSTANCES[${COUNTER}]}" ${SOURCES[${COUNTER}]} - - # Create source instance considering whether or not it has - # translation files related.Apply translation files to source - # instance, if any. - render_setLocalizedXml "${SOURCE_INSTANCES[${COUNTER}]}" "${TARGET_INSTANCES[${COUNTER}]}" - - # Make your best to be sure the source instance you are - # processing is a valid DocBook file. - tcar_checkFiles -i 'text/xml' ${TARGET_INSTANCES[${COUNTER}]} - - # Expand any translation file that might exist. - tcar_setTranslationMarkers ${TARGET_INSTANCES[${COUNTER}]} - - COUNTER=$(( ${COUNTER} + 1 )) - - done - - # Initiate format-specific transformations for current render - # flow. - for DOCBOOK_FILE in ${TARGET_INSTANCES[*]};do - tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" - done - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh b/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh deleted file mode 100755 index f61d112..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Scripts/asciidoc_setBaseRenditionCommand.sh -# -- This function standardizes the way Asciidoc files are rendered -# inside the centos-art.sh script. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function asciidoc_setBaseRenditionCommand { - - tcar_checkFiles -m '^(article|book|manpage)$' ${RENDER_TYPE} - - asciidoc --backend docbook --doctype ${RENDER_TYPE} -o ${TARGET} - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setFormatsRendition.sh b/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setFormatsRendition.sh deleted file mode 100755 index 240dfc1..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setFormatsRendition.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -function asciidoc_setFormatsRendition { - - for FORMAT in ${FORMATS};do - - case ${FORMAT} in - 'xhtml' ) - asciidoc_setXhtmlRendition "${TARGET}" - ;; - esac - - done - -} diff --git a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh b/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh deleted file mode 100755 index 8b47790..0000000 --- a/Automation/Modules/Render/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -function asciidoc_setXhtmlRendition { - - local TARGET="${1}" - - RENDER_PAGES=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-page") - if [[ -z ${RENDER_PAGES} ]];then - RENDER_PAGES='single' - fi - tcar_checkFiles -m '^(single|chunks)$' "${RENDER_PAGES}" - - IMAGES_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "images-from") - if [[ -z ${IMAGES_FROM} ]];then - IMAGES_FROM="${TCAR_BASEDIR}/Artworks/Icons/Webenv" - fi - - STYLES_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "styles-from") - if [[ -z ${STYLES_FROM} ]];then - STYLES_FROM="${TCAR_BASEDIR}/Artworks/Webenv/Docbook/1.69.1/Css" - fi - - # When producing chunks, take into consideration that both single - # and chunks share images produced in the root location. If we - # create another level of directories to store chunks, that would - # make impossible to use one unique image path for both single and - # chunks from one unique asciidoc document. So, to reuse image - # files, produce both chunks and single XHTML output in the same - # directory. - if [[ ${RENDER_PAGES} == 'chunks' ]];then - TARGET="$(dirname ${TARGET})/" - fi - - if [[ ! -d $(dirname ${TARGET}) ]];then - mkdir -p $(dirname ${TARGET}) - fi - - ln -sfn ${IMAGES_FROM} $(dirname ${TARGET})/Images - ln -sfn ${STYLES_FROM} $(dirname ${TARGET})/Css - - tcar_printMessage "${TARGET}" --as-creating-line - - for RENDER_PAGE in ${RENDER_PAGES};do - /usr/bin/xsltproc -o ${TARGET} --nonet \ - ${DOCBOOK_XSL}/docbook2xhtml-${RENDER_PAGE}.xsl ${DOCBOOK_FILE} - done - -} diff --git a/Automation/Modules/Render/Modules/Compress/compress.sh b/Automation/Modules/Render/Modules/Compress/compress.sh deleted file mode 100755 index d355d81..0000000 --- a/Automation/Modules/Render/Modules/Compress/compress.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Compress/compress.sh -- This file -# standardize file compression inside the centos-art.sh script. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function compress { - - tcar_printMessage "${TARGET}" --as-creating-line - - COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") - if [[ -z ${COMMAND} ]];then - COMMAND="/bin/gzip" - fi - - tcar_checkFiles -ef ${SOURCES[*]} - - ${COMMAND} ${SOURCES[*]} - -} diff --git a/Automation/Modules/Render/Modules/Directories/directories.sh b/Automation/Modules/Render/Modules/Directories/directories.sh new file mode 100755 index 0000000..95ef77d --- /dev/null +++ b/Automation/Modules/Render/Modules/Directories/directories.sh @@ -0,0 +1,51 @@ +#!/bin/bash +###################################################################### +# +# directories.sh -- This module initializes processing of +# configuration files when the argument provided in the command-line +# points to a directory. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function directories { + + local DIRECTORY="${1}" + + local CONFIGURATION_FILES=$(tcar_getFilesList ${DIRECTORY} \ + --pattern=".+/.+\.conf$" --type='f') + + local CONFIGURATION_SYMLINKS=$(tcar_getFilesList ${DIRECTORY} \ + --pattern=".+/.+\.conf$" --type='l') + + local CONFIGURATIONS="${CONFIGURATION_FILES} ${CONFIGURATION_SYMLINKS}" + + # Verify existence of configuration files. Take care that + # tcar_getFilesList might return empty values sometimes (e.g., + # when no file is found). + tcar_checkFiles -e "${CONFIGURATIONS}" + + # Process each configuration file. + for CONFIGURATION in ${CONFIGURATIONS};do + tcar_setModuleEnvironment -m 'files' -t 'sibling' -g "${CONFIGURATION}" + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh b/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh new file mode 100755 index 0000000..f84125c --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh @@ -0,0 +1,51 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Archive/archive.sh -- This file +# standardizes file archiving inside the centos-art.sh script. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function archive { + + tcar_printMessage "${TARGET}" --as-creating-line + + COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") + if [[ -z ${COMMAND} ]];then + COMMAND="/bin/tar --remove-files -czf" + fi + + # Let file names to be changed before compressing them. + for SOURCE in ${SOURCES[*]};do + FILE_LH=$(echo ${SOURCE} | gawk -F: '{ print $1 }') + tcar_checkFiles -ef ${FILE_LH} + FILE_RH=$(echo ${SOURCE} | gawk -F: '{ print $2 }') + cp ${FILE_LH} ${TCAR_SCRIPT_TEMPDIR}/${FILE_RH} + done + + pushd ${TCAR_SCRIPT_TEMPDIR} > /dev/null + + ${COMMAND} ${TARGET} * + + popd > /dev/null + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Article/article.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Article/article.sh new file mode 100755 index 0000000..310b9ab --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Article/article.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +function article { + + asciidoc_setFormatsRendition + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Book/book.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Book/book.sh new file mode 100755 index 0000000..1c55acf --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Book/book.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +function book { + + asciidoc_setFormatsRendition + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh new file mode 100755 index 0000000..bb2b4c7 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +function manpage { + + local MANSECT=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "mansect") + + tcar_checkFiles -m '[1-9]' "${MANSECT}" + + for FORMAT in ${FORMATS};do + + tcar_checkFiles -m '(xhtml|manpage)' "${FORMAT}" + + case ${FORMAT} in + + 'xhtml' ) + local HTML_TARGET="$(dirname ${TARGET})/htmlman${MANSECT}/$(basename ${TARGET}).${MANSECT}.html" + asciidoc_setXhtmlRendition "${HTML_TARGET}" + ;; + + 'manpage' ) + local MAN_TARGET="$(dirname ${TARGET})/man${MANSECT}/$(basename ${TARGET}).${MANSECT}" + if [[ ! -d $(dirname ${MAN_TARGET}) ]];then + mkdir -p $(dirname ${MAN_TARGET}) + fi + tcar_printMessage "${MAN_TARGET}" --as-creating-line + /usr/bin/xsltproc -o ${MAN_TARGET} --nonet \ + ${DOCBOOK_XSL}/docbook2manpage.xsl ${DOCBOOK_FILE} + ;; + esac + + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh new file mode 100755 index 0000000..e7a8126 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh @@ -0,0 +1,54 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Asciidoc/asciidoc.sh -- This function +# standardizes rendition of asciidoc files inside the centos-art.sh +# script. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function asciidoc { + + local DOCBOOK_VER="1.69.1" + local DOCBOOK_XSL="${TCAR_BASEDIR}/Artworks/Webenv/Docbook/${DOCBOOK_VER}/Xsl" + local DOCBOOK_CSS="${TCAR_BASEDIR}/Artworks/Webenv/Docbook/${DOCBOOK_VER}/Css" + + RENDER_FLOW=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" 'render-flow') + if [[ -z ${RENDER_FLOW} ]];then + RENDER_FLOW="article" + fi + tcar_checkFiles -m '^(article|book|manpage)$' "${RENDER_FLOW}" + + FORMATS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" 'formats') + if [[ -z ${FORMATS} ]];then + FORMATS='xhtml' + fi + + local -a SOURCE_INSTANCES + local -a TARGET_INSTANCES + + asciidoc_setBaseRendition + + unset SOURCE_INSTANCES + unset TARGET_INSTANCES + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh new file mode 100755 index 0000000..bc72693 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh @@ -0,0 +1,75 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Asciidoc/Scripts/asciidoc_setBaseRendition.sh +# -- This function standardizes transformation of asciidoc files +# into docbook files. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function asciidoc_setBaseRendition { + + local COUNTER=0 + + while [[ ${COUNTER} -lt ${#SOURCES[*]} ]];do + + tcar_checkFiles -ef -m '\.asciidoc$' "${SOURCES[${COUNTER}]}" + + # Define file name for design model instances. We need to use + # a random string in from of it to prevent duplication. + # Remember that different files can have the same name in + # different locations. Use the correct file information. + SOURCE_INSTANCES[${COUNTER}]=$(tcar_getTemporalFile "${RANDOM}-$(basename ${SOURCES[${COUNTER}]})") + + # Define file name for image instances. We need to use a + # random string in from of it to prevent duplication. + # Remember that different files can have the same name in + # different locations. Use the correct file information. + TARGET_INSTANCES[${COUNTER}]=$(tcar_getTemporalFile "${RANDOM}-$(basename ${SOURCES[${COUNTER}]} \ + | sed -r 's/\.asciidoc$/.docbook/')") + + /usr/bin/asciidoc --backend="docbook" --doctype="${RENDER_FLOW}" \ + --out-file="${SOURCE_INSTANCES[${COUNTER}]}" ${SOURCES[${COUNTER}]} + + # Create source instance considering whether or not it has + # translation files related.Apply translation files to source + # instance, if any. + render_setLocalizedXml "${SOURCE_INSTANCES[${COUNTER}]}" "${TARGET_INSTANCES[${COUNTER}]}" + + # Make your best to be sure the source instance you are + # processing is a valid DocBook file. + tcar_checkFiles -i 'text/xml' ${TARGET_INSTANCES[${COUNTER}]} + + # Expand any translation file that might exist. + tcar_setTranslationMarkers ${TARGET_INSTANCES[${COUNTER}]} + + COUNTER=$(( ${COUNTER} + 1 )) + + done + + # Initiate format-specific transformations for current render + # flow. + for DOCBOOK_FILE in ${TARGET_INSTANCES[*]};do + tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh new file mode 100755 index 0000000..f61d112 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh @@ -0,0 +1,35 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Scripts/asciidoc_setBaseRenditionCommand.sh +# -- This function standardizes the way Asciidoc files are rendered +# inside the centos-art.sh script. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function asciidoc_setBaseRenditionCommand { + + tcar_checkFiles -m '^(article|book|manpage)$' ${RENDER_TYPE} + + asciidoc --backend docbook --doctype ${RENDER_TYPE} -o ${TARGET} + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh new file mode 100755 index 0000000..240dfc1 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +function asciidoc_setFormatsRendition { + + for FORMAT in ${FORMATS};do + + case ${FORMAT} in + 'xhtml' ) + asciidoc_setXhtmlRendition "${TARGET}" + ;; + esac + + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh new file mode 100755 index 0000000..8b47790 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +function asciidoc_setXhtmlRendition { + + local TARGET="${1}" + + RENDER_PAGES=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-page") + if [[ -z ${RENDER_PAGES} ]];then + RENDER_PAGES='single' + fi + tcar_checkFiles -m '^(single|chunks)$' "${RENDER_PAGES}" + + IMAGES_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "images-from") + if [[ -z ${IMAGES_FROM} ]];then + IMAGES_FROM="${TCAR_BASEDIR}/Artworks/Icons/Webenv" + fi + + STYLES_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "styles-from") + if [[ -z ${STYLES_FROM} ]];then + STYLES_FROM="${TCAR_BASEDIR}/Artworks/Webenv/Docbook/1.69.1/Css" + fi + + # When producing chunks, take into consideration that both single + # and chunks share images produced in the root location. If we + # create another level of directories to store chunks, that would + # make impossible to use one unique image path for both single and + # chunks from one unique asciidoc document. So, to reuse image + # files, produce both chunks and single XHTML output in the same + # directory. + if [[ ${RENDER_PAGES} == 'chunks' ]];then + TARGET="$(dirname ${TARGET})/" + fi + + if [[ ! -d $(dirname ${TARGET}) ]];then + mkdir -p $(dirname ${TARGET}) + fi + + ln -sfn ${IMAGES_FROM} $(dirname ${TARGET})/Images + ln -sfn ${STYLES_FROM} $(dirname ${TARGET})/Css + + tcar_printMessage "${TARGET}" --as-creating-line + + for RENDER_PAGE in ${RENDER_PAGES};do + /usr/bin/xsltproc -o ${TARGET} --nonet \ + ${DOCBOOK_XSL}/docbook2xhtml-${RENDER_PAGE}.xsl ${DOCBOOK_FILE} + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh b/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh new file mode 100755 index 0000000..d355d81 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh @@ -0,0 +1,41 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Compress/compress.sh -- This file +# standardize file compression inside the centos-art.sh script. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function compress { + + tcar_printMessage "${TARGET}" --as-creating-line + + COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") + if [[ -z ${COMMAND} ]];then + COMMAND="/bin/gzip" + fi + + tcar_checkFiles -ef ${SOURCES[*]} + + ${COMMAND} ${SOURCES[*]} + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh b/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh new file mode 100755 index 0000000..f41839a --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh @@ -0,0 +1,49 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Direct/images.sh -- This module +# standardizes production of image files from other image files. +# There is no intermediate process here. The image or images +# provided as value to render-from variable are used to create the +# image specified in the section line using the command specified in +# the command variable, without any intermediate process. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function images { + + tcar_checkFiles -i "image" ${SOURCE[*]} + + COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") + if [[ -z ${COMMAND} ]];then + COMMAND="/usr/bin/images -append" + fi + + if [[ ! -d $(dirname ${TARGET}) ]];then + mkdir -p $(dirname ${TARGET}) + fi + + tcar_printMessage "${TARGET}" --as-creating-line + + eval ${COMMAND} ${SOURCES[*]} ${TARGET} + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh new file mode 100755 index 0000000..67fbb2d --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh @@ -0,0 +1,103 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Palette/palette.sh -- This function +# standardizes the way palette of colors are applied to image files +# in order to produce images with specific number of colors. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function palette { + + local FILENAME=$(tcar_getTemporalFile "$(echo ${SOURCES[0]} \ + | sed -r 's/\.[[:alpha:]]+$//')") + + local LOGS=${TARGET}.log + + # Define absolute path to GPL palette. This file is the reference + # taken to set the max number of colors the final image will be + # produced for. + local PALETTE_GPL=$(dirname ${CONFIGURATION})/$(tcar_getConfigValue ${CONFIGURATION} ${SECTION} 'palette-gpl') + + local PALETTE_GPL_COLORS=$(palette_getColors "${PALETTE_GPL}") + + # Define absolute path to PPM palette. The PPM palette is built + # from source palette (PALETTE_GPL) and provides the color + # information understood by `ppmremap', the program used to + # produce images in a specific amount of colors. + local PALETTE_PPM=$(tcar_getTemporalFile 'palette.ppm') + + # Verify format of colors returned in the list. + palette_checkColorFormats "${PALETTE_GPL_COLORS}" + + # Create image in Netpbm superformat (PNM). The PNM image file is + # created from the PNG image rendered previously as centos-art + # base-rendition output. The PNM image is an intermediate format + # used to manipulate images through Netpbm tools. + pngtopnm -verbose \ + < ${SOURCE[0]} 2>${LOGS} > ${FILENAME}.pnm + + # Create PPM palette using GPL palette. + palette_convertGplToPpm + + # Reduce colors as specified in PPM palette. Here we use the PPM + # palette to enforce the color position in the image index and the + # Floyd-Steinberg dithering in order to improve color reduction. + pnmremap -verbose -mapfile=${PALETTE_PPM} -floyd \ + < ${FILENAME}.pnm 2>>${LOGS} > ${FILENAME}.ppm + + # Print action message. + tcar_printMessage "${TARGET}" --as-creating-line + + if [[ ${TARGET} =~ '\.lss$' ]];then + + # Define the HEX palette. The HEX palette is built from source + # palette (PALETTE_GPL) and provides the color information in + # the format understood by `ppmtolss16', the program used to + # produce images in LSS16 format. The HEX palette stores just + # one line with the color information as described in isolinux + # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in + # the same line]) + local PALETTE_HEX=$(tcar_getTemporalFile "palette.hex") + + # Create HEX palette using GPL palette. + palette_convertGplToHex + + # Create LSS16 image. + ppmtolss16 $(cat ${PALETTE_HEX}) \ + < ${FILENAME}.ppm 2>>${LOGS} > ${TARGET} + + # Create PPM image indexed to 16 colors. Also the colormap + # used in the LSS16 image is saved on ${FILE}.log; this is + # useful to verify the correct order of colors in the image + # index. + lss16toppm -map \ + < ${TARGET} 2>>${LOGS} > ${TARGET}.ppm + + else + + # Create final file. + /usr/bin/convert ${FILENAME}.ppm ${TARGET} + + fi + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_checkColorFormat.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_checkColorFormat.sh new file mode 100755 index 0000000..30973eb --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_checkColorFormat.sh @@ -0,0 +1,40 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_checkColorFormats.sh +# -- This function verifies formats of colors (i.e., the way color +# information is specified). +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function palette_checkColorFormats { + + local COLOR='' + local PALETTE_COLORS=${1} + + # Loop through colors and perform format verification as specified + # by pattern. + for COLOR in ${PALETTE_COLORS};do + tcar_checkFiles -m '^#[0-9a-f]{6}$' "${COLOR}" + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToHex.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToHex.sh new file mode 100755 index 0000000..e9fce4c --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToHex.sh @@ -0,0 +1,37 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_convertGplToHex.sh +# -- This function takes one palette produced by GIMP (e.g., +# syslinux.gpl) as input and outputs the list of hexadecimal colors +# and their respective index position the `pnmtolss16' program needs +# (e.g., #RRGGBB=0 #RRGGBB=1 ... [all values in the same line]). +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function palette_convertGplToHex { + + # Create list of colors to be processed by `pnmtolss16'. + echo "${PALETTE_GPL_COLORS}" | nl | gawk '{ printf "%s=%d ", $2, $1 - 1 }' \ + > ${PALETTE_HEX} + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToPpm.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToPpm.sh new file mode 100755 index 0000000..1c9073a --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToPpm.sh @@ -0,0 +1,53 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_convertGplToPpm.sh +# -- This function takes one palette produced by Gimp (e.g., +# syslinux.gpl) as input and outputs one PPM file based on it (e.g., +# syslinux.ppm). +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function palette_convertGplToPpm { + + local -a FILES + local COUNT=0 + + # Create temporal images (of 1x1 pixel each) to store each color + # retrieved from Gimp's palette. + for COLOR in ${PALETTE_GPL_COLORS};do + FILES[${COUNT}]=$(tcar_getTemporalFile ${COUNT}.ppm) + ppmmake ${COLOR} 1 1 > ${FILES[${COUNT}]} + COUNT=$((${COUNT} + 1)) + done + + # Concatenate each temporal image from left to right to create the + # PPM file. + pnmcat -lr ${FILES[*]} > ${PALETTE_PPM} + + # Remove temporal images used to build the PPM palette file. + rm ${FILES[*]} + + # Verify PPM palette existence. + tcar_checkFiles -ef "${PALETTE_PPM}" + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_getColors.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_getColors.sh new file mode 100755 index 0000000..d0b2b36 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_getColors.sh @@ -0,0 +1,64 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_getColors.sh +# -- This function takes one palette produced by Gimp (e.g., +# syslinux.gpl) as input and outputs a list of colors in #rrggbb +# format set in the fourth column of it. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function palette_getColors { + + local COLOR='' + local PALETTE_COLORS='' + local PALETTE=${1} + + if [[ -f ${PALETTE} ]];then + + # Retrieve the fourth column from GPL palette. The fourth + # column of a GPL palette contains the palette commentary + # field. The palette commentary field can be anything, but for + # the sake of our own convenience we use it to store the color + # value in hexadecimal format (e.g., rrggbb). Notice that you + # can put your comments from the fifth column on, using an + # space as field separator. + PALETTE_COLORS=$(sed -r '1,/^#/d' ${PALETTE} \ + | gawk '{ printf "%s\n", $4 }') + + else + + # Redefine default background color using The CentOS Project + # default color then. + PALETTE_COLORS='#204c8d' + + fi + + # Be sure all color information be output in the #rrggbb format. + for COLOR in ${PALETTE_COLORS};do + if [[ ! ${COLOR} =~ '^#' ]];then + COLOR="#${COLOR}" + fi + echo "${COLOR}" + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/Locales/es_ES/svg.sh.po b/Automation/Modules/Render/Modules/Files/Modules/Svg/Locales/es_ES/svg.sh.po new file mode 100644 index 0000000..1c3f324 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/Locales/es_ES/svg.sh.po @@ -0,0 +1,24 @@ +# Spanish translations for svg.sh package +# Traducciones al español para el paquete svg.sh. +# Copyright (C) 2013 The CentOS Artwork SIG +# This file is distributed under the same license as the svg.sh package. +# Automatically generated, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: svg.sh 0.6\n" +"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" +"POT-Creation-Date: 2013-10-07 15:12-0400\n" +"PO-Revision-Date: 2013-10-07 15:12-0400\n" +"Last-Translator: Localization SIG \n" +"Language-Team: Spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: Automation/Modules/Render/Modules/Svg/svg_checkModelExportId.sh:43 +#, sh-format +msgid "There is not export id ($EXPORTID) inside \"$TEMPLATE\"." +msgstr "" +"No hay identificador de exportación ($EXPORTID) dentro de \"$TEMPLATE\"." diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/Locales/svg.sh.pot b/Automation/Modules/Render/Modules/Files/Modules/Svg/Locales/svg.sh.pot new file mode 100644 index 0000000..d81f979 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/Locales/svg.sh.pot @@ -0,0 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR The CentOS Artwork SIG +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: svg.sh 0.6\n" +"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" +"POT-Creation-Date: 2013-10-07 15:12-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: /home/al/Projects/centos-artwork.git-localhost/Automation/Modules/Render/Modules/Svg/svg_checkModelExportId.sh:43 +#, sh-format +msgid "There is not export id ($EXPORTID) inside \"$TEMPLATE\"." +msgstr "" diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Base/base.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Base/base.sh new file mode 100755 index 0000000..7fa4ea8 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Base/base.sh @@ -0,0 +1,33 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Modules/Simple/base.sh -- This function +# standardizes base rendition of PNG files. Base rendition consists +# on producing one PNG image for each SVG file provided as source. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function base { + + svg_setBaseRendition + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended.sh new file mode 100755 index 0000000..db28279 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended.sh @@ -0,0 +1,91 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Modules/Extended/extended.sh -- This +# function standardize extended production of PNG files from SVG +# files. The extended production consists on producing PNG images in +# in different formats, heights, foreground colors and background +# colors. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function extended { + + # Retrieve formats you want to produce the image for. This + # variable contains one or more image format supported by + # ImageMagick. For example, `xpm', `jpg', 'tiff', etc. + local FORMATS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "formats") + if [[ -z ${FORMATS} ]];then + FORMATS="png" + fi + + # Retrieve heights you want to produce the image for. This + # variable contains one or more numerical values. For example, + # `16', `24', `32', etc. + local HEIGHTS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "heights") + if [[ -z ${HEIGHTS} ]];then + HEIGHTS="16 20 22 24 32 36 38 40 48 64 72 78 96 112 124 128 148 164 196 200 512" + fi + + # Retrieve foreground colors you want to produce the image for. + # This variable contains one or more color number in hexadecimal + # format. For example, `000000', `ffffff', etc. + local FGCOLORS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "fgcolors") + if [[ -z ${FGCOLORS} ]];then + FGCOLORS="000000" + fi + + # Retrieve background colors you want to produce the image for. + # This variable contains one or more color number in hexadecimal + # format with opacity information included. Opacity is specified + # between 0.0 and 1.0 where 0.0 is full transparency and 1.0 full + # opacity. For example, the following values are accepted: + # `000000-0', `ffffff-1', etc. + local BGCOLORS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "bgcolors") + if [[ -z ${BGCOLORS} ]];then + BGCOLORS="ffffff-0 ffffff-1" + fi + + for FGCOLOR in ${FGCOLORS};do + + # Verify value passed as foreground color. + tcar_checkFiles -m '^[a-fA-F0-9]{3,6}$' ${FGCOLOR} + + for BGCOLOR in ${BGCOLORS};do + + # Verify value passed as background color. + tcar_checkFiles -m '^[a-fA-F0-9]{6}-(0|1)$' ${BGCOLOR} + + for HEIGHT in ${HEIGHTS};do + + # Verify value passed as height. + tcar_checkFiles -m '^[[:digit:]]+$' ${HEIGHT} + + # Do base rendition actions. + extended_setBaseRendition + + done + done + done + + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh new file mode 100755 index 0000000..f292935 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh @@ -0,0 +1,53 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Modules/Extended/Scripts/extended_setBaseRendition.sh +# -- This function standardize base rendition tasks needed to +# perform the extended production of PNG files from SVG files. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function extended_setBaseRendition { + + # Redefine absolute path to final file. + local TARGET=$(dirname ${CONFIGURATION})/Images/${FGCOLOR}/${BGCOLOR}/${HEIGHT}/${SECTION} + if [[ ! ${TCAR_SCRIPT_LANG_LL} =~ '^en$' ]];then + TARGET=$(dirname ${CONFIGURATION})/${TCAR_SCRIPTS_LANG_LC}/Images/${FGCOLOR}/${BGCOLOR}/${HEIGHT}/${SECTION} + fi + + svg_setBaseRendition + + # Create path for different image formats creation using PNG image + # extension as reference. + local TARGET=$(echo ${TARGET} | sed -r "s/\.png$//") + + # Convert images from PNG to those formats specified in the + # configuration file. + for FORMAT in ${FORMATS};do + if [[ ${FORMAT} =~ 'png' ]];then + continue + fi + tcar_printMessage "${TARGET}.${FORMAT}" --as-creating-line + convert ${TARGET}.png ${TARGET}.${FORMAT} + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg.sh new file mode 100755 index 0000000..d7f007b --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg.sh @@ -0,0 +1,58 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/svg.sh -- This file initializes the svg +# module. The svg module takes SVG fies as input and produces +# different kind of images based on either simple or advanced +# rendition flow. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function svg { + + COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") + if [[ -z ${COMMAND} ]];then + if [[ ${#SOURCES[*]} -gt 1 ]];then + COMMAND="/usr/bin/convert +append" + else + COMMAND="/bin/cp" + fi + fi + + RENDER_FLOWS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-flow") + if [[ -z ${RENDER_FLOWS} ]];then + RENDER_FLOWS='base' + fi + + BRANDS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "brand") + COMMENT=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "comment") + + local EXPORTID=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "export-id") + if [[ -z ${EXPORTID} ]];then + EXPORTID="CENTOSARTWORK" + fi + + for RENDER_FLOW in ${RENDER_FLOWS} ;do + tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelAbsref.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelAbsref.sh new file mode 100755 index 0000000..0422884 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelAbsref.sh @@ -0,0 +1,143 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Scripts/svg_checkModelAbsref.sh -- This +# function retrieves absolute pahts from source files and checks +# their existence. +# +# In order for design templates to point different artistic motifs, +# design templates make use of external files which point to +# specific artistic motif background images. If such external files +# don't exist, try to create the background image required by +# cropping a higher background image (e.g., 2048x1536-final.png). +# If this isn't possible either, then create the background image +# using a plain color and crop from it then. We can't go on without +# the required background information. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function svg_checkModelAbsref { + + local FILE='' + local BG_DST_FILES='' + local BG_DST_FILE='' + local BG_DST_FILE_WIDTH='' + local BG_DST_FILE_HEIGHT='' + local BG_SRC_FILE='' + local BG_SRC_FILE_COLOR='' + local BG_SRC_FILE_WIDTH='' + local BG_SRC_FILE_HEIGHT='' + + # Define absolute path to the translated instance of design model. + FILE="${1}" + + # Verify existence of file we need to retrieve absolute paths from. + tcar_checkFiles -ef "${FILE}" + + # Retrieve absolute paths from file. + BG_DST_FILES=$(egrep "(sodipodi:absref|xlink:href)=\"${HOME}.+" ${FILE} \ + | sed -r "s,.+=\"(${HOME}.+\.png)\".*,\1," | sort | uniq) + + # Verify absolute paths retrieved from file. + for BG_DST_FILE in ${BG_DST_FILES};do + + # Verify parent directory of absolute files retrieved from + # file. This is required to prevent the construction of paths + # to locations that don't exist. For example, when including + # background images in SVG files, it is possible that the path + # information inside SVG files get outdated temporally. If in + # that exact moment, you try to render the SVG file it won't + # be possible to create the image used for cropping because + # the path build from the location inside SVG file doesn't + # exist. In this case, centos-art.sh script will end up with + # `file ... doesn't exist' errors. + tcar_checkFiles -d "$(dirname ${BG_DST_FILE})" + + if [[ ! -a ${BG_DST_FILE} ]];then + + # Define the source background file, the image file will + # crop when no specific background information be + # available for using. Generally, this is the most + # reusable background file inside the artistic motifs + # (e.g,. the `2048x1536-final.png' file). We can use + # this image file to create almost all artworks inside The + # CentOS Distribution visual manifestation when + # resolution-specific backgrounds don't exist. + BG_SRC_FILE=$(echo ${BG_DST_FILE} \ + | sed -r "s!(.+)/[[:digit:]]+x[[:digit:]]+(-final\.png)!\1/2048x1536\2!") + + # Verify existence of source background file. If the file + # doesn't exist create it using The CentOS Project default + # background color information, as specified in its + # corporate identity manual. + if [[ ! -f ${BG_SRC_FILE} ]];then + + # Define plain color that will be used as background. + BG_SRC_FILE_COLOR=$(svg_getColors) + + # Verify format of color value. + svg_checkColorFormats ${BG_SRC_FILE_COLOR} --format='rrggbb' + + # Define width for the source background file the + # required background information is cropped from. + BG_SRC_FILE_WIDTH=$(echo ${BG_SRC_FILE} \ + | sed -r 's!.+/([[:digit:]]+)x[[:digit:]]+-final\.png!\1!') + + # Define height for the source background file the + # required background information is cropped from. + BG_SRC_FILE_HEIGHT=$(echo ${BG_SRC_FILE} \ + | sed -r 's!.+/[[:digit:]]+x([[:digit:]]+)-final\.png!\1!') + + # Print action message. + tcar_printMessage "${BG_SRC_FILE} (${BG_SRC_FILE_COLOR})" --as-creating-line + + # Create the source background file. + ppmmake -quiet ${BG_SRC_FILE_COLOR} \ + ${BG_SRC_FILE_WIDTH} ${BG_SRC_FILE_HEIGHT} \ + | pnmtopng > ${BG_SRC_FILE} + + fi + + # Print action message. + tcar_printMessage "${BG_SRC_FILE}" --as-cropping-line + + # Define the width of the required background information. + BG_DST_FILE_WIDTH=$(echo ${BG_DST_FILE} \ + | sed -r 's!.+/([[:digit:]]+)x[[:digit:]]+-final\.png!\1!') + + # Define the height of the required background information. + BG_DST_FILE_HEIGHT=$(echo ${BG_DST_FILE} \ + | sed -r 's!.+/[[:digit:]]+x([[:digit:]]+)-final\.png!\1!') + + # Create required backgrounnd information. + convert -quiet \ + -crop ${BG_DST_FILE_WIDTH}x${BG_DST_FILE_HEIGHT}+0+0 \ + ${BG_SRC_FILE} ${BG_DST_FILE} + + # Verify required background information. + tcar_checkFiles -ef ${BG_DST_FILE} + + fi + + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelExportId.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelExportId.sh new file mode 100755 index 0000000..aa95efa --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelExportId.sh @@ -0,0 +1,46 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Scripts/svg_checkModelExportId.sh -- +# This function standardizes the export id used inside svg files and +# the way of verify them. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function svg_checkModelExportId { + + local INSTANCE="${1}" + local EXPORTID="${2}" + + # Verify instance. + tcar_checkFiles -ef ${INSTANCE} + + # Verify export id. + tcar_checkFiles -m '[[:alnum:]]+' ${EXPORTID} + + # Check export id inside design templates. + grep "id=\"${EXPORTID}\"" ${INSTANCE} > /dev/null + if [[ $? -gt 0 ]];then + tcar_printMessage "`eval_gettext "There is not export id (\\\$EXPORTID) inside \\\"\\\$TEMPLATE\\\"."`" --as-error-line + fi + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh new file mode 100755 index 0000000..2fbc7e2 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh @@ -0,0 +1,114 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Scripts/svg_setBaseRendition.sh -- This +# function standardizes the base rendition tasks needed to produce +# PNG files from SVG files. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function svg_setBaseRendition { + + local COUNTER=0 + + local -a SOURCE_INSTANCES + local -a TARGET_INSTANCES + local -a TARGET_COMMANDS + local -a INKSCAPE_OPTIONS + + while [[ ${COUNTER} -lt ${#SOURCES[*]} ]];do + + # Verify existence and extension of design models. + tcar_checkFiles -ef -m '\.(svgz|svg)$' ${SOURCES[${COUNTER}]} + + # Define file name for design model instances. We need to use + # a random string in from of it to prevent duplication. + # Remember that different files can have the same name in + # different locations. Use the correct file information. + SOURCE_INSTANCES[${COUNTER}]=${TCAR_SCRIPT_TEMPDIR}/${RANDOM}-$(basename ${SOURCES[${COUNTER}]}) + + # Define file name for image instances. We need to use a + # random string in from of it to prevent duplication. + # Remember that different files can have the same name in + # different locations. Use the correct file information. + TARGET_INSTANCES[${COUNTER}]=${TCAR_SCRIPT_TEMPDIR}/${RANDOM}-$(basename ${SOURCES[${COUNTER}]} \ + | sed -r 's/\.(svgz|svg)$/.png/') + + # Create source instance considering whether or not it has + # translation files related.Apply translation files to source instance, if any. + render_setLocalizedXml "${SOURCES[${COUNTER}]}" "${SOURCE_INSTANCES[${COUNTER}]}" + + # Make your best to be sure the source instance you are + # processing is a valid Scalable Vector Graphic (SVG) file. + tcar_checkFiles -i 'text/xml' ${SOURCE_INSTANCES[${COUNTER}]} + + # Expand any translation file that might exist. + tcar_setTranslationMarkers ${SOURCE_INSTANCES[${COUNTER}]} + + svg_checkModelAbsref "${SOURCE_INSTANCES[${COUNTER}]}" + + svg_setBaseRenditionOptions + + svg_setBaseRenditionCommand + + COUNTER=$(( ${COUNTER} + 1 )) + + done + + # Verify existence of output directory. + if [[ ! -d $(dirname ${TARGET}) ]];then + mkdir -p $(dirname ${TARGET}) + fi + + tcar_printMessage "${TARGET}" --as-creating-line + + # Apply command to PNG images produced from design models to + # construct the final PNG image. + ${COMMAND} ${TARGET_INSTANCES[*]} ${TARGET} + + # Apply branding images to final PNG image. + if [[ -n ${BRANDS} ]];then + svg_setBrandInformation + fi + + # Apply comment to final PNG image. + if [[ -n ${COMMENT} ]];then + /usr/bin/mogrify -comment "${COMMENT}" ${TARGET} + fi + + # Remove instances to save disk space. There is no need to have + # unused files inside the temporal directory. They would be + # consuming space unnecessarily. Moreover, there is a remote + # chance of name collapsing (because the huge number of files that + # would be in place and the week random string we are putting in + # front of files) which may produce unexpected results. + rm ${TARGET_INSTANCES[*]} ${SOURCE_INSTANCES[*]} + + # Unset array variables and their counter to prevent undesired + # concatenations. + unset SOURCE_INSTANCES + unset TARGET_INSTANCES + unset TARGET_COMMANDS + unset INKSCAPE_OPTIONS + unset COUNTER + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionCommand.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionCommand.sh new file mode 100755 index 0000000..bc7f576 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionCommand.sh @@ -0,0 +1,33 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Scripts/svg_setBaseRenditionCommand.sh +# -- This function standardizes the way SVG files are produced +# inside the centos-art.sh script. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function svg_setBaseRenditionCommand { + + inkscape ${SOURCE_INSTANCES[${COUNTER}]} ${INKSCAPE_OPTIONS[${COUNTER}]} > /dev/null + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionOptions.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionOptions.sh new file mode 100755 index 0000000..cd74041 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionOptions.sh @@ -0,0 +1,53 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Scripts/svg_setBaseRenditionOptions.sh +# -- This function standardizes the way base rendition options are +# set. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function svg_setBaseRenditionOptions { + + if [[ ! -z ${FGCOLOR} ]] && [[ ${FGCOLOR} != '000000' ]];then + sed -i -r "s/((fill|stroke):#)000000/\1${FGCOLOR}/g" ${SOURCE_INSTANCES[${COUNTER}]} + fi + + INKSCAPE_OPTIONS[${COUNTER}]="--export-png=${TARGET_INSTANCES[${COUNTER}]}" + + if [[ -z ${EXPORTID} ]];then + INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-area-drawing " + else + svg_checkModelExportId "${SOURCE_INSTANCES[${COUNTER}]}" "${EXPORTID}" + INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-id=${EXPORTID} " + fi + + if [[ ! -z ${BGCOLOR} ]];then + INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-background=$(echo ${BGCOLOR} | cut -d'-' -f1) " + INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-background-opacity=$(echo ${BGCOLOR} | cut -d'-' -f2) " + fi + + if [[ ! -z ${HEIGHT} ]];then + INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-height=${HEIGHT} " + fi + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh new file mode 100755 index 0000000..f635678 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh @@ -0,0 +1,42 @@ +#!/bin/bash +###################################################################### +# +# Modules/Render/Modules/Svg/Scripts/svg_setBrandInformation.sh -- +# This function takes brand information from configuration files, +# processes it, and apply it on final PNG image file. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function svg_setBrandInformation { + + for BRAND in ${BRANDS};do + + local FILENAME=$(echo ${BRAND} | cut -d: -f1) + local GEOMETRY=$(echo ${BRAND} | cut -d: -f2) + + tcar_checkFiles -ef ${FILENAME} + + /usr/bin/composite -geometry ${GEOMETRY} ${FILENAME} ${TARGET} ${TARGET} + + done + +} diff --git a/Automation/Modules/Render/Modules/Files/Modules/Symlink/symlink.sh b/Automation/Modules/Render/Modules/Files/Modules/Symlink/symlink.sh new file mode 100755 index 0000000..1accc29 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/Modules/Symlink/symlink.sh @@ -0,0 +1,63 @@ +#!/bin/bash +###################################################################### +# +# symlink.sh -- This function provides an interface for ln command. +# It mainly exists to creates symbolic links based on information +# set in configuration files that have symlink as value to +# render-type option. In these sections, the render-from and +# link-target options are used to specify the link locations. The +# link-options option might be used to pass additional options to ln +# command. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function symlink { + + # Define absolute path to command used to create symbolic links. + local LN=/bin/ln + + # Retrieve command options (values are not required here). Just + # grant you are always creating symbolic links. + local LN_OPTIONS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "link-options") + LN_OPTIONS="-si ${LN_OPTIONS}" + + # Retrieve link source. This is the file you want to link. This + # file is generally inside the repository. + local LN_SOURCE=${RENDER_FROM} + tcar_checkFiles -ef ${LN_SOURCE} + + # Retrieve link target. This is the link you want to create. This + # link may be inside or outside the repository. The value passed + # to this value must be a directory because it is concatenated + # with the section name to build the final path where link will be + # created. + local LN_TARGET=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "link-target") + tcar_checkFiles -ed ${LN_TARGET} + LN_TARGET=${LN_TARGET}/${SECTION} + + # Print action message. + tcar_printMessage "${LN_TARGET}" --as-creating-line + + # Create link interactively. + ${LN} ${LN_OPTIONS} ${LN_SOURCE} ${LN_TARGET} + +} diff --git a/Automation/Modules/Render/Modules/Files/files.sh b/Automation/Modules/Render/Modules/Files/files.sh new file mode 100755 index 0000000..d9ad5f2 --- /dev/null +++ b/Automation/Modules/Render/Modules/Files/files.sh @@ -0,0 +1,155 @@ +#!/bin/bash +###################################################################### +# +# files.sh -- This module initializes processing of configuration +# files when the argument passed in the command-line points to a +# regular file or symbolic link. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function files { + + local CONFIGURATION="${1}" + + local -a SECTIONS + local SECTION='' + + # Define motif-specific environment variables, based on + # configuration file path. These variables might save + # configuration file writers from typing motif-specific + # information when they produce motif-specific content. These + # variables will be empty if the configuration file isn't inside + # a motif-specific directory structure. + local MOTIF=$(tcar_getPathComponent ${CONFIGURATION} --motif) + local MOTIF_NAME=$(tcar_getPathComponent ${CONFIGURATION} --motif-name) + local MOTIF_VERSION=$(tcar_getPathComponent ${CONFIGURATION} --motif-version) + + # Use arrays to store section names. This make possible to make + # use of post-rendition and last-rendition concepts. Otherwise it + # would be difficult to predict information about sections inside + # deeper environments. + for SECTION in $(tcar_getConfigSectionNames "${CONFIGURATION}" \ + | egrep ${TCAR_FLAG_FILTER});do + SECTIONS[++${#SECTIONS[*]}]="${SECTION}" + done + + # Verify the configuration file has one section entry at least. + if [[ ${#SECTIONS[*]} -eq 0 ]];then + tcar_printMessage "`eval_gettext "No section definition was found in \\\$CONFIGURATION."`" --as-error-line + fi + + local COUNTER=0 + + while [[ ${COUNTER} -lt ${#SECTIONS[*]} ]];do + + # Initialize array variables locally. + local -a TRANSLATIONS + local -a SOURCES + + SECTION=${SECTIONS[${COUNTER}]} + + if [[ ${SECTION} =~ "^/" ]];then + TARGET=${SECTION} + else + if [[ ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then + TARGET=$(dirname ${CONFIGURATION})/${SECTION} + else + TARGET=$(dirname ${CONFIGURATION})/${TCAR_SCRIPT_LANG_LC}/${SECTION} + fi + fi + + RENDER_TYPE=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-type") + if [[ -z ${RENDER_TYPE} ]];then + tcar_printMessage "${CONFIGURATION} `gettext "hasn't render-type set in."`" --as-error-line + fi + + RENDER_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-from") + if [[ -z ${RENDER_TYPE} ]];then + tcar_printMessage "${CONFIGURATION} `gettext "hasn't render-from set in."`" --as-error-line + fi + + for SOURCE in ${RENDER_FROM};do + if [[ ${SOURCE} =~ "^/" ]];then + SOURCES[((++${#SOURCES[*]}))]=${SOURCE} + else + SOURCES[((++${#SOURCES[*]}))]=$(dirname ${CONFIGURATION})/${SOURCE} + fi + done + + if [[ -z ${RENDER_TYPE} ]];then + RENDER_TYPE=$(echo ${SOURCES[0]} | sed -r 's/.+\.([[:alpha:]]+)$/\1/') + fi + + LOCALE_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "locale-from") + + # When the current locale information is not English, don't + # process section blocks unless they have any related + # translation file. There is no need to have untranslated + # content inside language-specific directories. + if [[ ! ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then + + if [[ -z ${LOCALE_FROM} ]];then + + # Increment array counter. + COUNTER=$(( ${COUNTER} + 1 )) + + # Reset array variable to avoid undesired + # concatenations between sections blocks. + unset TRANSLATIONS + unset SOURCES + + # Move to next section block. + continue + + fi + + for TRANSLATION in ${LOCALE_FROM};do + if [[ ${TRANSLATION} =~ "^/" ]];then + TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=${TRANSLATION} + else + TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=$(dirname ${CONFIGURATION})/${TRANSLATION} + fi + done + + tcar_checkFiles -ef ${TRANSLATIONS[*]} + + fi + + # Initialize render's modules. + tcar_setModuleEnvironment -m "${RENDER_TYPE}" -t "child" + + # Increment section's counter. + COUNTER=$(( ${COUNTER} + 1 )) + + # Reset array variable to avoid undesired concatenations + # between sections blocks. + unset TRANSLATIONS + unset SOURCES + + done + + # Reset array variables and their counters to avoid undesired + # concatenations between configuration files. + unset COUNTER + unset SECTIONS + +} diff --git a/Automation/Modules/Render/Modules/Images/images.sh b/Automation/Modules/Render/Modules/Images/images.sh deleted file mode 100755 index f41839a..0000000 --- a/Automation/Modules/Render/Modules/Images/images.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Direct/images.sh -- This module -# standardizes production of image files from other image files. -# There is no intermediate process here. The image or images -# provided as value to render-from variable are used to create the -# image specified in the section line using the command specified in -# the command variable, without any intermediate process. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function images { - - tcar_checkFiles -i "image" ${SOURCE[*]} - - COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") - if [[ -z ${COMMAND} ]];then - COMMAND="/usr/bin/images -append" - fi - - if [[ ! -d $(dirname ${TARGET}) ]];then - mkdir -p $(dirname ${TARGET}) - fi - - tcar_printMessage "${TARGET}" --as-creating-line - - eval ${COMMAND} ${SOURCES[*]} ${TARGET} - -} diff --git a/Automation/Modules/Render/Modules/Palette/palette.sh b/Automation/Modules/Render/Modules/Palette/palette.sh deleted file mode 100755 index 67fbb2d..0000000 --- a/Automation/Modules/Render/Modules/Palette/palette.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Palette/palette.sh -- This function -# standardizes the way palette of colors are applied to image files -# in order to produce images with specific number of colors. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function palette { - - local FILENAME=$(tcar_getTemporalFile "$(echo ${SOURCES[0]} \ - | sed -r 's/\.[[:alpha:]]+$//')") - - local LOGS=${TARGET}.log - - # Define absolute path to GPL palette. This file is the reference - # taken to set the max number of colors the final image will be - # produced for. - local PALETTE_GPL=$(dirname ${CONFIGURATION})/$(tcar_getConfigValue ${CONFIGURATION} ${SECTION} 'palette-gpl') - - local PALETTE_GPL_COLORS=$(palette_getColors "${PALETTE_GPL}") - - # Define absolute path to PPM palette. The PPM palette is built - # from source palette (PALETTE_GPL) and provides the color - # information understood by `ppmremap', the program used to - # produce images in a specific amount of colors. - local PALETTE_PPM=$(tcar_getTemporalFile 'palette.ppm') - - # Verify format of colors returned in the list. - palette_checkColorFormats "${PALETTE_GPL_COLORS}" - - # Create image in Netpbm superformat (PNM). The PNM image file is - # created from the PNG image rendered previously as centos-art - # base-rendition output. The PNM image is an intermediate format - # used to manipulate images through Netpbm tools. - pngtopnm -verbose \ - < ${SOURCE[0]} 2>${LOGS} > ${FILENAME}.pnm - - # Create PPM palette using GPL palette. - palette_convertGplToPpm - - # Reduce colors as specified in PPM palette. Here we use the PPM - # palette to enforce the color position in the image index and the - # Floyd-Steinberg dithering in order to improve color reduction. - pnmremap -verbose -mapfile=${PALETTE_PPM} -floyd \ - < ${FILENAME}.pnm 2>>${LOGS} > ${FILENAME}.ppm - - # Print action message. - tcar_printMessage "${TARGET}" --as-creating-line - - if [[ ${TARGET} =~ '\.lss$' ]];then - - # Define the HEX palette. The HEX palette is built from source - # palette (PALETTE_GPL) and provides the color information in - # the format understood by `ppmtolss16', the program used to - # produce images in LSS16 format. The HEX palette stores just - # one line with the color information as described in isolinux - # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in - # the same line]) - local PALETTE_HEX=$(tcar_getTemporalFile "palette.hex") - - # Create HEX palette using GPL palette. - palette_convertGplToHex - - # Create LSS16 image. - ppmtolss16 $(cat ${PALETTE_HEX}) \ - < ${FILENAME}.ppm 2>>${LOGS} > ${TARGET} - - # Create PPM image indexed to 16 colors. Also the colormap - # used in the LSS16 image is saved on ${FILE}.log; this is - # useful to verify the correct order of colors in the image - # index. - lss16toppm -map \ - < ${TARGET} 2>>${LOGS} > ${TARGET}.ppm - - else - - # Create final file. - /usr/bin/convert ${FILENAME}.ppm ${TARGET} - - fi - -} diff --git a/Automation/Modules/Render/Modules/Palette/palette_checkColorFormat.sh b/Automation/Modules/Render/Modules/Palette/palette_checkColorFormat.sh deleted file mode 100755 index 30973eb..0000000 --- a/Automation/Modules/Render/Modules/Palette/palette_checkColorFormat.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_checkColorFormats.sh -# -- This function verifies formats of colors (i.e., the way color -# information is specified). -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function palette_checkColorFormats { - - local COLOR='' - local PALETTE_COLORS=${1} - - # Loop through colors and perform format verification as specified - # by pattern. - for COLOR in ${PALETTE_COLORS};do - tcar_checkFiles -m '^#[0-9a-f]{6}$' "${COLOR}" - done - -} diff --git a/Automation/Modules/Render/Modules/Palette/palette_convertGplToHex.sh b/Automation/Modules/Render/Modules/Palette/palette_convertGplToHex.sh deleted file mode 100755 index e9fce4c..0000000 --- a/Automation/Modules/Render/Modules/Palette/palette_convertGplToHex.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_convertGplToHex.sh -# -- This function takes one palette produced by GIMP (e.g., -# syslinux.gpl) as input and outputs the list of hexadecimal colors -# and their respective index position the `pnmtolss16' program needs -# (e.g., #RRGGBB=0 #RRGGBB=1 ... [all values in the same line]). -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function palette_convertGplToHex { - - # Create list of colors to be processed by `pnmtolss16'. - echo "${PALETTE_GPL_COLORS}" | nl | gawk '{ printf "%s=%d ", $2, $1 - 1 }' \ - > ${PALETTE_HEX} - -} diff --git a/Automation/Modules/Render/Modules/Palette/palette_convertGplToPpm.sh b/Automation/Modules/Render/Modules/Palette/palette_convertGplToPpm.sh deleted file mode 100755 index 1c9073a..0000000 --- a/Automation/Modules/Render/Modules/Palette/palette_convertGplToPpm.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_convertGplToPpm.sh -# -- This function takes one palette produced by Gimp (e.g., -# syslinux.gpl) as input and outputs one PPM file based on it (e.g., -# syslinux.ppm). -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function palette_convertGplToPpm { - - local -a FILES - local COUNT=0 - - # Create temporal images (of 1x1 pixel each) to store each color - # retrieved from Gimp's palette. - for COLOR in ${PALETTE_GPL_COLORS};do - FILES[${COUNT}]=$(tcar_getTemporalFile ${COUNT}.ppm) - ppmmake ${COLOR} 1 1 > ${FILES[${COUNT}]} - COUNT=$((${COUNT} + 1)) - done - - # Concatenate each temporal image from left to right to create the - # PPM file. - pnmcat -lr ${FILES[*]} > ${PALETTE_PPM} - - # Remove temporal images used to build the PPM palette file. - rm ${FILES[*]} - - # Verify PPM palette existence. - tcar_checkFiles -ef "${PALETTE_PPM}" - -} diff --git a/Automation/Modules/Render/Modules/Palette/palette_getColors.sh b/Automation/Modules/Render/Modules/Palette/palette_getColors.sh deleted file mode 100755 index d0b2b36..0000000 --- a/Automation/Modules/Render/Modules/Palette/palette_getColors.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Alter/Modules/Color/Scripts/palette_getColors.sh -# -- This function takes one palette produced by Gimp (e.g., -# syslinux.gpl) as input and outputs a list of colors in #rrggbb -# format set in the fourth column of it. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function palette_getColors { - - local COLOR='' - local PALETTE_COLORS='' - local PALETTE=${1} - - if [[ -f ${PALETTE} ]];then - - # Retrieve the fourth column from GPL palette. The fourth - # column of a GPL palette contains the palette commentary - # field. The palette commentary field can be anything, but for - # the sake of our own convenience we use it to store the color - # value in hexadecimal format (e.g., rrggbb). Notice that you - # can put your comments from the fifth column on, using an - # space as field separator. - PALETTE_COLORS=$(sed -r '1,/^#/d' ${PALETTE} \ - | gawk '{ printf "%s\n", $4 }') - - else - - # Redefine default background color using The CentOS Project - # default color then. - PALETTE_COLORS='#204c8d' - - fi - - # Be sure all color information be output in the #rrggbb format. - for COLOR in ${PALETTE_COLORS};do - if [[ ! ${COLOR} =~ '^#' ]];then - COLOR="#${COLOR}" - fi - echo "${COLOR}" - done - -} diff --git a/Automation/Modules/Render/Modules/Svg/Locales/es_ES/svg.sh.po b/Automation/Modules/Render/Modules/Svg/Locales/es_ES/svg.sh.po deleted file mode 100644 index 1c3f324..0000000 --- a/Automation/Modules/Render/Modules/Svg/Locales/es_ES/svg.sh.po +++ /dev/null @@ -1,24 +0,0 @@ -# Spanish translations for svg.sh package -# Traducciones al español para el paquete svg.sh. -# Copyright (C) 2013 The CentOS Artwork SIG -# This file is distributed under the same license as the svg.sh package. -# Automatically generated, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: svg.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 15:12-0400\n" -"PO-Revision-Date: 2013-10-07 15:12-0400\n" -"Last-Translator: Localization SIG \n" -"Language-Team: Spanish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: Automation/Modules/Render/Modules/Svg/svg_checkModelExportId.sh:43 -#, sh-format -msgid "There is not export id ($EXPORTID) inside \"$TEMPLATE\"." -msgstr "" -"No hay identificador de exportación ($EXPORTID) dentro de \"$TEMPLATE\"." diff --git a/Automation/Modules/Render/Modules/Svg/Locales/svg.sh.pot b/Automation/Modules/Render/Modules/Svg/Locales/svg.sh.pot deleted file mode 100644 index d81f979..0000000 --- a/Automation/Modules/Render/Modules/Svg/Locales/svg.sh.pot +++ /dev/null @@ -1,22 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR The CentOS Artwork SIG -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: svg.sh 0.6\n" -"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" -"POT-Creation-Date: 2013-10-07 15:12-0400\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: /home/al/Projects/centos-artwork.git-localhost/Automation/Modules/Render/Modules/Svg/svg_checkModelExportId.sh:43 -#, sh-format -msgid "There is not export id ($EXPORTID) inside \"$TEMPLATE\"." -msgstr "" diff --git a/Automation/Modules/Render/Modules/Svg/Modules/Base/base.sh b/Automation/Modules/Render/Modules/Svg/Modules/Base/base.sh deleted file mode 100755 index 7fa4ea8..0000000 --- a/Automation/Modules/Render/Modules/Svg/Modules/Base/base.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Modules/Simple/base.sh -- This function -# standardizes base rendition of PNG files. Base rendition consists -# on producing one PNG image for each SVG file provided as source. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function base { - - svg_setBaseRendition - -} diff --git a/Automation/Modules/Render/Modules/Svg/Modules/Extended/extended.sh b/Automation/Modules/Render/Modules/Svg/Modules/Extended/extended.sh deleted file mode 100755 index db28279..0000000 --- a/Automation/Modules/Render/Modules/Svg/Modules/Extended/extended.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Modules/Extended/extended.sh -- This -# function standardize extended production of PNG files from SVG -# files. The extended production consists on producing PNG images in -# in different formats, heights, foreground colors and background -# colors. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function extended { - - # Retrieve formats you want to produce the image for. This - # variable contains one or more image format supported by - # ImageMagick. For example, `xpm', `jpg', 'tiff', etc. - local FORMATS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "formats") - if [[ -z ${FORMATS} ]];then - FORMATS="png" - fi - - # Retrieve heights you want to produce the image for. This - # variable contains one or more numerical values. For example, - # `16', `24', `32', etc. - local HEIGHTS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "heights") - if [[ -z ${HEIGHTS} ]];then - HEIGHTS="16 20 22 24 32 36 38 40 48 64 72 78 96 112 124 128 148 164 196 200 512" - fi - - # Retrieve foreground colors you want to produce the image for. - # This variable contains one or more color number in hexadecimal - # format. For example, `000000', `ffffff', etc. - local FGCOLORS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "fgcolors") - if [[ -z ${FGCOLORS} ]];then - FGCOLORS="000000" - fi - - # Retrieve background colors you want to produce the image for. - # This variable contains one or more color number in hexadecimal - # format with opacity information included. Opacity is specified - # between 0.0 and 1.0 where 0.0 is full transparency and 1.0 full - # opacity. For example, the following values are accepted: - # `000000-0', `ffffff-1', etc. - local BGCOLORS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "bgcolors") - if [[ -z ${BGCOLORS} ]];then - BGCOLORS="ffffff-0 ffffff-1" - fi - - for FGCOLOR in ${FGCOLORS};do - - # Verify value passed as foreground color. - tcar_checkFiles -m '^[a-fA-F0-9]{3,6}$' ${FGCOLOR} - - for BGCOLOR in ${BGCOLORS};do - - # Verify value passed as background color. - tcar_checkFiles -m '^[a-fA-F0-9]{6}-(0|1)$' ${BGCOLOR} - - for HEIGHT in ${HEIGHTS};do - - # Verify value passed as height. - tcar_checkFiles -m '^[[:digit:]]+$' ${HEIGHT} - - # Do base rendition actions. - extended_setBaseRendition - - done - done - done - - -} diff --git a/Automation/Modules/Render/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh b/Automation/Modules/Render/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh deleted file mode 100755 index f292935..0000000 --- a/Automation/Modules/Render/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Modules/Extended/Scripts/extended_setBaseRendition.sh -# -- This function standardize base rendition tasks needed to -# perform the extended production of PNG files from SVG files. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function extended_setBaseRendition { - - # Redefine absolute path to final file. - local TARGET=$(dirname ${CONFIGURATION})/Images/${FGCOLOR}/${BGCOLOR}/${HEIGHT}/${SECTION} - if [[ ! ${TCAR_SCRIPT_LANG_LL} =~ '^en$' ]];then - TARGET=$(dirname ${CONFIGURATION})/${TCAR_SCRIPTS_LANG_LC}/Images/${FGCOLOR}/${BGCOLOR}/${HEIGHT}/${SECTION} - fi - - svg_setBaseRendition - - # Create path for different image formats creation using PNG image - # extension as reference. - local TARGET=$(echo ${TARGET} | sed -r "s/\.png$//") - - # Convert images from PNG to those formats specified in the - # configuration file. - for FORMAT in ${FORMATS};do - if [[ ${FORMAT} =~ 'png' ]];then - continue - fi - tcar_printMessage "${TARGET}.${FORMAT}" --as-creating-line - convert ${TARGET}.png ${TARGET}.${FORMAT} - done - -} diff --git a/Automation/Modules/Render/Modules/Svg/svg.sh b/Automation/Modules/Render/Modules/Svg/svg.sh deleted file mode 100755 index d7f007b..0000000 --- a/Automation/Modules/Render/Modules/Svg/svg.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/svg.sh -- This file initializes the svg -# module. The svg module takes SVG fies as input and produces -# different kind of images based on either simple or advanced -# rendition flow. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function svg { - - COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") - if [[ -z ${COMMAND} ]];then - if [[ ${#SOURCES[*]} -gt 1 ]];then - COMMAND="/usr/bin/convert +append" - else - COMMAND="/bin/cp" - fi - fi - - RENDER_FLOWS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-flow") - if [[ -z ${RENDER_FLOWS} ]];then - RENDER_FLOWS='base' - fi - - BRANDS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "brand") - COMMENT=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "comment") - - local EXPORTID=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "export-id") - if [[ -z ${EXPORTID} ]];then - EXPORTID="CENTOSARTWORK" - fi - - for RENDER_FLOW in ${RENDER_FLOWS} ;do - tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" - done - -} diff --git a/Automation/Modules/Render/Modules/Svg/svg_checkModelAbsref.sh b/Automation/Modules/Render/Modules/Svg/svg_checkModelAbsref.sh deleted file mode 100755 index 0422884..0000000 --- a/Automation/Modules/Render/Modules/Svg/svg_checkModelAbsref.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Scripts/svg_checkModelAbsref.sh -- This -# function retrieves absolute pahts from source files and checks -# their existence. -# -# In order for design templates to point different artistic motifs, -# design templates make use of external files which point to -# specific artistic motif background images. If such external files -# don't exist, try to create the background image required by -# cropping a higher background image (e.g., 2048x1536-final.png). -# If this isn't possible either, then create the background image -# using a plain color and crop from it then. We can't go on without -# the required background information. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function svg_checkModelAbsref { - - local FILE='' - local BG_DST_FILES='' - local BG_DST_FILE='' - local BG_DST_FILE_WIDTH='' - local BG_DST_FILE_HEIGHT='' - local BG_SRC_FILE='' - local BG_SRC_FILE_COLOR='' - local BG_SRC_FILE_WIDTH='' - local BG_SRC_FILE_HEIGHT='' - - # Define absolute path to the translated instance of design model. - FILE="${1}" - - # Verify existence of file we need to retrieve absolute paths from. - tcar_checkFiles -ef "${FILE}" - - # Retrieve absolute paths from file. - BG_DST_FILES=$(egrep "(sodipodi:absref|xlink:href)=\"${HOME}.+" ${FILE} \ - | sed -r "s,.+=\"(${HOME}.+\.png)\".*,\1," | sort | uniq) - - # Verify absolute paths retrieved from file. - for BG_DST_FILE in ${BG_DST_FILES};do - - # Verify parent directory of absolute files retrieved from - # file. This is required to prevent the construction of paths - # to locations that don't exist. For example, when including - # background images in SVG files, it is possible that the path - # information inside SVG files get outdated temporally. If in - # that exact moment, you try to render the SVG file it won't - # be possible to create the image used for cropping because - # the path build from the location inside SVG file doesn't - # exist. In this case, centos-art.sh script will end up with - # `file ... doesn't exist' errors. - tcar_checkFiles -d "$(dirname ${BG_DST_FILE})" - - if [[ ! -a ${BG_DST_FILE} ]];then - - # Define the source background file, the image file will - # crop when no specific background information be - # available for using. Generally, this is the most - # reusable background file inside the artistic motifs - # (e.g,. the `2048x1536-final.png' file). We can use - # this image file to create almost all artworks inside The - # CentOS Distribution visual manifestation when - # resolution-specific backgrounds don't exist. - BG_SRC_FILE=$(echo ${BG_DST_FILE} \ - | sed -r "s!(.+)/[[:digit:]]+x[[:digit:]]+(-final\.png)!\1/2048x1536\2!") - - # Verify existence of source background file. If the file - # doesn't exist create it using The CentOS Project default - # background color information, as specified in its - # corporate identity manual. - if [[ ! -f ${BG_SRC_FILE} ]];then - - # Define plain color that will be used as background. - BG_SRC_FILE_COLOR=$(svg_getColors) - - # Verify format of color value. - svg_checkColorFormats ${BG_SRC_FILE_COLOR} --format='rrggbb' - - # Define width for the source background file the - # required background information is cropped from. - BG_SRC_FILE_WIDTH=$(echo ${BG_SRC_FILE} \ - | sed -r 's!.+/([[:digit:]]+)x[[:digit:]]+-final\.png!\1!') - - # Define height for the source background file the - # required background information is cropped from. - BG_SRC_FILE_HEIGHT=$(echo ${BG_SRC_FILE} \ - | sed -r 's!.+/[[:digit:]]+x([[:digit:]]+)-final\.png!\1!') - - # Print action message. - tcar_printMessage "${BG_SRC_FILE} (${BG_SRC_FILE_COLOR})" --as-creating-line - - # Create the source background file. - ppmmake -quiet ${BG_SRC_FILE_COLOR} \ - ${BG_SRC_FILE_WIDTH} ${BG_SRC_FILE_HEIGHT} \ - | pnmtopng > ${BG_SRC_FILE} - - fi - - # Print action message. - tcar_printMessage "${BG_SRC_FILE}" --as-cropping-line - - # Define the width of the required background information. - BG_DST_FILE_WIDTH=$(echo ${BG_DST_FILE} \ - | sed -r 's!.+/([[:digit:]]+)x[[:digit:]]+-final\.png!\1!') - - # Define the height of the required background information. - BG_DST_FILE_HEIGHT=$(echo ${BG_DST_FILE} \ - | sed -r 's!.+/[[:digit:]]+x([[:digit:]]+)-final\.png!\1!') - - # Create required backgrounnd information. - convert -quiet \ - -crop ${BG_DST_FILE_WIDTH}x${BG_DST_FILE_HEIGHT}+0+0 \ - ${BG_SRC_FILE} ${BG_DST_FILE} - - # Verify required background information. - tcar_checkFiles -ef ${BG_DST_FILE} - - fi - - done - -} diff --git a/Automation/Modules/Render/Modules/Svg/svg_checkModelExportId.sh b/Automation/Modules/Render/Modules/Svg/svg_checkModelExportId.sh deleted file mode 100755 index aa95efa..0000000 --- a/Automation/Modules/Render/Modules/Svg/svg_checkModelExportId.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Scripts/svg_checkModelExportId.sh -- -# This function standardizes the export id used inside svg files and -# the way of verify them. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function svg_checkModelExportId { - - local INSTANCE="${1}" - local EXPORTID="${2}" - - # Verify instance. - tcar_checkFiles -ef ${INSTANCE} - - # Verify export id. - tcar_checkFiles -m '[[:alnum:]]+' ${EXPORTID} - - # Check export id inside design templates. - grep "id=\"${EXPORTID}\"" ${INSTANCE} > /dev/null - if [[ $? -gt 0 ]];then - tcar_printMessage "`eval_gettext "There is not export id (\\\$EXPORTID) inside \\\"\\\$TEMPLATE\\\"."`" --as-error-line - fi - -} diff --git a/Automation/Modules/Render/Modules/Svg/svg_setBaseRendition.sh b/Automation/Modules/Render/Modules/Svg/svg_setBaseRendition.sh deleted file mode 100755 index 2fbc7e2..0000000 --- a/Automation/Modules/Render/Modules/Svg/svg_setBaseRendition.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Scripts/svg_setBaseRendition.sh -- This -# function standardizes the base rendition tasks needed to produce -# PNG files from SVG files. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function svg_setBaseRendition { - - local COUNTER=0 - - local -a SOURCE_INSTANCES - local -a TARGET_INSTANCES - local -a TARGET_COMMANDS - local -a INKSCAPE_OPTIONS - - while [[ ${COUNTER} -lt ${#SOURCES[*]} ]];do - - # Verify existence and extension of design models. - tcar_checkFiles -ef -m '\.(svgz|svg)$' ${SOURCES[${COUNTER}]} - - # Define file name for design model instances. We need to use - # a random string in from of it to prevent duplication. - # Remember that different files can have the same name in - # different locations. Use the correct file information. - SOURCE_INSTANCES[${COUNTER}]=${TCAR_SCRIPT_TEMPDIR}/${RANDOM}-$(basename ${SOURCES[${COUNTER}]}) - - # Define file name for image instances. We need to use a - # random string in from of it to prevent duplication. - # Remember that different files can have the same name in - # different locations. Use the correct file information. - TARGET_INSTANCES[${COUNTER}]=${TCAR_SCRIPT_TEMPDIR}/${RANDOM}-$(basename ${SOURCES[${COUNTER}]} \ - | sed -r 's/\.(svgz|svg)$/.png/') - - # Create source instance considering whether or not it has - # translation files related.Apply translation files to source instance, if any. - render_setLocalizedXml "${SOURCES[${COUNTER}]}" "${SOURCE_INSTANCES[${COUNTER}]}" - - # Make your best to be sure the source instance you are - # processing is a valid Scalable Vector Graphic (SVG) file. - tcar_checkFiles -i 'text/xml' ${SOURCE_INSTANCES[${COUNTER}]} - - # Expand any translation file that might exist. - tcar_setTranslationMarkers ${SOURCE_INSTANCES[${COUNTER}]} - - svg_checkModelAbsref "${SOURCE_INSTANCES[${COUNTER}]}" - - svg_setBaseRenditionOptions - - svg_setBaseRenditionCommand - - COUNTER=$(( ${COUNTER} + 1 )) - - done - - # Verify existence of output directory. - if [[ ! -d $(dirname ${TARGET}) ]];then - mkdir -p $(dirname ${TARGET}) - fi - - tcar_printMessage "${TARGET}" --as-creating-line - - # Apply command to PNG images produced from design models to - # construct the final PNG image. - ${COMMAND} ${TARGET_INSTANCES[*]} ${TARGET} - - # Apply branding images to final PNG image. - if [[ -n ${BRANDS} ]];then - svg_setBrandInformation - fi - - # Apply comment to final PNG image. - if [[ -n ${COMMENT} ]];then - /usr/bin/mogrify -comment "${COMMENT}" ${TARGET} - fi - - # Remove instances to save disk space. There is no need to have - # unused files inside the temporal directory. They would be - # consuming space unnecessarily. Moreover, there is a remote - # chance of name collapsing (because the huge number of files that - # would be in place and the week random string we are putting in - # front of files) which may produce unexpected results. - rm ${TARGET_INSTANCES[*]} ${SOURCE_INSTANCES[*]} - - # Unset array variables and their counter to prevent undesired - # concatenations. - unset SOURCE_INSTANCES - unset TARGET_INSTANCES - unset TARGET_COMMANDS - unset INKSCAPE_OPTIONS - unset COUNTER - -} diff --git a/Automation/Modules/Render/Modules/Svg/svg_setBaseRenditionCommand.sh b/Automation/Modules/Render/Modules/Svg/svg_setBaseRenditionCommand.sh deleted file mode 100755 index bc7f576..0000000 --- a/Automation/Modules/Render/Modules/Svg/svg_setBaseRenditionCommand.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Scripts/svg_setBaseRenditionCommand.sh -# -- This function standardizes the way SVG files are produced -# inside the centos-art.sh script. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function svg_setBaseRenditionCommand { - - inkscape ${SOURCE_INSTANCES[${COUNTER}]} ${INKSCAPE_OPTIONS[${COUNTER}]} > /dev/null - -} diff --git a/Automation/Modules/Render/Modules/Svg/svg_setBaseRenditionOptions.sh b/Automation/Modules/Render/Modules/Svg/svg_setBaseRenditionOptions.sh deleted file mode 100755 index cd74041..0000000 --- a/Automation/Modules/Render/Modules/Svg/svg_setBaseRenditionOptions.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Scripts/svg_setBaseRenditionOptions.sh -# -- This function standardizes the way base rendition options are -# set. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function svg_setBaseRenditionOptions { - - if [[ ! -z ${FGCOLOR} ]] && [[ ${FGCOLOR} != '000000' ]];then - sed -i -r "s/((fill|stroke):#)000000/\1${FGCOLOR}/g" ${SOURCE_INSTANCES[${COUNTER}]} - fi - - INKSCAPE_OPTIONS[${COUNTER}]="--export-png=${TARGET_INSTANCES[${COUNTER}]}" - - if [[ -z ${EXPORTID} ]];then - INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-area-drawing " - else - svg_checkModelExportId "${SOURCE_INSTANCES[${COUNTER}]}" "${EXPORTID}" - INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-id=${EXPORTID} " - fi - - if [[ ! -z ${BGCOLOR} ]];then - INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-background=$(echo ${BGCOLOR} | cut -d'-' -f1) " - INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-background-opacity=$(echo ${BGCOLOR} | cut -d'-' -f2) " - fi - - if [[ ! -z ${HEIGHT} ]];then - INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-height=${HEIGHT} " - fi - -} diff --git a/Automation/Modules/Render/Modules/Svg/svg_setBrandInformation.sh b/Automation/Modules/Render/Modules/Svg/svg_setBrandInformation.sh deleted file mode 100755 index f635678..0000000 --- a/Automation/Modules/Render/Modules/Svg/svg_setBrandInformation.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -###################################################################### -# -# Modules/Render/Modules/Svg/Scripts/svg_setBrandInformation.sh -- -# This function takes brand information from configuration files, -# processes it, and apply it on final PNG image file. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function svg_setBrandInformation { - - for BRAND in ${BRANDS};do - - local FILENAME=$(echo ${BRAND} | cut -d: -f1) - local GEOMETRY=$(echo ${BRAND} | cut -d: -f2) - - tcar_checkFiles -ef ${FILENAME} - - /usr/bin/composite -geometry ${GEOMETRY} ${FILENAME} ${TARGET} ${TARGET} - - done - -} diff --git a/Automation/Modules/Render/Modules/Symlink/symlink.sh b/Automation/Modules/Render/Modules/Symlink/symlink.sh deleted file mode 100755 index 1accc29..0000000 --- a/Automation/Modules/Render/Modules/Symlink/symlink.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -###################################################################### -# -# symlink.sh -- This function provides an interface for ln command. -# It mainly exists to creates symbolic links based on information -# set in configuration files that have symlink as value to -# render-type option. In these sections, the render-from and -# link-target options are used to specify the link locations. The -# link-options option might be used to pass additional options to ln -# command. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function symlink { - - # Define absolute path to command used to create symbolic links. - local LN=/bin/ln - - # Retrieve command options (values are not required here). Just - # grant you are always creating symbolic links. - local LN_OPTIONS=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "link-options") - LN_OPTIONS="-si ${LN_OPTIONS}" - - # Retrieve link source. This is the file you want to link. This - # file is generally inside the repository. - local LN_SOURCE=${RENDER_FROM} - tcar_checkFiles -ef ${LN_SOURCE} - - # Retrieve link target. This is the link you want to create. This - # link may be inside or outside the repository. The value passed - # to this value must be a directory because it is concatenated - # with the section name to build the final path where link will be - # created. - local LN_TARGET=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "link-target") - tcar_checkFiles -ed ${LN_TARGET} - LN_TARGET=${LN_TARGET}/${SECTION} - - # Print action message. - tcar_printMessage "${LN_TARGET}" --as-creating-line - - # Create link interactively. - ${LN} ${LN_OPTIONS} ${LN_SOURCE} ${LN_TARGET} - -} diff --git a/Automation/Modules/Render/render.sh b/Automation/Modules/Render/render.sh index 88c2c24..2cdc589 100755 --- a/Automation/Modules/Render/render.sh +++ b/Automation/Modules/Render/render.sh @@ -39,27 +39,14 @@ function render { # against source directory locations in the working copy. local ARGUMENT=$(tcar_checkRepoDirSource ${ARGUMENT}) - # Retrieve list of configuration files from directory. - local CONFIGURATIONS=${ARGUMENT} if [[ -d ${ARGUMENT} ]];then - CONFIGURATIONS=$(tcar_getFilesList ${ARGUMENT} \ - --pattern=".+/.+\.conf$") + tcar_setModuleEnvironment -m 'directories' -t 'child' -g ${ARGUMENT} + elif [[ -f ${ARGUMENT} ]] && [[ ${ARGUMENT} =~ '\.conf$' ]];then + tcar_setModuleEnvironment -m 'files' -t 'child' -g ${ARGUMENT} + else + tcar_printMessage "${ARGUMENT} `gettext "isn't supported."`" --as-error-line fi - # Verify non-option arguments passed to centos-art.sh - # command-line. The path provided as argument must exist in - # the repository. Otherwise, it would be possible to create - # arbitrary directories inside the repository without any - # meaning. In order to be sure all required directories are - # available in the repository it is necessary use the prepare - # functionality. - tcar_checkFiles -e ${CONFIGURATIONS} - - # Process each configuration file. - for CONFIGURATION in ${CONFIGURATIONS};do - render_setRenderType "${CONFIGURATION}" - done - done } diff --git a/Automation/Modules/Render/render_setRenderType.sh b/Automation/Modules/Render/render_setRenderType.sh deleted file mode 100755 index f708186..0000000 --- a/Automation/Modules/Render/render_setRenderType.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/bash -###################################################################### -# -# render_setRenderType.sh -- This file evaluates a configuration -# file and determines what kind of rendition to do. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -function render_setRenderType { - - local CONFIGURATION="${1}" - - local -a SECTIONS - local SECTION='' - - # Define motif-specific environment variables, based on - # configuration file path. These variables might save - # configuration file writers from typing motif-specific - # information when they produce motif-specific content. These - # variables will be empty if the configuration file isn't inside - # a motif-specific directory structure. - local MOTIF=$(tcar_getPathComponent ${CONFIGURATION} --motif) - local MOTIF_NAME=$(tcar_getPathComponent ${CONFIGURATION} --motif-name) - local MOTIF_VERSION=$(tcar_getPathComponent ${CONFIGURATION} --motif-version) - - # Use arrays to store section names. This make possible to make - # use of post-rendition and last-rendition concepts. Otherwise it - # would be difficult to predict information about sections inside - # deeper environments. - for SECTION in $(tcar_getConfigSectionNames "${CONFIGURATION}" \ - | egrep ${TCAR_FLAG_FILTER});do - SECTIONS[++${#SECTIONS[*]}]="${SECTION}" - done - - local COUNTER=0 - - while [[ ${COUNTER} -lt ${#SECTIONS[*]} ]];do - - # Initialize array variables locally. - local -a TRANSLATIONS - local -a SOURCES - - SECTION=${SECTIONS[${COUNTER}]} - - if [[ ${SECTION} =~ "^/" ]];then - TARGET=${SECTION} - else - if [[ ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then - TARGET=$(dirname ${CONFIGURATION})/${SECTION} - else - TARGET=$(dirname ${CONFIGURATION})/${TCAR_SCRIPT_LANG_LC}/${SECTION} - fi - fi - - RENDER_TYPE=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-type") - if [[ -z ${RENDER_TYPE} ]];then - tcar_printMessage "${CONFIGURATION} `gettext "hasn't render-type set in."`" --as-error-line - fi - - RENDER_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-from") - if [[ -z ${RENDER_TYPE} ]];then - tcar_printMessage "${CONFIGURATION} `gettext "hasn't render-from set in."`" --as-error-line - fi - - for SOURCE in ${RENDER_FROM};do - if [[ ${SOURCE} =~ "^/" ]];then - SOURCES[((++${#SOURCES[*]}))]=${SOURCE} - else - SOURCES[((++${#SOURCES[*]}))]=$(dirname ${CONFIGURATION})/${SOURCE} - fi - done - - if [[ -z ${RENDER_TYPE} ]];then - RENDER_TYPE=$(echo ${SOURCES[0]} | sed -r 's/.+\.([[:alpha:]]+)$/\1/') - fi - - LOCALE_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "locale-from") - - # When the current locale information is not English, don't - # process section blocks unless they have any related - # translation file. There is no need to have untranslated - # content inside language-specific directories. - if [[ ! ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then - - if [[ -z ${LOCALE_FROM} ]];then - - # Increment array counter. - COUNTER=$(( ${COUNTER} + 1 )) - - # Reset array variable to avoid undesired - # concatenations between sections blocks. - unset TRANSLATIONS - unset SOURCES - - # Move to next section block. - continue - - fi - - for TRANSLATION in ${LOCALE_FROM};do - if [[ ${TRANSLATION} =~ "^/" ]];then - TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=${TRANSLATION} - else - TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=$(dirname ${CONFIGURATION})/${TRANSLATION} - fi - done - - tcar_checkFiles -ef ${TRANSLATIONS[*]} - - fi - - # Initialize render's modules. - case ${RENDER_TYPE} in - "svgz" | "svg" ) - tcar_setModuleEnvironment -m "svg" -t "child" - ;; - * ) - tcar_setModuleEnvironment -m "${RENDER_TYPE}" -t "child" - ;; - esac - - # Increment section's counter. - COUNTER=$(( ${COUNTER} + 1 )) - - # Reset array variable to avoid undesired concatenations - # between sections blocks. - unset TRANSLATIONS - unset SOURCES - - done - - # Reset array variables and their counters to avoid undesired - # concatenations between configuration files. - unset COUNTER - unset SECTIONS - -}