From 2cf5c6b7d79dbfb6233cc234b0598a49d575078c Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Nov 07 2013 19:11:56 +0000 Subject: Update render module of centos-art.sh script. - Previously, the language expansion when man pages were produce took place inside the render_setLocalizedXml function. The render_setLocalizedXml function is also used to localize other kind of document which doesn't require to make any language expansion fixing. So the language verification related to man pages was checked in places where it never applied. This update moves the language expansion related to man pages from render_setLocalizedXml to manpage module where it always is applied. - Previously, at asciidoc_setBaseRendition, there was one while loop to build the localized instances and one for loop to process localized instances created in the while loop. This update moves instance processing from for loop to while loop and removes the for loop from the function. There is just one loop for both building and processing localized instances. As consequence, the DOCBOOK_FILE variable definition was removed from asciidoc_setBaseRendition function and the TCAR_INSTANCES array variable is used instead when you need to retrieve docbook localized instance inside child module environments. - Previously, neither svg nor asciidoc modules from render module did support any release translation markers. This made expansion of =RELEASE= and =MAJOR_RELEASE= translation markers to fail. This update changes svg and asciidoc modules from render module to support expansion of =RELASE= and =MAJOR_RELEASE= translation markers. - Previously, asciidoc_setFormatsRendition didn't include a default format in the case construction. Without a default entry in the case construction would leave the script in a uncertain state when a format different from that supported is specified. This update changes asciidoc_setFormatsRendition to add a default format entry in the case construction. - Previously, when no export id was specified, the svg module inside the render module defined CENTOSARTWORK as default export-id value. This made rendition of PNG files to fail when the CENTOSARTWORK export-id is not set inside the SVG file. This update changes the svg module inside the render module to allow an empty export-id value. When no export-id value is provided to svg module inside render module, the export-area-drawing is used instead for producing the PNG file. This make rendition of PNG files very difficult to fail. - Simplify render_setLocalizedXml function. - Add missing top comments inside shell scripts. - Add render_setInstances function. --- diff --git a/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh b/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh index b020f93..68e67dd 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh @@ -1,8 +1,8 @@ #!/bin/bash ###################################################################### # -# Modules/Render/Modules/Archive/archive.sh -- This file -# standardizes file archiving inside the centos-art.sh script. +# archive.sh -- This file standardizes file archiving inside the +# centos-art.sh script. # # Written by: # * Alain Reguera Delgado , 2009-2013 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 index 310b9ab..d8a96c9 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Article/article.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Article/article.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# manpage.sh -- This module produces docbook documents using article +# document type. +# +# 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 article { 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 index 1c55acf..50feb02 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Book/book.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Book/book.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# book.sh -- This module produces docbook documents using book +# document type. +# +# 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 book { 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 index 518a649..7aab945 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# manpage.sh -- This module produces docbook documents using manpage +# document type. +# +# 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 manpage { @@ -6,6 +31,14 @@ function manpage { tcar_checkFiles -m '[1-9]' "${MANSECT}" + # xml2po (gnome-doc-utils-0.8.0-2.fc6) bug? For some reason xml2po + # is not adding the lang attribute to refentry tag when it + # produces manpage document types. This make intrinsic docbook + # construction like Name and Synopsis to be rendered without + # localization. This doesn't happens with article and book + # document types. + sed -i -r "s///" ${TARGET_INSTANCES[${COUNTER}]} + for FORMAT in ${FORMATS};do tcar_checkFiles -m '(xhtml|manpage)' "${FORMAT}" @@ -24,7 +57,7 @@ function manpage { fi tcar_printMessage "${MAN_TARGET}" --as-creating-line /usr/bin/xsltproc -o ${MAN_TARGET} --nonet \ - ${DOCBOOK_XSL}/docbook2manpage.xsl ${DOCBOOK_FILE} + ${DOCBOOK_XSL}/docbook2manpage.xsl ${TARGET_INSTANCES[${COUNTER}]} ;; esac diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh index 76fc85c..3ebfbf7 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh @@ -1,9 +1,8 @@ #!/bin/bash ###################################################################### # -# Modules/Render/Modules/Asciidoc/asciidoc.sh -- This function -# standardizes rendition of asciidoc files inside the centos-art.sh -# script. +# asciidoc.sh -- This function standardizes rendition of asciidoc +# files inside the centos-art.sh script. # # Written by: # * Alain Reguera Delgado , 2009-2013 @@ -43,6 +42,12 @@ function asciidoc { FORMATS='xhtml' fi + RELEASE=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" 'release') + if [[ -z ${RELEASE} ]];then + RELEASE=$(cut -f3 -d' ' /etc/redhat-release) + fi + MAJOR_RELEASE=$(echo ${RELEASE} | cut -d. -f1) + asciidoc_setBaseRendition } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh index f060b6e..abe81bc 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh @@ -1,9 +1,8 @@ #!/bin/bash ###################################################################### # -# Modules/Render/Modules/Asciidoc/Scripts/asciidoc_setBaseRendition.sh -# -- This function standardizes transformation of asciidoc files -# into docbook files. +# asciidoc_setBaseRendition.sh -- This function standardizes +# transformation of asciidoc files into docbook files. # # Written by: # * Alain Reguera Delgado , 2009-2013 @@ -28,53 +27,29 @@ function asciidoc_setBaseRendition { + local COUNTER=0 + local -a SOURCE_INSTANCES local -a TARGET_INSTANCES - 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/')") + render_setInstances "${SOURCES[${COUNTER}]}" '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 )) + tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" - done + COUNTER=$(( ${COUNTER} + 1 )) - # Initiate format-specific transformations for current render - # flow. - for DOCBOOK_FILE in ${TARGET_INSTANCES[*]};do - tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" done - unset SOURCE_INSTANCES unset TARGET_INSTANCES + unset SOURCE_INSTANCES } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh index 4e4d410..5c71014 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh @@ -1,9 +1,9 @@ #!/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. +# 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 diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh index fc37e09..6a8371c 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh @@ -1,13 +1,43 @@ #!/bin/bash +###################################################################### +# +# asciidoc_setFormatsRendition.sh -- This function standardizes the +# rendition formats supported by asciidoc module. +# +# 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_setFormatsRendition { for FORMAT in ${FORMATS};do case ${FORMAT} in + 'xhtml' ) asciidoc_setXhtmlRendition "${RENDER_TARGET}" ;; + + * ) + tcar_printMessage "`gettext "The format you specified isn't supported, yet."`" --as-error-line + ;; 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 index 9c78593..e3a77a7 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# asciidoc_setXhtmlRendition.sh -- This function standardizes the way +# docbook files are transformed in XHTML format. +# +# 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_setXhtmlRendition { @@ -42,7 +67,7 @@ function asciidoc_setXhtmlRendition { for RENDER_PAGE in ${RENDER_PAGES};do /usr/bin/xsltproc -o ${LOCATION} --nonet \ - ${DOCBOOK_XSL}/docbook2xhtml-${RENDER_PAGE}.xsl ${DOCBOOK_FILE} + ${DOCBOOK_XSL}/docbook2xhtml-${RENDER_PAGE}.xsl ${TARGET_INSTANCES[${COUNTER}]} done } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh b/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh index 8ef514f..f164d80 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh @@ -1,8 +1,8 @@ #!/bin/bash ###################################################################### # -# Modules/Render/Modules/Compress/compress.sh -- This file -# standardize file compression inside the centos-art.sh script. +# compress.sh -- This file standardize file compression inside the +# centos-art.sh script. # # Written by: # * Alain Reguera Delgado , 2009-2013 diff --git a/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh b/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh index 0dd0712..ba0e463 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh @@ -1,12 +1,12 @@ #!/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. +# 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 diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh index 1294cba..20fb82c 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh @@ -1,9 +1,9 @@ #!/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. +# 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 diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_checkColorFormat.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_checkColorFormat.sh index 30973eb..b11b16c 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_checkColorFormat.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_checkColorFormat.sh @@ -1,9 +1,8 @@ #!/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). +# palette_checkColorFormats.sh -- This function verifies formats of +# colors (i.e., the way color information is specified). # # Written by: # * Alain Reguera Delgado , 2009-2013 diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToHex.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToHex.sh index e9fce4c..d78a00a 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToHex.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToHex.sh @@ -1,11 +1,11 @@ #!/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]). +# 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 diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToPpm.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToPpm.sh index 1c9073a..0619f68 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToPpm.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette_convertGplToPpm.sh @@ -1,10 +1,9 @@ #!/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). +# 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 diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Media/media.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Media/media.sh index 935b193..50fe025 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Media/media.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Media/media.sh @@ -46,7 +46,8 @@ function media { while [[ ${MEDIA_NUMBER_CURRENT} -le ${MEDIA_NUMBER} ]];do local COUNTER=0 - local -a SOURCES_INSTANCES + local -a SOURCE_INSTANCES + local -a TARGET_INSTANCES for RELEASE in ${MEDIA_RELEASE};do @@ -54,29 +55,24 @@ function media { for MEDIA_SOURCE in ${MEDIA_SOURCES};do - SOURCES_INSTANCES[${COUNTER}]=$(tcar_getTemporalFile ${MEDIA_SOURCE}) + render_setInstances "${MEDIA_SOURCE}" '(svgz|svg)' 'svg' - # Create source instance considering whether or - # not it has translation files related. Apply - # translation files to source instance, if any. - render_setLocalizedXml "${MEDIA_SOURCE}" "${SOURCES_INSTANCES[${COUNTER}]}" + render_setLocalizedXml "${MEDIA_SOURCE}" "${TARGET_INSTANCES[${COUNTER}]}" - # Expand translation markers specific to - # installation media. sed -i -r -e "s/=MEDIUM=/${MEDIA_TYPE}/g" \ -e "s/=CURRENT=/${MEDIA_NUMBER_CURRENT}/g" \ -e "s/=RELEASE=/${RELEASE}/g" \ -e "s/=ARCH=/${ARCH}/g" \ -e "s/=LAST=/${MEDIA_NUMBER}/g" \ - ${SOURCES_INSTANCES[${COUNTER}]} + ${TARGET_INSTANCES[${COUNTER}]} RENDER_TARGET="$(dirname ${RENDER_TARGET})/${SECTION}-${RELEASE}-${ARCH}-${MEDIA_NUMBER_CURRENT}of${MEDIA_NUMBER}.png" - SOURCES[${COUNTER}]=${SOURCES_INSTANCES[${COUNTER}]} + SOURCES[${COUNTER}]=${TARGET_INSTANCES[${COUNTER}]} svg_setBaseRendition - rm ${SOURCES[${COUNTER}]} + rm ${TARGET_INSTANCES[${COUNTER}]} if [[ ${MEDIA_SOURCES_MAX} -gt 1 ]];then COUNTER=$(( ${COUNTER} + 1 )) diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg.sh index 657e344..96e0e36 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg.sh @@ -1,10 +1,9 @@ #!/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. +# 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 @@ -45,12 +44,16 @@ function svg { 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" + EXPORTID=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "export-id") + + RELEASE=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" 'release') + if [[ -z ${RELEASE} ]];then + RELEASE=$(cut -f3 -d' ' /etc/redhat-release) fi + MAJOR_RELEASE=$(echo ${RELEASE} | cut -d. -f1) for RENDER_FLOW in ${RENDER_FLOWS} ;do tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelExportId.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelExportId.sh index aa95efa..bd80a4b 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelExportId.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_checkModelExportId.sh @@ -1,9 +1,8 @@ #!/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. +# 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 @@ -40,7 +39,7 @@ function svg_checkModelExportId { # 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 + tcar_printMessage "`gettext "The design model doesn't contain the export-id you specified."`" --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 index bed0df2..f41cd71 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh @@ -35,26 +35,10 @@ function svg_setBaseRendition { 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_getTemporalFile $(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 $(basename ${SOURCES[${COUNTER}]} \ - | sed -r 's/\.(svgz|svg)$/.png/')) - - # Create source instance considering translation files. + render_setInstances "${SOURCES[${COUNTER}]}" '(svgz|svg)' 'png' + render_setLocalizedXml "${SOURCES[${COUNTER}]}" "${SOURCE_INSTANCES[${COUNTER}]}" - # Expand any translation file that might exist. tcar_setTranslationMarkers ${SOURCE_INSTANCES[${COUNTER}]} svg_checkModelAbsref "${SOURCE_INSTANCES[${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 index 0ef71f0..10ded06 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionCommand.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionCommand.sh @@ -27,6 +27,6 @@ function svg_setBaseRenditionCommand { - inkscape ${SOURCE_INSTANCES[${COUNTER}]} ${INKSCAPE_OPTIONS[${COUNTER}]} > /dev/null + /usr/bin/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 index cd74041..a7efeb2 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionOptions.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRenditionOptions.sh @@ -1,9 +1,8 @@ #!/bin/bash ###################################################################### # -# Modules/Render/Modules/Svg/Scripts/svg_setBaseRenditionOptions.sh -# -- This function standardizes the way base rendition options are -# set. +# svg_setBaseRenditionOptions.sh -- This function standardizes the +# way base rendition options are set. # # Written by: # * Alain Reguera Delgado , 2009-2013 @@ -37,7 +36,7 @@ function svg_setBaseRenditionOptions { if [[ -z ${EXPORTID} ]];then INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-area-drawing " else - svg_checkModelExportId "${SOURCE_INSTANCES[${COUNTER}]}" "${EXPORTID}" + svg_checkModelExportId "${SOURCE_INSTANCES[${COUNTER}]}" "${EXPORTID}" INKSCAPE_OPTIONS[${COUNTER}]="${INKSCAPE_OPTIONS[${COUNTER}]} --export-id=${EXPORTID} " 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 index 637ad7b..1f420ce 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh @@ -1,9 +1,9 @@ #!/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. +# 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 diff --git a/Automation/Modules/Render/render_setInstances.sh b/Automation/Modules/Render/render_setInstances.sh new file mode 100755 index 0000000..83ad63c --- /dev/null +++ b/Automation/Modules/Render/render_setInstances.sh @@ -0,0 +1,47 @@ +#!/bin/bash +###################################################################### +# +# render_setInstances.sh -- This function standardizes definition of +# file instances inside the render module. +# +# 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_setInstances { + + local FILE=${1} + local FILE_EXTENSION_PATTERN=${2:-asciidoc} + local FILE_EXTENSION_REPLACE=${3:-docbook} + + # Verify existence and extension of design model. + tcar_checkFiles -ef -m "\.${FILE_EXTENSION_PATTERN}$" "${FILE}" + + # Define file base name. + local FILE_BASENAME=$(basename ${FILE}) + + # Define absolute path to source instance. + SOURCE_INSTANCES[${COUNTER}]=$(tcar_getTemporalFile ${FILE_BASENAME}) + + # Define absolute path to target instance. + TARGET_INSTANCES[${COUNTER}]=$(tcar_getTemporalFile ${FILE_BASENAME} \ + | sed -r "s/\.${FILE_EXTENSION_PATTERN}$/.${FILE_EXTENSION_REPLACE}/") + +} diff --git a/Automation/Modules/Render/render_setLocalizedXml.sh b/Automation/Modules/Render/render_setLocalizedXml.sh index b838726..5b54554 100755 --- a/Automation/Modules/Render/render_setLocalizedXml.sh +++ b/Automation/Modules/Render/render_setLocalizedXml.sh @@ -34,80 +34,63 @@ function render_setLocalizedXml { - local SOURCE=${1} - local TARGET=${2} - - local TRANSLATION=$(tcar_getTemporalFile "messages.po") - - # By default source instances are created inside /tmp directory - # and are localized before reaching base rendition. In case a - # source instance is being used as source here, don't duplicate - # it. Try to reuse it, instead. - - if [[ ! ${SOURCE} =~ '^/tmp' ]];then - - if [[ ${RENDER_FLAG_NO_LOCALE} != 'true' ]];then - - # Verify existence of translation files. - tcar_checkFiles -efi 'text/x-po' ${TRANSLATIONS[*]} - - # Combine available translations file into one translation - # instance. - msgcat -u -o ${TRANSLATION} ${TRANSLATIONS[*]} - - # Move to final location before processing source file in - # order for relative calls (e.g., image files) inside the - # source files can be found by xml2po and no warning be - # printed from it. - pushd $(dirname ${RENDER_TARGET}) > /dev/null - - # Create the translated instance of design model. - tcar_printFile ${SOURCE} | xml2po -a -l ${TCAR_SCRIPT_LANG_LC} \ - -p ${TRANSLATION} -o ${TARGET} - - - # Remove .xml2po.mo temporal file. - if [[ -f ./.xml2po.mo ]];then - rm ./.xml2po.mo - fi - - # Return to previous location. - popd > /dev/null - - # Remove instance created to store both licenses and template - # translations. - if [[ -f ${TRANSLATION} ]];then - rm ${TRANSLATION} - fi + # Define absolute path to source instance. + local SOURCE="${1}" + + # Define absolute path to target instance. + local TARGET="${2}" + + # Verify source instance and the no-locale flag. When source + # instance already exists, don't create a new file for it. + # Instead, link it using a symbolic link. + if [[ -f ${SOURCE} ]];then + tcar_checkFiles -i 'text/xml' ${SOURCE} + if [[ ${SOURCE} =~ "^${TCAR_SCRIPT_TEMPDIR}" ]];then + /bin/ln -s ${SOURCE} ${TARGET} + return + elif [[ ${RENDER_FLAG_NO_LOCALE} == 'true' ]];then + tcar_printFile ${SOURCE} > ${TARGET} + tcar_checkFiles -i 'text/xml' ${TARGET} + return + fi + fi - # xml2po (gnome-doc-utils-0.8.0-2.fc6) bug? For some - # reason, xml2po is not adding the lang attribute to - # refentry tag, when producing manpages document types. - # This make intrinsic docbook construction for manpages - # like Name and Synopsis to be not localized. This - # doesn't happens with article and - # book document types. - if [[ ${RENDER_FLOW} == 'manpage' ]];then - sed -i -r "s///" ${TARGET} - fi + # Verify existence of translation files. + tcar_checkFiles -efi 'text/x-po' ${TRANSLATIONS[*]} - else + # Define absolute path to translation instance. + local TRANSLATION=$(tcar_getTemporalFile "messages.po") - tcar_printFile ${SOURCE} > ${TARGET} + # Combine available translations file into one translation + # instance. + msgcat -u -o ${TRANSLATION} ${TRANSLATIONS[*]} - fi + # Verify existence of final location. In case it doesn't exist, + # create it. + if [[ $(dirname ${RENDER_TARGET}) ]];then + mkdir -p $(dirname ${RENDER_TARGET}) + fi - # Make your best to be sure the file you've created is a valid - # XML file. - tcar_checkFiles -efi 'text/xml' ${TARGET} + # Move to final location before processing source file in order + # for relative calls (e.g., image files) inside the source files + # can be found by xml2po and no warning be printed from it. + pushd $(dirname ${RENDER_TARGET}) > /dev/null - else + # Create the localized instance from design model. + tcar_printFile ${SOURCE} | xml2po -a -l ${TCAR_SCRIPT_LANG_LC} \ + -p ${TRANSLATION} -o ${TARGET} - - /bin/ln -s ${SOURCE} ${TARGET} + # Remove .xml2po.mo temporal file. + if [[ -f ./.xml2po.mo ]];then + rm ./.xml2po.mo + fi - # Make your best to be sure the file you've linked is a valid - # XML file. - tcar_checkFiles -efi 'text/xml' ${SOURCE} + # Return to previous location. + popd > /dev/null + # Remove instance created to store template translations. + if [[ -f ${TRANSLATION} ]];then + rm ${TRANSLATION} fi }