<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>piouPiouM&#039;s dev&#187; Archives pour le tag TextMate – piouPiouM&#039;s dev</title>
	<atom:link href="http://pioupioum.fr/tag/textmate/feed/" rel="self" type="application/rss+xml" />
	<link>http://pioupioum.fr</link>
	<description>Bloc-note d&#039;un développeur web</description>
	<lastBuildDate>Fri, 23 Dec 2011 23:41:36 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bundle License Helper pour TextMate</title>
		<link>http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html</link>
		<comments>http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html#comments</comments>
		<pubDate>Thu, 29 Jul 2010 16:29:29 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Outils, trucs et astuces]]></category>
		<category><![CDATA[licence MIT]]></category>
		<category><![CDATA[projet]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=426</guid>
		<description><![CDATA[Parce que j&#8217;en avais ma claque de chercher le texte des licences à ajouter en en-tête de mes sources1, voici un bundle TextMate pour palier à cette répétitive perte de temps.



Table des matières


Installation
Utilisation du bundle
Personnaliser le sélecteur des licences
Corriger le formatage de la licence
Licences supportées
Développement


Installation

Depuis les sources, avec Git

cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/piouPiouM/license-helper.tmbundle.git "License Helper.tmbundle"
osascript [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Parce que j&#8217;en avais ma claque de chercher le texte des licences à ajouter en en-tête de mes sources<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>, voici un <strong><a href="http://pioupioum.fr/tag/textmate/" title="Archives pour le tag TextMate – piouPiouM&#039;s dev">bundle TextMate</a></strong> pour palier à cette répétitive perte de temps.</p>

<p><img src="http://assets1.pioupioum.fr/uploads/2010/07/License-Helper-Textmate-Bundle.png" alt="License Helper Textmate Bundle" title="License Helper Textmate Bundle" width="610" height="385" class="aligncenter size-full wp-image-431" /><span id="more-426"></span></p>

<h2 id="toc">Table des matières</h2>

<ol>
<li><a href="#installer">Installation</a></li>
<li><a href="#usage">Utilisation du bundle</a></li>
<li><a href="#personnaliser">Personnaliser le sélecteur des licences</a></li>
<li><a href="#formatage">Corriger le formatage de la licence</a></li>
<li><a href="#licenses">Licences supportées</a></li>
<li><a href="#developpement">Développement</a></li>
</ol>

<h2 id="installer">Installation</h2>

<h3>Depuis les sources, avec Git</h3>

<pre><code>cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/piouPiouM/license-helper.tmbundle.git "License Helper.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'
</code></pre>

<h3>Depuis les sources, sans Git</h3>

<pre><code>cd ~/Library/Application\ Support/TextMate/Bundles
wget http://github.com/piouPiouM/license-helper.tmbundle/tarball/master
tar zxf license-helper.tmbundle.tar.gz
rm license-helper.tmbundle.tar.gz
mv license-helper.tmbundle "License Helper.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'
</code></pre>

<h3>Téléchargement direct</h3>

<div class="download box">
    <a href="http://github.com/piouPiouM/license-helper.tmbundle/tarball/master" title="Téléchargement depuis les serveurs de GitHub"><span>Télécharger la dernière version du bundle License Helper pour TextMate</span></a>
</div>

<p>Après récupération, décompressez l&#8217;archive, renommez le dossier en <code>License Helper.tmbundle</code>. Acceptez le changement d&#8217;extension. Il ne reste plus qu&#8217;à installer le bundle d&#8217;un double-clic sur le fichier.</p>

<h2 id="usage">Utilisation du bundle</h2>

<p>Utilisez le lanceur <code>license⇥</code> pour <strong>sélectionner une licence</strong> <em>via</em> la boîte de dialogue qui s&#8217;affiche.</p>

<p><div id="attachment_427" class="wp-caption aligncenter" style="width: 349px"><img src="http://assets1.pioupioum.fr/uploads/2010/07/license-helper-textmate-bundle-dialog.png" alt="Choix d&#039;une licence – License Helper Textmate Bundle" title="license-helper-textmate-bundle-dialog" width="339" height="384" class="size-full wp-image-427" /><p class="wp-caption-text">Choix d&#8217;une licence – License Helper Textmate Bundle</p></div></p>

<p>Un bloc de licence est inséré en tant que Snippet. Utilisez la touche de tabulation pour vous déplacez sur les différents placeholders.</p>

<h3>Liste des variables d&#8217;environnement utilisées</h3>

<p>Déclarez dans votre projet les variables d&#8217;environnement qui suivent pour auto-compléter les blocs de licence à insérer&#160;:</p>

<ul>
<li><code>TM_PROJECT_YEAR</code>. L&#8217;année de production. Par défaut&#160;: l&#8217;année courante.</li>
<li><code>TM_PROJECT_COPYRIGHT_HOLDERS</code> ou <code>TM_AUTHOR</code> ou <code>TM_ORGANIZATION_NAME</code>. Les détenteurs du copyright.</li>
<li><code>TM_ORGANIZATION_EMAIL</code>. Adresse mail de l&#8217;organisation détentrice du copyright.</li>
<li><code>TM_PROJECT_DESCRIPTION</code>. Description brève du projet.</li>
</ul>

<p>Notez que les variables sont utilisées en fonction de la licence choisie et qu&#8217;il n&#8217;est pas nécessaire de toutes les renseigner si vous n&#8217;en avez pas l&#8217;usage.</p>

<p>Vous pouvez fixer la licence de votre projet en ajoutant la variable d&#8217;environnement de projet <code>TM_PROJECT_LICENSE</code>. Ainsi, vous n&#8217;aurez plus à la sélectionner.</p>

<h2 id="personnaliser">Personnaliser le sélecteur des licences</h2>

<p>La commande accessible depuis le menu <em>License Helper → Edit licenses order</em> lance l&#8217;édition du fichier de configuration du bundle.<br />
Modifiez l&#8217;ordre des licences déclarées selon vos préférences d&#8217;apparition dans le sélecteur de licences.</p>

<h2 id="formatage">Corriger le formatage de la licence</h2>

<p>Il est possible qu&#8217;avec certains langages, le rendu des blocs de licences ne corresponde pas à vos attentes. Si tel est le cas, définissez votre propre format&#160;:</p>

<ol>
<li>Bundles → Bundle Editor</li>
<li>Dans l&#8217;entrée <strong>License Helper</strong>, créez une nouvelle Preference et donnez-lui le nom du langage.</li>
<li>Remplissez le champ Scope Selector avec le scope approprié – i.e. <code>source.java</code> pour les sources java.</li>
<li>Définissez les shellVariables <code>TM_LICENSE_HELPER_HEADER</code> (début du bloc de commentaire) et <code>TM_LICENSE_HELPER_FOOTER</code> (fin du bloc de commentaire), comme suit&#160;:</li>
</ol>

<pre>{  shellVariables = (
        {   name = 'TM_LICENSE_HELPER_HEADER';
            value = '/*';
        },
        {   name = 'TM_LICENSE_HELPER_FOOTER';
            value = '*/';
        },
    );
}</pre>

<p><strong>Note&#160;:</strong> chacune des lignes de la licence peut être préfixée de la variable <code>TM_LICENSE_HELPER_LINE</code>.</p>

<h2 id="licenses">Licences supportées</h2>

<p>La liste des licences prises en charge par le plugin n&#8217;est pas figée. N&#8217;hésitez pas à me <a href="#developpement">soumettre</a> celles qui vous font défaut.</p>

<ul>
<li><a href="http://www.opensource.org/licenses/agpl-v3.html" title="GNU AFFERO GENERAL PUBLIC LICENSE v3 | Open Source Initiative">Affero GNU Public License 3.0</a></li>
<li><a href="http://www.opensource.org/licenses/apache2.0.php" title="Open Source Initiative OSI - Apache License, Version 2.0:Licensing | Open Source Initiative">Apache license 2.0</a></li>
<li><a href="http://www.cecill.info/" title="CeCILL">CeCILL license</a></li>
<li><a href="http://sam.zoy.org/wtfpl/" title="WTFPL - Do What The Fuck You Want To Public License">Do What The Fuck You Want To Public License</a></li>
<li><a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" title="GNU General Public License v2.0 - GNU Project - Free Software Foundation (FSF)">GNU General Public License version 2</a></li>
<li><a href="http://www.gnu.org/licenses/gpl-3.0.html" title="The GNU General Public License - GNU Project - Free Software Foundation (FSF)">GNU General Public License version 3</a></li>
<li><a href="http://www.gnu.org/licenses/lgpl.html" title="GNU Lesser General Public License - GNU Project - Free Software Foundation (FSF)">GNU Lesser General Public License version 3</a></li>
<li><a href="http://www.opensource.org/licenses/mit-license.html" title="Open Source Initiative OSI - The MIT License:Licensing | Open Source Initiative">MIT license</a></li>
<li><a href="http://www.opensource.org/licenses/bsd-license.php" title="Open Source Initiative OSI - The BSD License:Licensing | Open Source Initiative">New and Simplified BSD licenses</a></li>
<li><a href="http://www.opensource.org/licenses/bsd-license.php" title="Open Source Initiative OSI - The BSD License:Licensing | Open Source Initiative">Original BSD license</a></li>
<li><a href="http://www.opensource.org/licenses/postgresql" title="The PostgreSQL Licence (TPL) | Open Source Initiative">PostgreSQL license</a></li>
</ul>

<h2 id="developpement">Développement</h2>

<p>Distribué sous <a href="http://www.opensource.org/licenses/mit-license.html" title="Open Source Initiative OSI - The MIT License:Licensing | Open Source Initiative">license MIT</a>, le <a href="http://github.com/piouPiouM/license-helper.tmbundle" title="piouPiouM's license-helper.tmbundle at master - GitHub">code source du bundle</a> est accessible sur GitHub.</p>

<p>Une suggestion, une amélioration, une critique ou un bug à me soumettre&#160;? Ça se passe du côté du <a href="http://github.com/piouPiouM/license-helper.tmbundle/issues" title="Issues - piouPiouM/license-helper.tmbundle - GitHub">bugtracker</a> associé.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html' title='TextMate : commande &laquo;&nbsp;Export words&nbsp;&raquo;'>TextMate&#160;: commande &laquo;&nbsp;Export words&nbsp;&raquo;</a></li><li><a href='http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html' title='TextMate : convertir une couleur hexadécimale en notation RGBA'>TextMate&#160;: convertir une couleur hexadécimale en notation RGBA</a></li><li><a href='http://pioupioum.fr/developpement/javascript-array-intersection.html' title='JavaScript : optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles'>JavaScript&#160;: optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles</a></li><li><a href='http://pioupioum.fr/developpement/jslint-console-rhino.html' title='Une console JSLint pour aider vos validations JavaScript'>Une console JSLint pour aider vos validations JavaScript</a></li><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>exception faite des projets pour lesquels j&#8217;utilise un builder qui l&#8217;ajoute comme un grand à ma place.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextMate&#160;: commande &#8220;Export words&#8221;</title>
		<link>http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html</link>
		<comments>http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html#comments</comments>
		<pubDate>Sun, 16 May 2010 14:30:47 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[licence MIT]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=380</guid>
		<description><![CDATA[À l&#8217;intérieur du code source d&#8217;une classe PHP, je souhaite stocker dans un tableau la liste des mots de la version populaire de l&#8217;incontournable texte Lorem ipsum. Jusque là rien de bien sorcier. Mais pour des raisons de lisibilité et de conventions de codage je veux obtenir des lignes formées par un maximum de 72 [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>À l&#8217;intérieur du code source d&#8217;une classe PHP, je souhaite stocker dans un tableau la liste des mots de la version populaire de l&#8217;incontournable texte <em><a href="http://fr.wikipedia.org/wiki/Faux-texte#Lorem_ipsum_.28version_populaire.29" title="Faux-texte - Wikipédia">Lorem ipsum</a></em>. Jusque là rien de bien sorcier. Mais pour des raisons de lisibilité et de conventions de codage je veux obtenir des lignes formées par un maximum de 72 caractères.</p>

<p>Certes je peux <em>m&#8217;amuser</em> à le faire à la main, mais pourquoi me fatiguer quand un langage de script tel que <strong>PHP</strong> me tend la main pour automatiser la procédure&#160;? Et, cerise sur le gâteau, si en plus je peux l&#8217;intégrer à mon éditeur préféré, <a href="http://pioupioum.fr/tag/textmate/" title="Archives pour le tag TextMate – piouPiouM&#039;s dev">TextMate</a>.</p>

<p><div id="attachment_386" class="wp-caption aligncenter" style="width: 458px"><a href="http://assets1.pioupioum.fr/uploads/2010/05/export-words.png"><img src="http://assets1.pioupioum.fr/uploads/2010/05/export-words-448x350.png" alt="Exemple d&#039;action de la commande TextMate Export words" title="TextMate Export words" width="448" height="350" class="size-medium wp-image-386" /></a><p class="wp-caption-text">Exemple d&#8217;action de la commande TextMate Export words</p></div><span id="more-380"></span></p>

<h2>Intégration dans Textmate</h2>

<ol>
<li>Allez dans le menu <span lang="en">Bundles</span> > <span lang="en">Bundle Editor</span> > <span lang="en">Show Bundle Editor</span> puis créez une nouvelle commande à l&#8217;aide de l&#8217;action <span lang="en">New Command</span>.</li>
<li>Donnez à la commande le nom <span lang="en">Export words</span>.</li>
<li>Veillez à ce que <span lang="en">Save</span> soit défini à <span lang="en">Nothing</span>.</li>
<li>Sélectionnez pour <span lang="en">Input</span> les options <span lang="en">Selected Text or Nothing</span>.</li>
<li>Placez <span lang="en">Output</span> à <span lang="en">Replace Selected Text</span>.</li>
<li>Choisissez une <span lang="en">Activation</span> de type <span lang="en">Key Equivalent</span> et définnez un raccourci. J&#8217;ai opté pour la séquence <kbd>⌥⇧W</kbd>.</li>
<li>Laissez vide le champ <span lang="en">Scope Selector</span> afin de pouvoir jouir de la commande depuis n&#8217;importe quel type de fichier et scope.</li>
<li>Enfin, copiez-collez le code ci-dessous dans le champ <span lang="en">Command(s)</span>.</li>
</ol>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">#!/usr/bin/env php -n
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * Export a wrapped representation of the words of a text.
 *
 * Optional parameters in a line that follows the text:
 *      l&lt;size&gt;. The column width. Default: 72.
 *      s&lt;characters&gt;. Characters to remove. Default: punctuation.
 *      o&lt;asc|desc&gt;. Sort order. Default: none.
 */</span>
<span style="color: #666666; font-style: italic;">/*
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2010 Mehdi Kabab &lt;http://pioupioum.fr/&gt;
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the &quot;Software&quot;), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# ***** END LICENSE BLOCK ***** */</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">version_compare</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">PHP_VERSION</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'5.0.0'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'You must have PHP &gt;= 5.0.0!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$lenght</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">72</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// the default column width.</span>
<span style="color: #000088;">$strip</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'\p{P}'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// removes the ponctuation</span>
<span style="color: #000088;">$sort</span>   <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// no sorting</span>
&nbsp;
<span style="color: #000088;">$raw</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'php://filter/read=string.tolower/resource=php://stdin'</span><span style="color: #339933;">,</span>
            FILE_IGNORE_NEW_LINES <span style="color: #339933;">|</span> FILE_SKIP_EMPTY_LINES<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$raw</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_pop</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#^(?:\s{0,}(?:l(?&lt;lenght&gt;\d+)|s(?&lt;strip&gt;.*)|o(?&lt;sort&gt;asc|desc))\s{0,})+$#u'</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lenght'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lenght'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$lenght</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lenght'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strip'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strip'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$strip</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'|'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strip'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sort'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sort'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$sort</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sort'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$raw</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$raw</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Removes punctuation and user characters</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$strip</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$strip</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\#'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$raw</span>   <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#('</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$strip</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">')#u'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Estimating indent</span>
<span style="color: #000088;">$start_index</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_INPUT_START_LINE_INDEX'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$start_index</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_INPUT_START_LINE_INDEX'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YES'</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_SOFT_TABS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$tab</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_repeat</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$tab</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$tab_count</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$start_index</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$extra_spaces</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$start_index</span> <span style="color: #339933;">%</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tabs</span>         <span style="color: #339933;">=</span> <span style="color: #990000;">str_repeat</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tab</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tab_count</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">str_repeat</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$extra_spaces</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tabs_len</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$tab_count</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$extra_spaces</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Extracting words now!</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#\s+#'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trim'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_filter</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_unique</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// removes empty fields</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$sort</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">natsort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$sort</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_reverse</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%s\'%s\''</span><span style="color: #339933;">,</span>
                 <span style="color: #000088;">$tabs</span><span style="color: #339933;">,</span>
                 <span style="color: #990000;">wordwrap</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;', '&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lenght</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$tabs_len</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #006699; font-weight: bold;">$tabs</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">!==</span> <span style="color: #000088;">$start_index</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ltrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;''&quot;</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$words</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<h2>Utilisation de la commande TextMate <strong>Export words</strong></h2>

<p>Sélectionnez le texte à transformer. La transformation du texte se contrôle en ajoutant à la suite une ligne d&#8217;arguments <strong>optionnels</strong>&#160;:</p>

<ul>
<li><strong><code>l&lt;size&gt;</code></strong>. Ajuster la longueur de ligne. Exemple&#160;: <code>l80</code> pour effectuer une coupure à la colonne 80. Défaut&#160;: 72.</li>
<li><strong><code>s&lt;characters&gt;</code></strong>. Exemple&#160;: <code>slorem|ipsum</code> pour exclure les mots <em>lorem</em> et <em>ipsum</em>. Défaut&#160;: toute ponctuation.</li>
<li><strong><code>o&lt;asc|desc&gt;</code></strong>. Trier la sortie selon les ordres <code>asc</code>endant et <code>desc</code>endant. Défaut&#160;: aucun tri n&#8217;est réalisé.</li>
</ul>

<p>Notez que si votre sélection est précédée par une indentation, alors le script va appliquer cette dernière à chacune des lignes générées en se conformant aux options courantes de TextMate&#160;: il générera des espaces si le mode <span lang="en">Soft Tabs</span> est activé. Sinon des tabulations complétées d&#8217;éventuels espaces.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html' title='Bundle License Helper pour TextMate'>Bundle License Helper pour TextMate</a></li><li><a href='http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html' title='TextMate : convertir une couleur hexadécimale en notation RGBA'>TextMate&#160;: convertir une couleur hexadécimale en notation RGBA</a></li><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li><li><a href='http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html' title='PHP : fonction uncamel() pour inverser une notation en CamelCase'>PHP&#160;: fonction uncamel() pour inverser une notation en CamelCase</a></li><li><a href='http://pioupioum.fr/developpement/photon-php-installer-mac-os-x-snow-leopard.html' title='Photon : guide d&#8217;installation sur Mac OS X Snow Leopard'>Photon&#160;: guide d&#8217;installation sur Mac OS X Snow Leopard</a></li></ul>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextMate&#160;: convertir une couleur hexadécimale en notation RGBA</title>
		<link>http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html</link>
		<comments>http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html#comments</comments>
		<pubDate>Thu, 15 Apr 2010 10:19:56 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Outils, trucs et astuces]]></category>
		<category><![CDATA[convertir]]></category>
		<category><![CDATA[couleur]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[licence MIT]]></category>
		<category><![CDATA[rgba]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=367</guid>
		<description><![CDATA[CSS supporte divers formats de description des couleurs, le plus utilisé étant la notation héxadécimale #RRGGBB. L&#8217;introduction du support des couleurs RGBA par CSS 3 a été l&#8217;occasion pour certains de découvrir les notations rgba(255, 255, 255, 1) et sa version sans gestion de l&#8217;opacité rgb(255, 255, 255).

Il faut avouer que si nous disposons d&#8217;une [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>CSS supporte divers formats de description des couleurs, le plus utilisé étant la <strong>notation héxadécimale</strong> <code>#RRGGBB</code>. L&#8217;introduction du support des <a href="http://pioupioum.fr/tag/rgba/" title="Archives pour le tag rgba – piouPiouM&#039;s dev">couleurs RGBA</a> par CSS 3 a été l&#8217;occasion pour certains de découvrir les notations <code>rgba(255, 255, 255, 1)</code> et sa version sans gestion de l&#8217;opacité <code>rgb(255, 255, 255)</code>.</p>

<p>Il faut avouer que si nous disposons d&#8217;une palette d&#8217;outils d&#8217;aide à la saisie de couleurs en notation hexadécimale, il en est rien pour insérer une couleur au format <code>rgb[a]</code>, et cela peut <a href="http://twitter.com/br1o/status/12041847261" title="une réaction sur twitter">agacer</a>. Mais c&#8217;était sans compter sur <a href="http://pioupioum.fr/tag/textmate/" title="Archives pour le tag TextMate – piouPiouM&#039;s dev">TextMate</a>&#160;!<span id="more-367"></span></p>

<h2>Convertir une couleur héxadécimale en notation RGBA</h2>

<p>La commande TextMate <strong>Convert Hex to RGB(A) color</strong> va vous permettre de convertir <em>via</em> le raccourci clavier <kbd>⌘⇧X</kbd> une couleur héxadécimale en son équivalent RGB(A).</p>

<h3>Installation</h3>

<p>Après avoir téléchargé le fichier qui suit, installez la commande d&#8217;un simple double-clique.</p>

<div class="box textmate-command">
    <a title="Télécharger" href="http://assets1.pioupioum.fr/uploads/2010/04/Convert-Hex-to-RGBA-color.tmCommand"><span>Convert Hex to RGB(A) color.tmCommand (4&#160;Ko)</span></a>
</div>

<p>La nouvelle commande est maintenant disponible dans le bundle <strong>Source</strong>.</p>

<p>Pourquoi l&#8217;installer dans le bundle <strong>Source</strong> au lieu du bundle <strong>CSS</strong>&#160;? Parce qu&#8217;elle peut être utile dans d&#8217;autre languages, comme JavaScript et sera ainsi disponible à tout moment, qu&#8217;importe le bundle actif.</p>

<h3>Usage</h3>

<p>Simple d&#8217;utilisation, positionnez-vous sur une couleur et activez la commande pour obtenir son équivalent en notation RGB&#160;:</p>

<pre>#6633ff => rgb(102, 51, 255)
#63F    => rgb(102, 51, 255)</pre>

<p>Ajoutez à une couleur héxadécimale la composante d&#8217;opacité pour remplacer la couleur par sa forme RGBA&#160;:</p>

<pre>#6633FF80 => rgba(102, 51, 255, .50)
#63FA     => rgba(102, 51, 255, .67)
#63F0     => rgba(102, 51, 255, 0)</pre>

<p>Vous pouvez également sélectionner une couleur (avec le sharp <code>#</code> initial) et lancer la convertion. Cela se révèle être particulièrement utile avec une sélection en colonne.</p>

<h3>Code source</h3>

<p>Voici le <a href="http://gist.github.com/366816" title="gist: 366816 - Source code of a TextMate Command- GitHub">code</a> ruby<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> utilisé au sein de la commande.
<script src="http://gist.github.com/366816.js?file=hex2rgba.rb"></script></p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/developpement/jquery-color-plugin-animation-rgba-support.html' title='Du RGBA dans vos animations avec le plugin jQuery Color'>Du RGBA dans vos animations avec le plugin jQuery Color</a></li><li><a href='http://pioupioum.fr/developpement/javascript-detecter-support-rgba.html' title='JavaScript : tester le support des couleurs RGBA'>JavaScript&#160;: tester le support des couleurs RGBA</a></li><li><a href='http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html' title='Bundle License Helper pour TextMate'>Bundle License Helper pour TextMate</a></li><li><a href='http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html' title='TextMate : commande &laquo;&nbsp;Export words&nbsp;&raquo;'>TextMate&#160;: commande &laquo;&nbsp;Export words&nbsp;&raquo;</a></li><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>Toute remarque ou conseil est le bienvenu. Il s&#8217;agit de mon premier script ruby…&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextMate&#160;: bundle CSS, commande &quot;Convertir la sélection en Unicode&quot;</title>
		<link>http://pioupioum.fr/outils-astuces/textmate-css-selection-unicode.html</link>
		<comments>http://pioupioum.fr/outils-astuces/textmate-css-selection-unicode.html#comments</comments>
		<pubDate>Fri, 31 Jul 2009 12:02:35 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Outils, trucs et astuces]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/outils-astuces/textmate-css-selection-unicode.html</guid>
		<description><![CDATA[La propriété CSS content qui s&#8217;utilise de concert avec les sélecteurs :before ou :after, sert essentiellement pour enrichir1 le rendu d&#8217;un contenu HTML existant. Pratique, ajouter un petit en rythme après le texte «&#160;j&#8217;aime coder&#160;» ne pose aucun problème. Cependant, si nous sommes amenés à insérer des caractères non-ASCII ça se complique.


Chercher la représentation Unicode [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>La propriété CSS <code>content</code> qui s&#8217;utilise de concert avec les sélecteurs <code>:before</code> ou <code>:after</code>, sert essentiellement pour enrichir<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> le rendu d&#8217;un contenu HTML existant. Pratique, ajouter un petit <code>en rythme</code> après le texte «&#160;j&#8217;aime coder&#160;» ne pose aucun problème. Cependant, si nous sommes amenés à insérer des caractères non-ASCII ça se complique.
<span id="more-148"></span></p>

<h2 id="unicode">Chercher la représentation Unicode d&#8217;un caractère</h2>

<p>La représentation <a href="http://fr.wikipedia.org/wiki/Unicode" title="Unicode - Wikipédia">Unicode</a> d&#8217;un caractère peut se trouver de plusieurs manières&#160;:</p>

<ul>
<li>en perdant son temps dans la <a href="http://fr.wikipedia.org/wiki/Table_des_caract%C3%A8res_Unicode" title="Table des caractères Unicode - Wikipédia">table des caractères Unicode</a>&#160;;</li>
<li>en s&#8217;aidant d&#8217;une <a href="https://addons.mozilla.org/fr/firefox/addon/5235" title="Unicode Input Tool/Converter – Modules pour Firefox">extension Firefox</a> <em>sic</em>&#160;;</li>
<li><em>via</em> la palette des caractères de Mac OS X, en survolant le caractère à insérer. Son code Unicode s&#8217;affiche alors dans l&#8217;infobulle.</li>
</ul>

<p><div id="attachment_150" class="wp-caption aligncenter" style="width: 500px"><img src="http://assets1.pioupioum.fr/uploads/2009/07/palette-caracteres-unicode.jpg" alt="Palette des caractères" /><p class="wp-caption-text">Affichage de la représentation Unicode d&#8217;un caractère.</p></div></p>

<p>Dans notre feuille de styles, nous insérons le nombre héxadécimal récupéré préfixé du caractère d&#8217;échappement <code>\</code>, sans oublier de supprimer toute pollution comme <code>0x0</code>. Nous obtiendrons ainsi&#160;:</p>

<ul>
<li>&#x266B;&#160;: \266b</li>
<li>&#x2318;&#160;: \2318</li>
</ul>

<p>Ce qui se traduit dans une CSS par&#160;:</p>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\2</span>66b&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>


<p>Nous arrivons à nos fins, mais ne pourrait-on pas accélérer le processus&#160;?</p>

<h2 id="download">Un coup de TextMate</h2>

<p>Rien de plus simple avec TextMate. Téléchargez et décompressez l&#8217;archive qui suit<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup>. Double-cliquez sur le fichier <code>tmCommand</code> pour l&#8217;installer.</p>

<div class="box textmate-command">
    <a href="http://assets1.pioupioum.fr/uploads/2009/07/Convert_Selection_to_Unicode-command.zip" title="Télécharger"><span>Convert Selection to Unicode.tmCommand (659 octets)</span></a>
</div>

<p>La nouvelle commande <strong>Convert Selection to Unicode</strong> est maintenant disponible dans le bundle CSS et s&#8217;active par le raccourci clavier <kbd>&#x2303;&#x21E7;X</kbd> sur tout caractère ou texte sélectionné.</p>

<h2 id="astuce">Une astuce pour la route</h2>

<p>L&#8217;espace insécable (entité caractère <code>&amp;nbsp;</code>) s&#8217;insère au clavier <em>via</em> le raccourci clavier <kbd>&#x2325; + Espace</kbd> et a pour représentation Unicode <code>\A0</code>.</p>

<h3 id="ressources">Ressources</h3>

<ul>
<li>Blog &amp; Blues&#160;: <a href="http://www.blog-and-blues.org/weblog/2005/02/19/391" title="Feuilles de style, jeux et codage de caractères février 2005 Weblog -  Blog &amp; Blues">Feuilles de style, jeux et codage de caractères</a>.</li>
<li>nanoum blog&#160;: <a href="http://www.nanoum.net/blog/5_before_et_after.html" title="before et after - css - nanoum blog">before et after</a></li>
</ul>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/developpement/compass-sprites-supprimer-cache-buster.html' title='Compass : supprimer le cache buster des sprites'>Compass&#160;: supprimer le cache buster des sprites</a></li><li><a href='http://pioupioum.fr/developpement/compass-rvm-multiple-instances.html' title='Instances multiples de Compass avec Ruby Version Manager (rvm)'>Instances multiples de Compass avec Ruby Version Manager (rvm)</a></li><li><a href='http://pioupioum.fr/developpement/photon-php-installer-mac-os-x-snow-leopard.html' title='Photon : guide d&#8217;installation sur Mac OS X Snow Leopard'>Photon&#160;: guide d&#8217;installation sur Mac OS X Snow Leopard</a></li><li><a href='http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html' title='Bundle License Helper pour TextMate'>Bundle License Helper pour TextMate</a></li><li><a href='http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html' title='TextMate : commande &laquo;&nbsp;Export words&nbsp;&raquo;'>TextMate&#160;: commande &laquo;&nbsp;Export words&nbsp;&raquo;</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>et non pour générer un contenu indispensable à la compréhension de la page.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>la commande est également disponible sous la forme d&#8217;un <a href="http://gist.github.com/159193" title="gist: 159193 - GitHub">Gist</a>.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/outils-astuces/textmate-css-selection-unicode.html/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

