Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!--This manual describes what the CentOS Artwork Repository is and what
can you do inside it.

Copyright C 2009, 2010 Alain Reguera Delgado. All rights
reserved.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled GNU Free
Documentation License.  
-->
<!-- Created on November, 10 2010 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<head>
<title>CentOS Artwork Repository: 3.43 trunk/Scripts/Bash/Functions/Svg</title>

<meta name="description" content="CentOS Artwork Repository: 3.43 trunk/Scripts/Bash/Functions/Svg">
<meta name="keywords" content="CentOS Artwork Repository: 3.43 trunk/Scripts/Bash/Functions/Svg">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
@import "/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/common.css";

a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="repository_45.html#SEC245" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC247" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_3.html#SEC3" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_3.html#SEC3" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_62.html#SEC344" 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.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="repository_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="repository_62.html#SEC344" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="repository_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="trunk-Scripts-Bash-Functions-Svg"></a>
<a name="SEC246"></a>
<h2 class="section"> 3.43 trunk/Scripts/Bash/Functions/Svg </h2>


<a name="SEC247"></a>
<h3 class="subsection"> 3.43.1 Goals </h3>

<p>This section exists to organize files related to <code>svg</code>
functionality of <tt>`centos-art.sh'</tt> script.
</p>

<a name="SEC248"></a>
<h3 class="subsection"> 3.43.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="IDX20"></a>

<a name="SEC249"></a>
<h4 class="subsubsection"> 3.43.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 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="IDX21"></a>

<a name="SEC250"></a>
<h4 class="subsubsection"> 3.43.2.2 Unused definitions </h4>

<p>As SVG files grow they may end up with unused definitions inside. For
example, if you stop using a pattern or gradient, tags used to define
them are considered unused definitions then. Inkscape 0.46 brings the
<samp>`Vaccum Defs'</samp> feature to remove those unused definitions from SVG
files. The <samp>`Vaccum Defs'</samp> feature is available both at graphical
interface and command line interface.
</p>
<p>If you have one or two couple of files, removing unused SVG
definitions using graphical interface may be enough to you.  In
contrast, if you have houndred of files to maintain it is not a fun
task to use the gui interface to remove unused SVG definitions editing
those files one by one.
</p>
<p>To remove unused SVG definitions from several SVG files, the
<tt>`centos-art.sh'</tt> script uses Inkscape's command-line interface,
specifically with the <samp>`--vaccum-defs'</samp> option.
</p>

<a name="SEC251"></a>
<h3 class="subsection"> 3.43.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"><img src="/home/centos/artwork/trunk/Identity/Widgets/Img/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>

<a name="SEC252"></a>
<h3 class="subsection"> 3.43.4 See also </h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="repository_37.html#SEC195">3.34 trunk/Scripts/Bash</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="repository_38.html#SEC200">3.35 trunk/Scripts/Bash/Functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>


<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC251" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_47.html#SEC253" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_3.html#SEC3" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC246" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_62.html#SEC344" title="Next chapter"> &gt;&gt; </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated on <i>November, 10 2010</i> using <a href="http://texi2html.cvshome.org/"><i>texi2html 1.76</i></a>.
 </font>
 <br>

</p>
</body>
</html>