| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function render_doBaseActions { |
| |
| local -a FILES |
| local FILE='' |
| local OUTPUT='' |
| local TEMPLATE='' |
| local TEMPLATE_HAS_DOCTYPE='' |
| local PARENTDIR='' |
| local TRANSLATION='' |
| local EXTERNALFILE='' |
| local EXTERNALFILES='' |
| local THIS_FILE_DIR='' |
| local NEXT_FILE_DIR='' |
| local RENDER_EXTENSION='' |
| local COUNT=0 |
| |
| |
| cli_checkFiles "$(cli_getRepoTLDir)/Identity/Models/Themes/${FLAG_THEME_MODEL}" --directory |
| |
| |
| PARENTDIR=$(basename "${ACTIONVAL}") |
| |
| |
| render_getDirTemplate |
| |
| |
| for RENDER_EXTENSION in ${RENDER_EXTENSIONS};do |
| |
| |
| |
| if [[ $RENDER_EXTENSION =~ '^(svg|docbook)$' ]];then |
| RENDER_FORMAT=${RENDER_EXTENSION} |
| else |
| cli_printMessage "`eval_gettext "The \\\"\\\$RENDER_EXTENSION\\\" file extension is not supported yet."`" --as-error-line |
| fi |
| |
| # Define the list of files to process. Use an array variable |
| # to store the list of files to process. This make posible to |
| # realize verifications like: is the current base directory |
| # equal to the next one in the list of files to process? |
| # Questions like this is let us to know when centos-art.sh is |
| # leaving a directory structure and entering another. This |
| # information is required in order for centos-art.sh to know |
| # when to apply last-rendition actions. |
| # |
| # Another issue is that some directories might be named as if |
| # they were files (e.g., using a renderable extension like |
| # .docbook). In these situations we need to avoid such |
| # directories from being interpreted as a renderable file. For |
| # this, pass the `--type="f"' option when building the list of |
| # files to process in order to retrive regular files only. |
| # |
| # Another issue to consider here, is that in some cases both |
| # templates and outputs might be in the same location. In |
| # these cases localized content are stored in the same |
| # location where template files are retrived from and we need |
| # to avoid using localized content from being interpreted as |
| # design models. In that sake, supress language-specific files |
| # from the list of files to process. |
| # |
| # Another issue to consider here, is the way of filtering. We |
| # cannot expand the pattern specified by FLAG_FILTER with a |
| # `.*' here (e.g., "${FLAG_FILTER}.*\.${RENDER_EXTENSION}") |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| for FILE in $(cli_getFilesList ${TEMPLATE} \ |
| --pattern="${FLAG_FILTER}\.${RENDER_EXTENSION}" --type="f" \ |
| | egrep -v '/[[:alpha:]]{2}_[[:alpha:]]{2}/');do |
| FILES[((++${ |
| done |
| |
| |
| |
| if [[ ${ |
| continue |
| fi |
| |
| |
| cli_exportFunctions "${RENDER_FORMAT_DIR}/$(cli_getRepoName \ |
| ${RENDER_FORMAT} -d)" "${RENDER_FORMAT}" |
| |
| |
| |
| while [[ $COUNT -lt ${ |
| |
| |
| FILE=${FILES[$COUNT]} |
| |
| |
| |
| THIS_FILE_DIR=$(dirname ${FILES[$COUNT]}) |
| |
| |
| |
| if [[ $(($COUNT + 1)) -lt ${ |
| NEXT_FILE_DIR=$(dirname ${FILES[$(($COUNT + 1))]}) |
| else |
| NEXT_FILE_DIR='' |
| fi |
| |
| |
| cli_printMessage '-' --as-separator-line |
| |
| |
| TRANSLATION=$(dirname $FILE \ |
| | sed -r 's!trunk/(Manuals|Identity)!trunk/L10n/\1!')/$(cli_getCurrentLocale)/messages.po |
| |
| |
| TEMPLATE=${FILE} |
| |
| |
| |
| if [[ ! -f $TEMPLATE ]];then |
| cli_printMessage "`gettext "The template file doesn't exist."`" --as-error-line |
| fi |
| |
| # Verify whether the design model uses DOCTYPE definition |
| # or not; and redefine related variable for further using. |
| egrep '^<!DOCTYPE' ${TEMPLATE} > /dev/null |
| TEMPLATE_HAS_DOCTYPE=$? |
| |
| # Validate design model before processing it. This step is |
| # very important in order to detect document's |
| |
| |
| |
| |
| if [[ $TEMPLATE_HAS_DOCTYPE -eq 0 ]];then |
| |
| |
| cli_printMessage "$TEMPLATE" --as-validating-line |
| |
| |
| xmllint --valid --noent --noout $TEMPLATE |
| if [[ $? -ne 0 ]];then |
| cli_printMessage "`gettext "Validation failed."`" --as-error-line |
| fi |
| |
| else |
| |
| cli_printMessage "$TEMPLATE" --as-template-line |
| fi |
| |
| |
| render_getDirOutput |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| FILE=$(echo ${FILE} \ |
| | sed -r "s!.*${PARENTDIR}/!!" \ |
| | sed -r "s/\.${RENDER_EXTENSION}$//") |
| |
| |
| FILE=${OUTPUT}/$(basename "${FILE}") |
| |
| |
| INSTANCE=$(cli_getTemporalFile ${TEMPLATE}) |
| |
| |
| |
| render_doTranslation |
| |
| |
| cli_expandTMarkers ${INSTANCE} |
| |
| |
| ${RENDER_FORMAT} |
| |
| |
| if [[ -f $INSTANCE ]];then |
| rm $INSTANCE |
| fi |
| |
| |
| COUNT=$(($COUNT + 1)) |
| |
| done |
| |
| |
| cli_unsetFunctions "${RENDER_FORMAT_DIR}/$(cli_getRepoName \ |
| ${RENDER_FORMAT} -d)" "${RENDER_FORMAT}" |
| |
| done |
| } |