Blame Manuals/Filesystem/trunk/Scripts/Bash/Cli/Functions/Svg.texi

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