diff --git a/Scripts/Bash/Functions/Render/Svg/svg_doPostActions.sh b/Scripts/Bash/Functions/Render/Svg/svg_doPostActions.sh index 1a10b2f..8bc7eed 100755 --- a/Scripts/Bash/Functions/Render/Svg/svg_doPostActions.sh +++ b/Scripts/Bash/Functions/Render/Svg/svg_doPostActions.sh @@ -49,37 +49,37 @@ function svg_doPostActions { # the repository. if [[ $FLAG_DONT_DIRSPECIFIC == 'false' ]];then - if [[ $TEMPLATE =~ 'trunk/Identity/(Models|Images)/Themes/.+\.svg$' ]];then + if [[ $TEMPLATE =~ "trunk/Identity/(Models|Images)/Themes/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]="convertPngToBranded" - if [[ $TEMPLATE =~ "Backgrounds/.+\.svg$" ]];then + if [[ $TEMPLATE =~ "Backgrounds/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg' POSTACTIONS[((++${#POSTACTIONS[*]}))]='groupBy:png jpg' - elif [[ $TEMPLATE =~ "Concept/.+\.svg$" ]];then + elif [[ $TEMPLATE =~ "Concept/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf' POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToThumbnail:250' - elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Syslinux/.+\.svg$" ]];then + elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Syslinux/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToSyslinux:' POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToSyslinux:-floyd' - elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Grub/.+\.svg$" ]];then + elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Grub/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToGrub:' POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToGrub:-floyd' - elif [[ $TEMPLATE =~ "Posters/.+\.svg$" ]];then + elif [[ $TEMPLATE =~ "Posters/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf' fi - elif [[ $TEMPLATE =~ "trunk/Identity/Models/Brands/.+\.svg$" ]];then + elif [[ $TEMPLATE =~ "trunk/Identity/Models/Brands/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToBrands' - elif [[ $TEMPLATE =~ "trunk/Identity/Models/Icons/.+\.svg$" ]];then + elif [[ $TEMPLATE =~ "trunk/Identity/Models/Icons/.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToIcons' - elif [[ $TEMPLATE =~ "trunk/Identity/Models/Manuals.+\.svg$" ]];then + elif [[ $TEMPLATE =~ "trunk/Identity/Models/Manuals.+\.${RENDER_EXTENSION}$" ]];then POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf' fi diff --git a/Scripts/Bash/Functions/Render/render.sh b/Scripts/Bash/Functions/Render/render.sh index a27db19..fa92308 100755 --- a/Scripts/Bash/Functions/Render/render.sh +++ b/Scripts/Bash/Functions/Render/render.sh @@ -86,7 +86,7 @@ function render { # base-rendition input. In order for design model files to be # correclty rendered, they must end with one of the file # extensions listed here. - local RENDER_EXTENSIONS='svg docbook' + local RENDER_EXTENSIONS='svg svgz docbook' # Interpret arguments and options passed through command-line. render_getOptions diff --git a/Scripts/Bash/Functions/Render/render_doBaseActions.sh b/Scripts/Bash/Functions/Render/render_doBaseActions.sh index f3ae0d1..d796101 100755 --- a/Scripts/Bash/Functions/Render/render_doBaseActions.sh +++ b/Scripts/Bash/Functions/Render/render_doBaseActions.sh @@ -53,8 +53,10 @@ function render_doBaseActions { # Redefine name of rendition format based on supported file # extension. - if [[ $RENDER_EXTENSION =~ '^(svg|docbook)$' ]];then - RENDER_FORMAT=${RENDER_EXTENSION} + if [[ $RENDER_EXTENSION =~ '^(svg|svgz)$' ]];then + RENDER_FORMAT='svg' + elif [[ $RENDER_EXTENSION =~ '^(docbook)$' ]];then + RENDER_FORMAT='docbook' else cli_printMessage "`eval_gettext "The \\\"\\\$RENDER_EXTENSION\\\" file extension is not supported yet."`" --as-error-line fi diff --git a/Scripts/Bash/Functions/Render/render_doTranslation.sh b/Scripts/Bash/Functions/Render/render_doTranslation.sh index d473f5c..2339b29 100755 --- a/Scripts/Bash/Functions/Render/render_doTranslation.sh +++ b/Scripts/Bash/Functions/Render/render_doTranslation.sh @@ -5,10 +5,10 @@ # the translated instance that is used to expand translation markers # and produce the base-rendition output. # -# Assuming no translation file exists, the an untranslated instace -# from the design model is created (i.e., just a copy of it). Using a -# design model instance (translated or not) is required in order to -# expand translation markers safetly. +# Assuming no translation file exists, an untranslated instace is +# taken from the design model and created (i.e., just a copy) from it. +# Using a design model instance (translated or not) is required in +# order to expand translation markers safetly. # # Copyright (C) 2009, 2010, 2011 The CentOS Project # @@ -32,6 +32,14 @@ function render_doTranslation { + # Define which command will be used to output the template + # content. This is required because template files might be found + # as compressed files inside the repository. + local COMMAND="/bin/cat" + if [[ $(file -b -i $TEMPLATE) =~ '^application/x-gzip$' ]];then + COMMAND="/bin/zcat" + fi + # Verify translation file existence and create template # instance accordingly. if [[ -f ${TRANSLATION} ]];then @@ -42,10 +50,11 @@ function render_doTranslation { # Create the translated instance of design model based on # whether the template file has DOCTYPE definition or not. if [[ ${TEMPLATE_HAS_DOCTYPE} -eq 0 ]];then - xmllint --valid --noent ${TEMPLATE} \ + ${COMMAND} ${TEMPLATE} | xmllint --valid --noent - \ | xml2po -a -l $(cli_getCurrentLocale) -p ${TRANSLATION} -o ${INSTANCE} - else - xml2po -a -l $(cli_getCurrentLocale) -p ${TRANSLATION} -o ${INSTANCE} ${TEMPLATE} + ${COMMAND} ${TEMPLATE} | xml2po -a -l $(cli_getCurrentLocale) \ + -p ${TRANSLATION} -o ${INSTANCE} - fi # Remove .xml2po.mo temporal file. @@ -57,9 +66,9 @@ function render_doTranslation { # Create the non-translated instance of design model. if [[ ${TEMPLATE_HAS_DOCTYPE} -eq 0 ]];then - xmllint --valid --noent ${TEMPLATE} > ${INSTANCE} + ${COMMAND} ${$TEMPLATE} | xmllint --valid --noent - > ${INSTANCE} else - cp ${TEMPLATE} ${INSTANCE} + ${COMMAND} ${TEMPLATE} > ${INSTANCE} fi fi