Blame Manuals/Repository/trunk/Scripts/Bash/Functions/Svg.texi

d18d63
@subsection Goals
d18d63
d18d63
This section exists to organize files related to @code{svg}
d18d63
functionality of @file{centos-art.sh} script.
d18d63
d18d63
@subsection Description
d18d63
d18d63
The @code{svg} functionality of @file{centos-art.sh} script helps you
d18d63
to maintain scalable vector graphics (SVG) inside repository. For
d18d63
example, suppose you've been working in CentOS default design models
d18d63
under @file{trunk/Identity/Themes/Models/}, and you want to set common
d18d63
metadata to all of them, and later remove all unused SVG defintions
d18d63
from @samp{*.svg} files. Doing so file by file may be a tedious task,
d18d63
so the @file{centos-art.sh} script provides the @code{svg}
d18d63
functionality to aid you maintain such actions.
d18d63
d18d63
@cindex Metadata maintainance
d18d63
@subsubsection Metadata maintainance
d18d63
d18d63
The metadata used is defined by Inkscape 0.46 using the SVG standard
d18d63
markup. The @file{centos-art.sh} script replaces everything
d18d63
in-between @code{<metadata} and @code{</metadata>} tags with a
d18d63
predefined metadata template we've set for this purpose.
d18d63
d18d63
The metadata template was created using the metadata information of a
d18d63
file which, using Inkscape 0.46, all metadata fields were set. This
d18d63
created a complete markup representation of how SVG metadata would
d18d63
look like. Later, we replaced every single static value with a
d18d63
translation marker in the form @samp{=SOMETEXT=}, where
d18d63
@code{SOMETEXT} is the name of its main opening tag. Later, we
d18d63
transform the metadata template into a sed replacement set of commads
d18d63
escaping new lines at the end of each line.
d18d63
d18d63
With metadata template in place, the @file{centos-art.sh} script uses
d18d63
it to create a metadata template instance for the file being processed
d18d63
currently.  The metadata template instance contains the metadata
d18d63
portion of sed replacement commands with translation markers already
d18d63
traduced.  In this action, instance creation, is where we take
d18d63
advantage of automation and generate metadata values like title, date,
d18d63
keywords, source, identifier, and relation dynamically, based on the
d18d63
file path @file{centos-art.sh} script is currently creating metadata
d18d63
information for.
d18d63
d18d63
With metadata template instance in place, the @file{centos-art.sh}
d18d63
script uses it to replace real values inside all @samp{.svg} files
d18d63
under the current location you're running the @file{centos-art.sh}
d18d63
script on.  Default behaviour is to ask user to enter each metadatum
d18d63
required, one by one. If user leaves metadatum empty, by pressing
d18d63
@key{RET} key, @file{centos-art.sh} uses its default value.
d18d63
d18d63
The @file{centos-art.sh} script modifies the following metadata:
d18d63
d18d63
@table @samp
d18d63
@item Title
d18d63
Name by which this document is formally known. If no value is set
d18d63
here, @file{centos-art.sh} script uses the file name as title.
d18d63
d18d63
@item Date
d18d63
Date associated with the creation of this document (YYYY-MM-DD). If no
d18d63
value is set here, @file{centos-art.sh} script uses the current date
d18d63
information as in @command{date +%Y-%m-%d}.
d18d63
d18d63
@item Creator
d18d63
Name of entity primarily responsible for making the content of this
d18d63
document. If no value is set here, @file{centos-art.sh} script uses
d18d63
the string @samp{The CentOS Project}.
d18d63
d18d63
@item Rights
d18d63
Name of entity with rights to the intellectual Property of this
d18d63
document. If no value is set here, @file{centos-art.sh} script uses
d18d63
the string @samp{The CentOS Project}.
d18d63
d18d63
@item Publisher
d18d63
Name of entity responsible for making this document available. If no
d18d63
value is set here, @file{centos-art.sh} script uses the string
d18d63
@samp{The CentOS Project}.
d18d63
d18d63
@item Identifier
d18d63
Unique URI to reference this document. If no value is set here,
d18d63
@file{centos-art.sh} script uses the current file path to build the
d18d63
related url that points to current file location inside repository
d18d63
central server.
d18d63
d18d63
@item Source
d18d63
Unique URI to reference the source of this document. If no value is
d18d63
set here, @file{centos-art.sh} script uses current file path to build
d18d63
the related url that points to current file location inside repository
d18d63
central server.
d18d63
d18d63
@item Relation
d18d63
Unique URI to a related document. If no value is set here,
d18d63
@file{centos-art.sh} script uses current file path to build the
d18d63
related url that points to current file location inside repository
d18d63
central server.
d18d63
d18d63
@item Language
d18d63
Two-letter language tag with optional subtags for the language of this
d18d63
document. (e.g. @samp{en-GB}). If no value is set here,
d18d63
@file{centos-art.sh} script uses the current locale information as in
d18d63
@code{cli_getCurrentLocale} function.
d18d63
d18d63
@item Keywords
d18d63
The topic of this document as comma-separated key words, prhases, or
d18d63
classifications. If no value is set here, @file{centos-art.sh} script
d18d63
uses file path to build 
d18d63
d18d63
@item Coverage
d18d63
Extent or scope of this document. If no value is set here,
d18d63
@file{centos-art.sh} script uses the string @samp{The CentOS Project}.
d18d63
d18d63
@item Description
d18d63
Description about the document. If no value is set here,
d18d63
@file{centos-art.sh} script uses uses empty value as default.
d18d63
d18d63
@item Contributors
d18d63
People that contributes in the creation/maintainance of the document.
d18d63
If no value is set here, @file{centos-art.sh} script uses uses empty
d18d63
value as default.
d18d63
@end table
d18d63
d18d63
The @samp{License} metadatum is not set as a choise, by now. It is
d18d63
fixed @url{http://creativecommons.org/licenses/by-sa/3.0/, Creative
d18d63
Common Attribution Share-Alike 3.0 License}. This is done in order to
d18d63
grant license consistency among all SVG files we manage inside CentOS
d18d63
Artwork Repository.
d18d63
d18d63
@cindex Unused definitions
d18d63
@subsubsection Unused definitions 
d18d63
d18d63
Many of the no-longer-used gradients, patterns, and markers (more
d18d63
precisely, those which you edited manually) remain in the
d18d63
corresponding palettes and can be reused for new objects. However if
d18d63
you want to optimize your document, use the @samp{Vacuum Defs} command
d18d63
in @samp{File} menu. It will remove any gradients, patterns, or
d18d63
markers which are not used by anything in the document, making the
d18d63
file smaller. 
d18d63
d18d63
If you have one or two couple of files, removing unused definitions
d18d63
using the graphical interface may be enough to you.  In contrast, if
d18d63
you have dozens or even houndreds of scalable vector graphics files to
d18d63
maintain it is not a fun task to use the graphical interface to remove
d18d63
unused definitions editing those files one by one.
d18d63
d18d63
To remove unused definitions from several scalable vector graphics
d18d63
files, the @file{centos-art.sh} script uses Inkscape command-line
d18d63
interface, specifically with the @option{--vaccum-defs} option.
d18d63
d18d63
@subsection Usage
d18d63
d18d63
@table @command
d18d63
@item centos-art svg --update-metadata='path/to/dir'
d18d63
@item centos-art svg --update-metadata='path/to/dir' --filter='regex'
d18d63
Use these commands to update metadata information to @samp{.svg} files
d18d63
under @samp{path/to/dir} directory.
d18d63
d18d63
@item centos-art svg --vacuum-defs='path/to/dir'
d18d63
@item centos-art svg --vacuum-defs='path/to/dir' --filter='regex'
d18d63
Use these commands to remove unused definitions inside @samp{.svg}
d18d63
files under @samp{path/to/dir} directory. 
d18d63
@end table
d18d63
d18d63
When you provide @option{--filter='regex'} argument, the list of files
d18d63
to process is reduced as specified in @samp{regex} regular expression.
d18d63
Inside @file{centos-art.sh} script, the @samp{regex} regular
d18d63
expression is used in combination with @command{find} command to look
d18d63
for files matching the regular expression path pattern.
d18d63
d18d63
@quotation
d18d63
@strong{Warning} In order for @samp{regex} regular expression to match
d18d63
a file, the @samp{regex} regular expresion must match the whole file
d18d63
path not just the file name. 
d18d63
@end quotation
d18d63
d18d63
For example, if you want to match all @file{summary.svg} files inside
d18d63
@file{path/to/dir}, use the @code{.+/summary} regular expression.
d18d63
Later, @file{centos-art.sh} script uses this value inside
d18d63
@code{^$REGEX\.svg$} expression in order to build the final regular
d18d63
expression (i.e., @code{^.+/summary\.svg$}) that is evaluated against
d18d63
available file paths inside the list of files to process.
d18d63
d18d63
Exceptionally, when you provide @option{--filter='regex'} in the way
d18d63
that @samp{regex}, appended to @samp{path/to/dir/} (i.e.
d18d63
@samp{path/to/dir/regex}), matches a regular file; the
d18d63
@file{centos-art.sh} script uses the file matching as only file in the
d18d63
list of files to process. 
d18d63
d18d63
@subsection See also
d18d63
d18d63
@menu
d18d63
* trunk Scripts Bash::
d18d63
* trunk Scripts Bash Functions::
d18d63
@end menu