Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Commit

Permalink
Adding a common class to sprite elements
Browse files Browse the repository at this point in the history
PR from @webfella
  • Loading branch information
Michael committed Mar 8, 2016
1 parent 875213a commit 1d49ab8
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion assets/sprites/emojione.sprites.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[class*=emojione-] {
.emojione {
text-indent: -9999em;
image-rendering: optimizeQuality;
font-size: inherit;
Expand Down
4 changes: 2 additions & 2 deletions assets/sprites/emojione.sprites.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'functions': true
}

[class*=emojione-] {
.emojione {
text-indent:-9999em;
image-rendering: optimizeQuality;
font-size: inherit;
Expand All @@ -24,4 +24,4 @@
.{{name}} {
background-position: (({{px.x}} * 100 / ({{px.total_width}} * (40/41))))#{"%"} (({{px.y}} * 100 / ({{px.total_height}} * (39/40))))#{"%"};
}
{{/items}}
{{/items}}
2 changes: 1 addition & 1 deletion assets/sprites/emojione.sprites.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[class*=emojione-] {
.emojione {
text-indent:-9999em;
image-rendering: optimizeQuality;
font-size: inherit;
Expand Down
4 changes: 2 additions & 2 deletions demos/sprites-png.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ <h3>2. Enable PNG Sprite mode</h3>
$client->imageType = 'png';
$client->sprites = true;</pre>

<p>If you are not using our conversion scripts, PNG sprites can be implemented using the following markup structure. In this example we're using the unicode symbol 1F433 aka <span class="emojione-1f433">&#x1f433;</span></p>
<p>If you are not using our conversion scripts, PNG sprites can be implemented using the following markup structure. In this example we're using the unicode symbol 1F433 aka <span class="emojione emojione-1f433">&#x1f433;</span></p>
<pre class="brush: php">
&lt;span class="emojione-1f433"&gt;
&lt;span class="emojione emojione-1f433"&gt;
&amp;#x1f433;
&lt;/span&gt;</pre>

Expand Down
6 changes: 3 additions & 3 deletions lib/js/emojione.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/php/src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function shortnameToImageCallback($m)
{
if ($this->sprites)
{
return '<span class="emojione-'.$unicode.'" title="'.htmlspecialchars($shortname).'">'.$alt.'</span>';
return '<span class="emojione emojione-'.$unicode.'" title="'.htmlspecialchars($shortname).'">'.$alt.'</span>';
}
else
{
Expand Down Expand Up @@ -317,7 +317,7 @@ public function asciiToImageCallback($m)
{
if ($this->sprites)
{
return $m[2].'<span class="emojione-'.$unicode.'" title="'.htmlspecialchars($shortname).'">'.$alt.'</span>';
return $m[2].'<span class="emojione emojione-'.$unicode.'" title="'.htmlspecialchars($shortname).'">'.$alt.'</span>';
}
else
{
Expand Down Expand Up @@ -421,7 +421,7 @@ public function unicodeToImageCallback($m)
{
if ($this->sprites)
{
return '<span class="emojione-'.$filename.'" title="'.htmlspecialchars($shortname).'">'.$alt.'</span>';
return '<span class="emojione emojione-'.$filename.'" title="'.htmlspecialchars($shortname).'">'.$alt.'</span>';
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions lib/php/test/SpriteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function tearDown()
public function testToImage()
{
$test = 'Hello world! 😄 :smile:';
$expected = 'Hello world! <span class="emojione-1f604" title=":smile:">😄</span> <span class="emojione-1f604" title=":smile:">&#x1f604;</span>';
$expected = 'Hello world! <span class="emojione emojione-1f604" title=":smile:">😄</span> <span class="emojione emojione-1f604" title=":smile:">&#x1f604;</span>';

$this->assertEquals(Emojione::toImage($test), $expected);
}
Expand All @@ -49,7 +49,7 @@ public function testToImage()
public function testShortnameToImage()
{
$test = 'Hello world! 😄 :smile:';
$expected = 'Hello world! 😄 <span class="emojione-1f604" title=":smile:">&#x1f604;</span>';
$expected = 'Hello world! 😄 <span class="emojione emojione-1f604" title=":smile:">&#x1f604;</span>';

$this->assertEquals(Emojione::shortnameToImage($test), $expected);
}
Expand All @@ -62,7 +62,7 @@ public function testShortnameToImage()
public function testUnicodeToImage()
{
$test = 'Hello world! 😄 :smile:';
$expected = 'Hello world! <span class="emojione-1f604" title=":smile:">😄</span> :smile:';
$expected = 'Hello world! <span class="emojione emojione-1f604" title=":smile:">😄</span> :smile:';

$this->assertEquals(Emojione::unicodeToImage($test), $expected);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/python/emojipy/emojipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def replace_unicode(match):

if cls.image_type == 'png':
if cls.sprites:
return '<span class="emojione-%s" title="%s">%s</span>'\
return '<span class="emojione emojione-%s" title="%s">%s</span>'\
% (filename, escape(shortcode), alt)
else:
return '<img class="emojione" alt="%s" src="%s"/>' % (
Expand Down Expand Up @@ -93,7 +93,7 @@ def replace_shortcode(match):
filename = shortcode_replace[shortcode].upper()
if cls.image_type == 'png':
if cls.sprites:
return '<span class="emojione-%s" title="%s">%s</span>'\
return '<span class="emojione emojione-%s" title="%s">%s</span>'\
% (filename, escape(shortcode), alt)
else:
return '<img class="emojione" alt="%s" src="%s"/>' % (
Expand Down Expand Up @@ -168,7 +168,7 @@ def replace_ascii(match):
alt = escape(ascii)
if cls.image_type == 'png':
if cls.sprites:
return '<span class="emojione-%s" title="%s">%s</span>'\
return '<span class="emojione emojione-%s" title="%s">%s</span>'\
% (unicode, escape(ascii), alt)
else:
return '<img class="emojione" alt="%s" src="%s"/>' % (
Expand Down
2 changes: 1 addition & 1 deletion lib/python/emojipy/tests/test_sprite.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def test_unicode_to_image(self):
"""

text = 'Hello world! 😄 :smile:'
expected = 'Hello world! <span class="emojione-1F604" title=":smile:">😄</span> :smile:'
expected = 'Hello world! <span class="emojione emojione-1F604" title=":smile:">😄</span> :smile:'

self.assertEqual(self.emoji.unicode_to_image(text), expected)

0 comments on commit 1d49ab8

Please sign in to comment.