| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function render_setBaseRendition { |
| |
| local -a FILES |
| local FILE='' |
| local OUTPUT='' |
| local TEMPLATE='' |
| local TEMPLATES='' |
| local PARENTDIR='' |
| local TRANSLATION='' |
| local EXTERNALFILE='' |
| local EXTERNALFILES='' |
| local THIS_FILE_DIR='' |
| local NEXT_FILE_DIR='' |
| local RENDER_EXTENSION='' |
| local EXPORTID='' |
| local COUNT=0 |
| |
| |
| cli_checkFiles -e "${TCAR_WORKDIR}/Identity/Models/Themes/${FLAG_THEME_MODEL}" |
| |
| |
| PARENTDIR=$(basename "${ACTIONVAL}") |
| |
| |
| for RENDER_EXTENSION in ${RENDER_EXTENSIONS};do |
| |
| |
| |
| if [[ $RENDER_EXTENSION =~ '^(svgz|svg)$' ]];then |
| RENDER_FORMAT='svg' |
| elif [[ $RENDER_EXTENSION =~ '^(docbook)$' ]];then |
| RENDER_FORMAT='docbook' |
| elif [[ $RENDER_EXTENSION =~ '^(conf)$' ]];then |
| RENDER_FORMAT='conf' |
| else |
| cli_printMessage "`eval_gettext "The \\\"\\\$RENDER_EXTENSION\\\" file extension is not supported yet."`" --as-error-line |
| fi |
| |
| # Redefine specific function export id. |
| EXPORTID="${CLI_FUNCDIRNAM}/$(cli_getRepoName ${RENDER_FORMAT} -d)/$(cli_getRepoName ${RENDER_FORMAT} -f)" |
| |
| # Define base location of template files using paths passed to |
| # centos-art.sh script as argument to. |
| render_getDirTemplate |
| |
| # Verify whether or not the source location of the path |
| # provided as argument to centos-art.sh script accepts or not |
| # localization messages. Don't produce localized content for |
| # repository components that don't accept it. |
| if [[ ! ${CLI_LANG_LC} =~ '^en' ]];then |
| cli_runFnEnvironment locale --is-localizable ${TEMPLATE} |
| fi |
| |
| # Define the list of files to process. Use an array variable |
| # to store the list of files to process. This make possible to |
| # realize verifications like: is the current base directory |
| # equal to the next one in the list of files to process? |
| # Questions like this 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 render able extension like |
| # .docbook). In these situations we need to avoid such |
| # directories from being interpreted as a render able file. |
| # For this, pass the `--type="f"' option when building the |
| # list of files to process in order to retrieve 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 retrieved from and we need |
| # to avoid using localized content from being interpreted as |
| # design models. In that sake, build the list of files to |
| # process using the files directly stored in the directory |
| # passed as argument to centos-art.sh command-line. Don't go |
| # recursively here. |
| # |
| # Another issue to consider here, is the way of restricting |
| # the list of files to process. We cannot expand the pattern |
| # specified by FLAG_FILTER with a `.*' here (e.g., |
| # "${FLAG_FILTER}.*\.${RENDER_EXTENSION}") because that would |
| # suppress any possibility from the user to specify just one |
| # file name in locations where more than one file with the |
| # same name as prefix exists (e.g., `repository.docbook', |
| # `repository-preamble.docbook' and |
| # `repository-parts.docbook'). Instead, pass filtering |
| # control to the user whom can use regular expression markup |
| # in the `--filter' option to decide whether to match |
| # `repository.docbook' only (e.g., through |
| # `--filter="repository"') or `repository-preamble.docbook' |
| # and `repository-parts.docbook' but not `repository.docbook' |
| # (e.g., through `--filter="repository-.*"'). |
| if [[ ${RENDER_FORMAT} =~ "^docbook$" ]];then |
| |
| # When the render format is docbook, don't build a list of |
| # files to process. Instead, build the absolute path of |
| # the main file used to render docbook from models to |
| # final output manuals. This file must be stored directly |
| # inside the main manual's directory and named as it but |
| # with all letters in lowercase. |
| for FILE in $(cli_getFilesList ${TEMPLATE} \ |
| --maxdepth="1" --mindepth="1" \ |
| --pattern="^.*$(cli_getRepoName ${TEMPLATE} -f)\.${RENDER_EXTENSION}$" \ |
| --type="f");do |
| FILES[((++${#FILES[*]}))]=$FILE |
| done |
| |
| elif [[ ${RENDER_FORMAT} =~ "^conf$" ]];then |
| |
| |
| |
| |
| |
| |
| for FILE in $(cli_getFilesList ${TEMPLATE} \ |
| --pattern="^.+/images\.${RENDER_EXTENSION}$" \ |
| --type="f");do |
| FILES[((++${#FILES[*]}))]=$FILE |
| done |
| |
| else |
| |
| |
| |
| for FILE in $(cli_getFilesList ${TEMPLATE} \ |
| --pattern="^.+/${FLAG_FILTER}.*\.${RENDER_EXTENSION}$" \ |
| --type="f");do |
| FILES[((++${#FILES[*]}))]=$FILE |
| done |
| |
| fi |
| |
| |
| |
| if [[ ${#FILES[*]} -eq 0 ]];then |
| continue |
| fi |
| |
| |
| cli_exportFunctions "${EXPORTID}" |
| |
| |
| |
| while [[ $COUNT -lt ${#FILES[*]} ]];do |
| |
| |
| FILE=${FILES[$COUNT]} |
| |
| |
| |
| THIS_FILE_DIR=$(dirname ${FILES[$COUNT]}) |
| |
| |
| |
| if [[ $(($COUNT + 1)) -lt ${#FILES[*]} ]];then |
| NEXT_FILE_DIR=$(dirname ${FILES[$(($COUNT + 1))]}) |
| else |
| NEXT_FILE_DIR='' |
| fi |
| |
| |
| cli_printMessage '-' --as-separator-line |
| |
| |
| if [[ ${FILE} =~ 'images\.conf$' ]] && [[ $FLAG_WITH_BRANDS == 'true' ]];then |
| cli_printMessage "${FILE}" --as-processing-line |
| elif [[ ${FILE} =~ 'brands\.conf$' ]];then |
| continue |
| else |
| cli_printMessage "${FILE}" --as-template-line |
| fi |
| |
| |
| |
| cli_checkFiles ${FILE} -f |
| |
| |
| TRANSLATION=$(dirname ${FILE} \ |
| | sed -r 's!(Documentation|Identity)!Locales/\1!')/${CLI_LANG_LC}/messages.po |
| |
| |
| TEMPLATE=${FILE} |
| |
| |
| render_getDirOutput |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| FILE=$(echo ${FILE} \ |
| | sed -r "s!.*${PARENTDIR}/!!" \ |
| | sed -r "s/\.${RENDER_EXTENSION}$//") |
| |
| |
| FILE=${OUTPUT}/$(basename "${FILE}") |
| |
| |
| INSTANCE=$(cli_getTemporalFile ${TEMPLATE}) |
| |
| |
| ${RENDER_FORMAT} |
| |
| |
| if [[ -f $INSTANCE ]];then |
| rm $INSTANCE |
| fi |
| |
| |
| COUNT=$(($COUNT + 1)) |
| |
| done |
| |
| |
| COUNT=0 |
| |
| |
| cli_unsetFunctions "${EXPORTID}" |
| |
| |
| unset FILES |
| |
| done |
| } |