Blob Blame History Raw
<?xml version="1.0"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

    <title>CentOS Artwork Repository: 2.71 The trunk/Scripts/Functions/Svg Directory</title>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="description" content="CentOS Artwork Repository: 2.71 The trunk/Scripts/Functions/Svg Directory" />
    <meta name="keywords" content="CentOS Artwork Repository: 2.71 The trunk/Scripts/Functions/Svg Directory" />
    <meta name="resource-type" content="document" />
    <meta name="distribution" content="global" />
    <meta name="generator" content="texi2html 1.76" />
    <meta name="copyright" content="2009-2011 Alain Reguera Delgado" />

    <link href="/home/centos/artwork/trunk/Identity/Manual/repository.css" rel="stylesheet" type="text/css" media="screen projection" />

</head>

<body>

<a name="top" />

<div id="wrap">

    <div id="page-body">

        <div id="content">

<!-- Created on March, 30 2011 by texi2html 1.76 -->
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="repository_77.xhtml#SEC400" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC402" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository.xhtml#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="repository_toc.xhtml#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="repository_abt.xhtml#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Directories-trunk-Scripts-Functions-Svg"></a>
<a name="SEC401"></a>
<h2 class="section"> 2.71 The <tt>`trunk/Scripts/Functions/Svg'</tt> Directory </h2>

<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC402"></a>
<h3 class="subsection"> 2.71.1 Goals </h3>

<p>This section exists to organize files related to <code>svg</code>
functionality of <tt>`centos-art.sh'</tt> script.
</p>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC403"></a>
<h3 class="subsection"> 2.71.2 Description </h3>

<p>The <code>svg</code> functionality of <tt>`centos-art.sh'</tt> script helps you
to maintain scalable vector graphics (SVG) inside repository. For
example, suppose you've been working in CentOS default design models
under <tt>`trunk/Identity/Themes/Models/'</tt>, and you want to set common
metadata to all of them, and later remove all unused SVG defintions
from <samp>`*.svg'</samp> files. Doing so file by file may be a tedious task,
so the <tt>`centos-art.sh'</tt> script provides the <code>svg</code>
functionality to aid you maintain such actions.
</p>
<a name="IDX32"></a>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC404"></a>
<h4 class="subsubsection"> 2.71.2.1 Metadata maintainance </h4>

<p>The metadata used is defined by Inkscape 0.46 using the SVG standard
markup. The <tt>`centos-art.sh'</tt> script replaces everything
in-between <code>&lt;metadata</code> and <code>&lt;/metadata&gt;</code> tags with a
predefined metadata template we've set for this purpose.
</p>
<p>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='</samp>, where
<code>SOMETEXT</code> 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.
</p>
<p>With metadata template in place, the <tt>`centos-art.sh'</tt> 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 <tt>`centos-art.sh'</tt> script is currently creating metadata
information for.
</p>
<p>With metadata template instance in place, the <tt>`centos-art.sh'</tt>
script uses it to replace real values inside all <samp>`.svg'</samp> files
under the current location you're running the <tt>`centos-art.sh'</tt>
script on.  Default behaviour is to ask user to enter each metadatum
required, one by one. If user leaves metadatum empty, by pressing
<kbd>RET</kbd> key, <tt>`centos-art.sh'</tt> uses its default value.
</p>
<p>The <tt>`centos-art.sh'</tt> script modifies the following metadata:
</p>
<dl compact="compact">
<dt> <samp>`Title'</samp></dt>
<dd><p>Name by which this document is formally known. If no value is set
here, <tt>`centos-art.sh'</tt> script uses the file name as title.
</p>
</dd>
<dt> <samp>`Date'</samp></dt>
<dd><p>Date associated with the creation of this document (YYYY-MM-DD). If no
value is set here, <tt>`centos-art.sh'</tt> script uses the current date
information as in <code>date +%Y-%m-%d</code>.
</p>
</dd>
<dt> <samp>`Creator'</samp></dt>
<dd><p>Name of entity primarily responsible for making the content of this
document. If no value is set here, <tt>`centos-art.sh'</tt> script uses
the string <samp>`The CentOS Project'</samp>.
</p>
</dd>
<dt> <samp>`Rights'</samp></dt>
<dd><p>Name of entity with rights to the intellectual Property of this
document. If no value is set here, <tt>`centos-art.sh'</tt> script uses
the string <samp>`The CentOS Project'</samp>.
</p>
</dd>
<dt> <samp>`Publisher'</samp></dt>
<dd><p>Name of entity responsible for making this document available. If no
value is set here, <tt>`centos-art.sh'</tt> script uses the string
<samp>`The CentOS Project'</samp>.
</p>
</dd>
<dt> <samp>`Identifier'</samp></dt>
<dd><p>Unique URI to reference this document. If no value is set here,
<tt>`centos-art.sh'</tt> script uses the current file path to build the
related url that points to current file location inside repository
central server.
</p>
</dd>
<dt> <samp>`Source'</samp></dt>
<dd><p>Unique URI to reference the source of this document. If no value is
set here, <tt>`centos-art.sh'</tt> script uses current file path to build
the related url that points to current file location inside repository
central server.
</p>
</dd>
<dt> <samp>`Relation'</samp></dt>
<dd><p>Unique URI to a related document. If no value is set here,
<tt>`centos-art.sh'</tt> script uses current file path to build the
related url that points to current file location inside repository
central server.
</p>
</dd>
<dt> <samp>`Language'</samp></dt>
<dd><p>Two-letter language tag with optional subtags for the language of this
document. (e.g. <samp>`en-GB'</samp>). If no value is set here,
<tt>`centos-art.sh'</tt> script uses the current locale information as in
<code>cli_getCurrentLocale</code> function.
</p>
</dd>
<dt> <samp>`Keywords'</samp></dt>
<dd><p>The topic of this document as comma-separated key words, prhases, or
classifications. If no value is set here, <tt>`centos-art.sh'</tt> script
uses file path to build 
</p>
</dd>
<dt> <samp>`Coverage'</samp></dt>
<dd><p>Extent or scope of this document. If no value is set here,
<tt>`centos-art.sh'</tt> script uses the string <samp>`The CentOS Project'</samp>.
</p>
</dd>
<dt> <samp>`Description'</samp></dt>
<dd><p>Description about the document. If no value is set here,
<tt>`centos-art.sh'</tt> script uses uses empty value as default.
</p>
</dd>
<dt> <samp>`Contributors'</samp></dt>
<dd><p>People that contributes in the creation/maintainance of the document.
If no value is set here, <tt>`centos-art.sh'</tt> script uses uses empty
value as default.
</p></dd>
</dl>

<p>The <samp>`License'</samp> metadatum is not set as a choise, by now. It is
fixed <a class="www" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Common Attribution Share-Alike 3.0 License</a>. This is done in order to
grant license consistency among all SVG files we manage inside CentOS
Artwork Repository.
</p>
<a name="IDX33"></a>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC405"></a>
<h4 class="subsubsection"> 2.71.2.2 Unused definitions </h4>

<p>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'</samp> command
in <samp>`File'</samp> menu. It will remove any gradients, patterns, or
markers which are not used by anything in the document, making the
file smaller. 
</p>
<p>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.
</p>
<p>To remove unused definitions from several scalable vector graphics
files, the <tt>`centos-art.sh'</tt> script uses Inkscape command-line
interface, specifically with the <samp>`--vaccum-defs'</samp> option.
</p>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC406"></a>
<h3 class="subsection"> 2.71.3 Usage </h3>

<dl compact="compact">
<dt> <code>centos-art svg --update-metadata='path/to/dir'</code></dt>
<dt> <code>centos-art svg --update-metadata='path/to/dir' --filter='regex'</code></dt>
<dd><p>Use these commands to update metadata information to <samp>`.svg'</samp> files
under <samp>`path/to/dir'</samp> directory.
</p>
</dd>
<dt> <code>centos-art svg --vacuum-defs='path/to/dir'</code></dt>
<dt> <code>centos-art svg --vacuum-defs='path/to/dir' --filter='regex'</code></dt>
<dd><p>Use these commands to remove unused definitions inside <samp>`.svg'</samp>
files under <samp>`path/to/dir'</samp> directory. 
</p></dd>
</dl>

<p>When you provide <samp>`--filter='regex''</samp> argument, the list of files
to process is reduced as specified in <samp>`regex'</samp> regular expression.
Inside <tt>`centos-art.sh'</tt> script, the <samp>`regex'</samp> regular
expression is used in combination with <code>find</code> command to look
for files matching the regular expression path pattern.
</p>
<blockquote class="orange icon"><img src="/home/centos/artwork/trunk/Identity/Images/Webenv/icon-admonition-alert.png" alt="Warning" /><h3>Warning</h3><p> In order for <samp>`regex'</samp> regular expression to match
a file, the <samp>`regex'</samp> regular expresion must match the whole file
path not just the file name. 
</p></blockquote>

<p>For example, if you want to match all <tt>`summary.svg'</tt> files inside
<tt>`path/to/dir'</tt>, use the <code>.+/summary</code> regular expression.
Later, <tt>`centos-art.sh'</tt> script uses this value inside
<code>^$REGEX\.svg$</code> expression in order to build the final regular
expression (i.e., <code>^.+/summary\.svg$</code>) that is evaluated against
available file paths inside the list of files to process.
</p>
<p>Exceptionally, when you provide <samp>`--filter='regex''</samp> in the way
that <samp>`regex'</samp>, appended to <samp>`path/to/dir/'</samp> (i.e.
<samp>`path/to/dir/regex'</samp>), matches a regular file; the
<tt>`centos-art.sh'</tt> script uses the file matching as only file in the
list of files to process. 
</p>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC407"></a>
<h3 class="subsection"> 2.71.4 See also </h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="repository_67.xhtml#SEC329">2.60 The <tt>`trunk/Scripts'</tt> Directory</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<div class="page-line white"><hr style="display:none;" /></div>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC406" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_79.xhtml#SEC408" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC401" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Next chapter"> &gt;&gt; </a>]</td>
</tr></table>

            <div class="page-line"><hr style="display:none;" /></div>

        </div>

    </div>

    <div class="page-line white"><hr style="display:none;" /></div>

</div>

</body>

</html>