| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function svg_updateMetadata { |
| |
| local TITLE='' |
| local DATE='' |
| local CREATOR='' |
| local RIGHTS='' |
| local PUBLISHER='' |
| local COVERAGE='' |
| local TEMPLATES='' |
| local KEYWORDS='' |
| local INSTANCE='' |
| |
| |
| |
| TEMPLATES=~/artwork/trunk/Scripts/Bash/Functions/Svg/Tpl |
| |
| |
| |
| |
| cli_printMessage "`gettext "Select the metadata template you want to apply:"`" |
| select TEMPLATE in $(ls $TEMPLATES);do |
| TEMPLATE=$TEMPLATES/$TEMPLATE |
| break |
| done |
| |
| |
| cli_checkFiles $TEMPLATE 'f' '' '--quiet' |
| if [[ $? -ne 0 ]];then |
| cli_printMessage "`gettext "The template file you provided doesn't exist."`" |
| cli_printMessage "$(caller)" 'AsToKnowMoreLine' |
| fi |
| |
| # Define metadata template instance. |
| INSTANCE=${TMPFILE}-$(basename $TEMPLATE) |
| |
| # Define svg document date. |
| DATE=$(date +%Y-%m-%d) |
| |
| # Define svg document creator. |
| CREATOR='CentOS Artwork SIG' |
| |
| # Define svg document rights. |
| RIGHTS=$CREATOR |
| |
| # Define svg document publisher. |
| PUBLISHER='The CentOS Project' |
| |
| # Define svg document coverage. |
| COVERAGE=$PUBLISHER |
| |
| for FILE in $FILES;do |
| |
| # Define svg document title. |
| TITLE=$(basename $FILE) |
| |
| # Define svg document keywords. |
| KEYWORDS=$(echo $FILE | cut -d/ -f6- | tr '/' '\n') |
| |
| # Redifine keywords using SVG standard format. Note that this |
| # information is inserted inside metadata template file. The |
| # metadata template file is a replacement set of sed commands |
| # so we need to escape the new line of each line using one |
| # backslash (\). As we are doing this inside bash, it is |
| # required to escape the backslash with another backslash so |
| # it passes literally. |
| KEYWORDS=$(\ |
| for KEY in $KEYWORDS;do |
| echo " <rdf:li>$KEY</rdf:li>\\" |
| done) |
| |
| # Create metadata template instance. |
| sed -r \ |
| -e "s!=TITLE=!$TITLE!" \ |
| -e "s!=DATE=!$DATE!" \ |
| -e "s!=CREATOR=!$CREATOR!" \ |
| -e "s!=RIGHTS=!$RIGHTS!" \ |
| -e "s!=PUBLISHER=!$PUBLISHER!" \ |
| -e "s!=COVERAGE=!$COVERAGE!" \ |
| -e "/=KEYWORDS=/c\\${KEYWORDS}" \ |
| $TEMPLATE > $INSTANCE |
| sed -i -r -e 's/>$/>\\/g' $INSTANCE |
| |
| # Apply metadata template instance to scalable vector graphic |
| # file. |
| sed -i -f $INSTANCE $FILE |
| |
| # Remove metadata template instance. |
| cli_checkFiles $INSTANCE 'f' '' '--quiet' |
| if [[ $? -eq 0 ]];then |
| rm $INSTANCE |
| fi |
| |
| done \ |
| | awk -f /home/centos/artwork/trunk/Scripts/Bash/Styles/output_forTwoColumns.awk |
| |
| # Check repository changes and ask you to commit them up to |
| # central repository. |
| cli_commitRepoChanges |
| |
| } |
| |