emoticon_fontify 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -16,32 +16,32 @@ gem 'emoticon_fontify'
16
16
  Then include the stylesheet in your `application.css` manifest.
17
17
 
18
18
  ```
19
- //= 'emoticon_fontify/emoticons.css'
19
+ *= 'emoticon_fontify/emoticons'
20
20
  ```
21
21
 
22
22
  Finally use the helper to fontify emoticons in a string. This would allow fontifying content such as: `Why hello there good sir :O could I interest you in a cup of coffee? :)~D`
23
23
 
24
24
  ```ruby
25
- require EmoticonFontify::EmoticonHelper
25
+ require 'emoticon_fontify'
26
26
 
27
- emoticon_fontify(content)
27
+ EmoticonFontify.emoticon_fontify(h(content))
28
28
  ```
29
29
 
30
30
 
31
31
  ## List Of Emoticons
32
32
 
33
- [':)', ':-)'] => 'icon-emo-happy',
34
- [';)', ';-)'] => 'icon-emo-wink',
35
- [':(', ':-('] => 'icon-emo-unhappy',
36
- [':|', ':-|'] => 'icon-emo-sleep',
37
- ['>:)', '>:-)', '}:)', '}:-)'] => 'icon-emo-devil',
38
- [':O', ':-O', ':0', ':-0'] => 'icon-emo-surprised',
39
- [':P', ':-P'] => 'icon-emo-tongue',
40
- [':)~D', ':-)~D'] => 'icon-emo-coffee',
41
- ['B)', 'B-)'] => 'icon-emo-sunglasses',
42
- [':/', ':-/', ':\\', ':-\\'] => 'icon-emo-displeased',
43
- [':D', ':-D'] => 'icon-emo-grin',
44
- ['>(', '>-('] => 'icon-emo-angry',
45
- ['O:)', 'O:-)', '0:)', '0:-)'] => 'icon-emo-saint',
46
- [';(', ';-(', ":'(", ":'-("] => 'icon-emo-cry',
47
- ['8)', '8-)'] => 'icon-emo-laugh'
33
+ :) :-)
34
+ ;) ;-)
35
+ :( :-(
36
+ :| :-|
37
+ }:) }:-) 3:) 3:-)
38
+ :O :-O :0 :-0
39
+ :P :-P
40
+ :)~D :-)~D
41
+ B) B-)
42
+ :/ :-/ :\ :-\
43
+ :D :-D
44
+ :@ :-@ X( X-(
45
+ O:) O:-) 0:) 0:-)
46
+ ;( ;-(
47
+ 8) 8-)
@@ -1,17 +1,32 @@
1
1
  @font-face {
2
2
  font-family: 'emoticons';
3
- src: url(asset_path('emoticon_fontify/emoticons.eot'));
4
- src: url(asset_path('emoticon_fontify/emoticons.eot?#iefix')) format('embedded-opentype'), url(asset_path('emoticon_fontify/emoticons.woff')) format('woff'), url(asset_path('emoticon_fontify/emoticons.ttf')) format('truetype'), url(asset_path('emoticon_fontify/emoticons.svg#emoticons')) format('svg');
3
+ src: url(asset_path('emoticon_fontify/emoticons.eot', font));
4
+ src: url(asset_path('emoticon_fontify/emoticons.eot?#iefix', font)) format('embedded-opentype'), url(asset_path('emoticon_fontify/emoticons.woff', font)) format('woff'), url(asset_path('emoticon_fontify/emoticons.ttf', font)) format('truetype'), url(asset_path('emoticon_fontify/emoticons.svg#emoticons', font)) format('svg');
5
5
  font-weight: normal;
6
6
  font-style: normal;
7
7
  }
8
+
9
+ [class^="icon-"] {
10
+ display: inline-block;
11
+ width: 1em;
12
+ margin: 0 0.2em;
13
+ font-size: 1em;
14
+ visibility: hidden;
15
+ position: relative;
16
+ }
17
+
8
18
  [class^="icon-"]:before,
9
19
  [class*=" icon-"]:before {
10
20
  font-family: 'emoticons';
11
21
  font-style: normal;
12
22
  font-weight: normal;
23
+ font-size: 1em;
24
+ visibility: visible;
13
25
  speak: none;
14
26
  display: inline-block;
27
+ position: absolute;
28
+ left: 0;
29
+ bottom: 0;
15
30
  text-decoration: inherit;
16
31
  width: 1em;
17
32
  margin-right: 0.2em;
@@ -19,13 +34,10 @@
19
34
  opacity: 0.8;
20
35
  /* fix buttons height, for twitter bootstrap */
21
36
  line-height: 1em;
22
- /* Animation center compensation - magrins should be symmetric */
23
- /* remove if not needed */
24
- margin-left: 0.2em;
25
37
  /* you can be more comfortable with increased icons size */
26
38
  /* font-size: 120%; */
27
39
  /* Uncomment for 3D effect */
28
- /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
40
+ text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3);
29
41
  }
30
42
 
31
43
  .icon-emo-happy:before { content: '\e800'; } /* '' */
@@ -3,20 +3,20 @@ require "emoticon_fontify/engine"
3
3
  module EmoticonFontify
4
4
  def self.emoticons_to_classes
5
5
  @emoticons_to_classes ||= {
6
+ [':)~D', ':-)~D'] => 'icon-emo-coffee',
6
7
  [':)', ':-)'] => 'icon-emo-happy',
7
8
  [';)', ';-)'] => 'icon-emo-wink',
8
9
  [':(', ':-('] => 'icon-emo-unhappy',
9
10
  [':|', ':-|'] => 'icon-emo-sleep',
10
- ['>:)', '>:-)', '}:)', '}:-)'] => 'icon-emo-devil',
11
+ ['}:)', '}:-)', '3:)', '3:-)'] => 'icon-emo-devil',
11
12
  [':O', ':-O', ':0', ':-0'] => 'icon-emo-surprised',
12
13
  [':P', ':-P'] => 'icon-emo-tongue',
13
- [':)~D', ':-)~D'] => 'icon-emo-coffee',
14
14
  ['B)', 'B-)'] => 'icon-emo-sunglasses',
15
15
  [':/', ':-/', ':\\', ':-\\'] => 'icon-emo-displeased',
16
16
  [':D', ':-D'] => 'icon-emo-grin',
17
- ['>(', '>-('] => 'icon-emo-angry',
17
+ [':@', ':-@', 'X-(', 'X('] => 'icon-emo-angry',
18
18
  ['O:)', 'O:-)', '0:)', '0:-)'] => 'icon-emo-saint',
19
- [';(', ';-(', ":'(", ":'-("] => 'icon-emo-cry',
19
+ [';(', ';-('] => 'icon-emo-cry',
20
20
  ['8)', '8-)'] => 'icon-emo-laugh'
21
21
  }
22
22
  end
@@ -34,7 +34,8 @@ module EmoticonFontify
34
34
  end
35
35
 
36
36
  def self.emoticon_fontify(content)
37
- h(content).to_str.gsub(/(#{emoticons.join('|')})/) do |match|
37
+ escaped_emoticons = emoticons.map{ |e| Regexp.escape(e) }
38
+ content.to_str.gsub(/(#{escaped_emoticons.join('|')})/) do |match|
38
39
  '<span class="' + emoticon_to_class(match) + '">' + match + '</span>'
39
40
  end.html_safe if content.present?
40
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emoticon_fontify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2012-12-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Add emoticon font to assets and convert text to unicode symbols.
15
15
  email: simon@sfcgeorge.co.uk
@@ -18,7 +18,6 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
- - app/helpers/emoticon_fontify/emoticon_helper.rb
22
21
  - lib/emoticon_fontify/engine.rb
23
22
  - lib/emoticon_fontify.rb
24
23
  - app/assets/fonts/emoticon_fontify/emoticons.eot
@@ -29,7 +28,7 @@ files:
29
28
  - app/assets/stylesheets/emoticon_fontify/emoticons-codes.css
30
29
  - app/assets/stylesheets/emoticon_fontify/emoticons-ie7-codes.css
31
30
  - app/assets/stylesheets/emoticon_fontify/emoticons-ie7.css
32
- - app/assets/stylesheets/emoticon_fontify/emoticons.css
31
+ - app/assets/stylesheets/emoticon_fontify/emoticons.css.scss
33
32
  homepage: https://github.com/sfcgeorge/emoticon_fontify
34
33
  licenses: []
35
34
  post_install_message:
@@ -1,5 +0,0 @@
1
- module EmoticonFontify
2
- module EmoticonHelper
3
-
4
- end
5
- end