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

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