Goals
-----

This section exists to organize files related to svg functionality of centos-art.sh script.

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

The svg functionality of centos-art.sh script helps you to maintain scalable vector graphics (SVG) inside repository. For example, suppose you've been working in CentOS default design models under trunk/Identity/Themes/Models/, and you want to set common metadata to all of them, and later remove all unused SVG defintions from *.svg files. Doing so file by file may be a tedious task, so the centos-art.sh script provides the svg functionality to aid you maintain such actions.

Metadata maintainance
.....................

The metadata used is defined by Inkscape 0.46 using the SVG standard markup. The centos-art.sh script replaces everything in-between <metadata and </metadata> tags with a predefined metadata template we've set for this purpose.

The metadata template was created using the metadata information of a file which, using Inkscape 0.46, all metadata fields were set. This created a complete markup representation of how SVG metadata would look like. Later, we replaced every single static value with a translation marker in the form =SOMETEXT=, where SOMETEXT is the name of its main opening tag. Later, we transform the metadata template into a sed replacement set of commads escaping new lines at the end of each line.

With metadata template in place, the centos-art.sh script uses it to create a metadata template instance for the file being processed currently.  The metadata template instance contains the metadata portion of sed replacement commands with translation markers already traduced.  In this action, instance creation, is where we take advantage of automation and generate metadata values like title, date, keywords, source, identifier, and relation dynamically, based on the file path centos-art.sh script is currently creating metadata information for.

With metadata template instance in place, the centos-art.sh script uses it to replace real values inside all .svg files under the current location you're running the centos-art.sh script on.  Default behaviour is to ask user to enter each metadatum required, one by one. If user leaves metadatum empty, by pressing RET key, centos-art.sh uses its default value.

The centos-art.sh script modifies the following metadata:

Title
     Name by which this document is formally known. If no value is set here, centos-art.sh script uses the file name as title.

Date
     Date associated with the creation of this document (YYYY-MM-DD). If no value is set here, centos-art.sh script uses the current date information as in date +%Y-%m-%d.

Creator
     Name of entity primarily responsible for making the content of this document. If no value is set here, centos-art.sh script uses the string The CentOS Project.

Rights
     Name of entity with rights to the intellectual Property of this document. If no value is set here, centos-art.sh script uses the string The CentOS Project.

Publisher
     Name of entity responsible for making this document available. If no value is set here, centos-art.sh script uses the string The CentOS Project.

Identifier
     Unique URI to reference this document. If no value is set here, centos-art.sh script uses the current file path to build the related url that points to current file location inside repository central server.

Source
     Unique URI to reference the source of this document. If no value is set here, centos-art.sh script uses current file path to build the related url that points to current file location inside repository central server.

Relation
     Unique URI to a related document. If no value is set here, centos-art.sh script uses current file path to build the related url that points to current file location inside repository central server.

Language
     Two-letter language tag with optional subtags for the language of this document. (e.g. en-GB). If no value is set here, centos-art.sh script uses the current locale information as in cli_getCurrentLocale function.

Keywords
     The topic of this document as comma-separated key words, prhases, or classifications. If no value is set here, centos-art.sh script uses file path to build

Coverage
     Extent or scope of this document. If no value is set here, centos-art.sh script uses the string The CentOS Project.

Description
     Description about the document. If no value is set here, centos-art.sh script uses uses empty value as default.

Contributors
     People that contributes in the creation/maintainance of the document. If no value is set here, centos-art.sh script uses uses empty value as default.

The License metadatum is not set as a choise, by now. It is fixed Creative Common Attribution Share-Alike 3.0 License (http://creativecommons.org/licenses/by-sa/3.0/). This is done in order to grant license consistency among all SVG files we manage inside CentOS Artwork Repository.

Unused definitions
..................

Many of the no-longer-used gradients, patterns, and markers (more precisely, those which you edited manually) remain in the corresponding palettes and can be reused for new objects. However if you want to optimize your document, use the Vacuum Defs command in File menu. It will remove any gradients, patterns, or markers which are not used by anything in the document, making the file smaller.

If you have one or two couple of files, removing unused definitions using the graphical interface may be enough to you.  In contrast, if you have dozens or even houndreds of scalable vector graphics files to maintain it is not a fun task to use the graphical interface to remove unused definitions editing those files one by one.

To remove unused definitions from several scalable vector graphics files, the centos-art.sh script uses Inkscape's command-line interface, specifically with the --vaccum-defs option.

Usage
-----

centos-art svg --update-metadata='path/to/dir'

centos-art svg --update-metadata='path/to/dir' --filter='regex'
     Use these commands to update metadata information to .svg files under path/to/dir directory.

centos-art svg --vacuum-defs='path/to/dir'

centos-art svg --vacuum-defs='path/to/dir' --filter='regex'
     Use these commands to remove unused definitions inside .svg files under path/to/dir directory.

When you provide --filter='regex' argument, the list of files to process is reduced as specified in regex regular expression. Inside centos-art.sh script, the regex regular expression is used in combination with find command to look for files matching the regular expression path pattern.

     Warning In order for regex regular expression to match a file, the regex regular expresion must match the whole file path not just the file name.

For example, if you want to match all summary.svg files inside path/to/dir, use the .+/summary regular expression. Later, centos-art.sh script uses this value inside ^$REGEX\.svg$ expression in order to build the final regular expression (i.e., ^.+/summary\.svg$) that is evaluated against available file paths inside the list of files to process.

Exceptionally, when you provide --filter='regex' in the way that regex, appended to path/to/dir/ (i.e. path/to/dir/regex), matches a regular file; the centos-art.sh script uses the file matching as only file in the list of files to process.

See also
--------