Blob Blame History Raw
@subsection Goals

This section exists to organize files related to @code{svg}
functionality of @file{centos-art.sh} script.

@subsection Description

The @code{svg} functionality of @file{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 @file{trunk/Identity/Themes/Models/}, and you want to set common
metadata to all of them, and later remove all unused SVG defintions
from @samp{*.svg} files. Doing so file by file may be a tedious task,
so the @file{centos-art.sh} script provides the @code{svg}
functionality to aid you maintain such actions.

@cindex Metadata maintainance
@subsubsection Metadata maintainance

The metadata used is defined by Inkscape 0.46 using the SVG standard
markup. The @file{centos-art.sh} script replaces everything
in-between @code{<metadata} and @code{</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 @samp{=SOMETEXT=}, where
@code{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 @file{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 @file{centos-art.sh} script is currently creating metadata
information for.

With metadata template instance in place, the @file{centos-art.sh}
script uses it to replace real values inside all @samp{.svg} files
under the current location you're running the @file{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
@key{RET} key, @file{centos-art.sh} uses its default value.

The @file{centos-art.sh} script modifies the following metadata:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@cindex Unused definitions
@subsubsection 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 @samp{Vacuum Defs} command
in @samp{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 @file{centos-art.sh} script uses Inkscape command-line
interface, specifically with the @option{--vaccum-defs} option.

@subsection Usage

@table @command
@item centos-art svg --update-metadata='path/to/dir'
@item centos-art svg --update-metadata='path/to/dir' --filter='regex'
Use these commands to update metadata information to @samp{.svg} files
under @samp{path/to/dir} directory.

@item centos-art svg --vacuum-defs='path/to/dir'
@item centos-art svg --vacuum-defs='path/to/dir' --filter='regex'
Use these commands to remove unused definitions inside @samp{.svg}
files under @samp{path/to/dir} directory. 
@end table

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

@quotation
@strong{Warning} In order for @samp{regex} regular expression to match
a file, the @samp{regex} regular expresion must match the whole file
path not just the file name. 
@end quotation

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

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

@subsection See also

@menu
* Filesystem trunk Scripts Bash::
@comment --- Removed(* Filesystem trunk Scripts Bash Functions::) ---
@end menu