Blame Identity/Manual/Directories/trunk/Scripts/Functions/Svg.texi

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