Goals
-----

The trunk/Scripts/Bash/Config directory exists to oraganize pre-rendering configuration scripts.

Description
-----------

Pre-rendering configuration scripts let you customize the way centos-art.sh script renders identity and translation repository entries.  Pre-rendering configuration scripts are render.conf.sh files with render_loadConfig function definition inside.

There is one render.conf.sh file for each pre-rendering configuration entry. Pre-rendering configuration entries can be based both on identity and translation repository entires.  Pre-rendering configuration entries are required for each identity entry, but not for translation entries.

The render.conf.sh identity model
.................................

Inside CentOS Artwork Repository, we consider identity entries to all directories under trunk/Identity directory. Identity entries can be image-based or text-based. When you render image-based identity entries you need to use image-based pre-rendering configuration scripts. Likewise, when you render text-based identity entries you need to use text-based pre-rendering configuration scripts.

Inside identity pre-rendering configuration scripts, image-based pre-rendering configuration scripts look like the following:

#!/bin/bash

function render_loadConfig {

    # Define rendering actions.
    ACTIONS[0]='BASE:renderImage'
    ACTIONS[1]='POST:renderFormats: tif xpm pdf ppm'

}

Inside identity pre-rendering configuration scripts, text-based pre-rendering configuration scripts look like the following:

#!/bin/bash

function render_loadConfig {

    # Define rendering actions.
    ACTIONS[0]='BASE:renderText'
    ACTIONS[1]='POST:formatText: --width=70 --uniform-spacing'

}

When using identity pre-rendering configuration scripts, you can extend both image-based and text-based pre-rendering configuration scripts using image-based and text-based post-rendering actions, respectively.

The render.conf.sh translation model
....................................

Translation pre-rendering configuration scripts take precedence before default translation rendering action. Translation pre-rendering actions are useful when default translation rendering action do not fit itself to translation entry rendering requirements.

The render.conf.sh rendering actions
....................................

Inside both image-based and text-based identity pre-rendering configuration scripts, we use the ACTIONS array variable to define the way centos-art.sh script performs identity rendering.  Identity rendering is organized by one BASE action, and optional POST and LAST rendering actions.

The BASE action specifies what kind of rendering does the centos-art.sh script will perform with the files related to the pre-rendering configuration script. The BASE action is required. Possible values to BASE action are either renderImage or renderText only.

To specify the BASE action you need to set the BASE: string followed by one of the possible values. For example, if you want to render images, consider the following definition of BASE action:

ACTIONS[0]='BASE:renderImage'

Only one BASE action must be specified. If more than one BASE action is specified, the last one is used. If no BASE action is specified at all, an error is triggered and the centos-art.sh script ends its execution.

The POST action specifies which action to apply for each file rendered (at the rendering time). This action is optional. You can set many different POST actions to apply many different actions over the same already rendered file. Possible values to POST action are renderFormats, renderSyslinux, renderGrub, etc.

To specify the POST action, you need to use set the POST: followed by the function name of the action you want to perform.  The exact form depends on your needs. For example, consider the following example to produce xpm, jpg, and tif images, based on already rendered png image, and also organize the produced files in directories named as their own extensions:

ACTIONS[0]='BASE:renderImage'
ACTIONS[1]='POST:renderFormats: xpm jpg tif'
ACTIONS[2]='POST:groupByFormat: png xpm jpg tif'

In the previous example, file organization takes place at the moment of rendering, just after producing the png base file and before going to the next file in the list of files to render. If you don't want to organized the produced files in directories named as their own extensions, just remove the POST:groupByFormat action line:

ACTIONS[0]='BASE:renderImage'
ACTIONS[1]='POST:renderFormats: xpm jpg tif'

The LAST action specifies which actions to apply once the last file in the list of files to process has been rendered. The LAST action is optional. Possible values for LAST actions may be groupByFormat, renderGdmTgz, etc.

     Note see trunk Scripts Bash Functions Render, to know more about possible values for BASE, POST and LAST action definitions.

To specify the LAST action, you need to set the LAST: string followed by the function name of the action you want to perform.  For example, consider the following example if you want to render all files first and organize them later:

ACTIONS[0]='BASE:renderImage'
ACTIONS[1]='POST:renderFormats: xpm jpg tif'
ACTIONS[2]='LAST:groupByformat: png xpm jpg tif'

Usage
-----

Use the following commands to administer both identity and translation pre-rendering configuration scripts:

centos-art config --create='path/to/dir/'

     Use this command to create path/to/dir related pre-rendering configuration script.

centos-art config --edit='path/to/dir/'

     Use this command to edit path/to/dir related pre-rendering configuration script.

centos-art config --read='path/to/dir/'

     Use this command to read path/to/dir related pre-rendering configuration script.

centos-art config --remove='path/to/dir/'

     Use this command to remove path/to/dir related pre-rendering configuration script.

In the commands above, path/to/dir refers to one renderable directory path under trunk/Identity or trunk/Translations structures only.

See also
--------