remo 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.md +33 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/lib/remo.rb +60 -0
- data/lib/themes/simplesmileys.yml +49 -0
- data/lib/themes/simplesmileys/Angel.png +0 -0
- data/lib/themes/simplesmileys/Angry.png +0 -0
- data/lib/themes/simplesmileys/Aww.png +0 -0
- data/lib/themes/simplesmileys/Aww_2.png +0 -0
- data/lib/themes/simplesmileys/Blushing.png +0 -0
- data/lib/themes/simplesmileys/Childish.png +0 -0
- data/lib/themes/simplesmileys/Confused.png +0 -0
- data/lib/themes/simplesmileys/Creepy.png +0 -0
- data/lib/themes/simplesmileys/Crying.png +0 -0
- data/lib/themes/simplesmileys/Cthulhu.png +0 -0
- data/lib/themes/simplesmileys/Cute.png +0 -0
- data/lib/themes/simplesmileys/Cute_Winking.png +0 -0
- data/lib/themes/simplesmileys/Devil.png +0 -0
- data/lib/themes/simplesmileys/Gah.png +0 -0
- data/lib/themes/simplesmileys/Gah_2.png +0 -0
- data/lib/themes/simplesmileys/Gasping.png +0 -0
- data/lib/themes/simplesmileys/Greedy.png +0 -0
- data/lib/themes/simplesmileys/Grinning.png +0 -0
- data/lib/themes/simplesmileys/Grinning_Winking.png +0 -0
- data/lib/themes/simplesmileys/Happy.png +0 -0
- data/lib/themes/simplesmileys/Happy_2.png +0 -0
- data/lib/themes/simplesmileys/Happy_3.png +0 -0
- data/lib/themes/simplesmileys/Heart.png +0 -0
- data/lib/themes/simplesmileys/Huh.png +0 -0
- data/lib/themes/simplesmileys/Huh_2.png +0 -0
- data/lib/themes/simplesmileys/Laughing.png +0 -0
- data/lib/themes/simplesmileys/Lips_Sealed.png +0 -0
- data/lib/themes/simplesmileys/Madness.png +0 -0
- data/lib/themes/simplesmileys/Malicious.png +0 -0
- data/lib/themes/simplesmileys/Sick.png +0 -0
- data/lib/themes/simplesmileys/Smiling.png +0 -0
- data/lib/themes/simplesmileys/Speechless.png +0 -0
- data/lib/themes/simplesmileys/Spiteful.png +0 -0
- data/lib/themes/simplesmileys/Stupid.png +0 -0
- data/lib/themes/simplesmileys/Sunglasses.png +0 -0
- data/lib/themes/simplesmileys/Terrified.png +0 -0
- data/lib/themes/simplesmileys/Thumb_Down.png +0 -0
- data/lib/themes/simplesmileys/Thumb_Up.png +0 -0
- data/lib/themes/simplesmileys/Tired.png +0 -0
- data/lib/themes/simplesmileys/Tongue_Out.png +0 -0
- data/lib/themes/simplesmileys/Tongue_Out_Laughing.png +0 -0
- data/lib/themes/simplesmileys/Tongue_Out_Left.png +0 -0
- data/lib/themes/simplesmileys/Tongue_Out_Up.png +0 -0
- data/lib/themes/simplesmileys/Tongue_Out_Up_Left.png +0 -0
- data/lib/themes/simplesmileys/Tongue_Out_Winking.png +0 -0
- data/lib/themes/simplesmileys/Uncertain.png +0 -0
- data/lib/themes/simplesmileys/Uncertain_2.png +0 -0
- data/lib/themes/simplesmileys/Unhappy.png +0 -0
- data/lib/themes/simplesmileys/Winking.png +0 -0
- data/lib/themes/skype.yml +85 -0
- data/lib/themes/skype/0100-smile.png +0 -0
- data/lib/themes/skype/0101-sadsmile.png +0 -0
- data/lib/themes/skype/0102-bigsmile.png +0 -0
- data/lib/themes/skype/0103-cool.png +0 -0
- data/lib/themes/skype/0104-surprised.png +0 -0
- data/lib/themes/skype/0105-wink.png +0 -0
- data/lib/themes/skype/0106-crying.png +0 -0
- data/lib/themes/skype/0107-sweating.png +0 -0
- data/lib/themes/skype/0108-speechless.png +0 -0
- data/lib/themes/skype/0109-kiss.png +0 -0
- data/lib/themes/skype/0110-tongueout.png +0 -0
- data/lib/themes/skype/0111-blush.png +0 -0
- data/lib/themes/skype/0112-wondering.png +0 -0
- data/lib/themes/skype/0113-sleepy.png +0 -0
- data/lib/themes/skype/0114-dull.png +0 -0
- data/lib/themes/skype/0115-inlove.png +0 -0
- data/lib/themes/skype/0116-evilgrin.png +0 -0
- data/lib/themes/skype/0117-talking.png +0 -0
- data/lib/themes/skype/0118-yawn.png +0 -0
- data/lib/themes/skype/0119-puke.png +0 -0
- data/lib/themes/skype/0120-doh.png +0 -0
- data/lib/themes/skype/0121-angry.png +0 -0
- data/lib/themes/skype/0122-itwasntme.png +0 -0
- data/lib/themes/skype/0123-party.png +0 -0
- data/lib/themes/skype/0124-worried.png +0 -0
- data/lib/themes/skype/0125-mmm.png +0 -0
- data/lib/themes/skype/0126-nerd.png +0 -0
- data/lib/themes/skype/0127-lipssealed.png +0 -0
- data/lib/themes/skype/0128-hi.png +0 -0
- data/lib/themes/skype/0129-call.png +0 -0
- data/lib/themes/skype/0130-devil.png +0 -0
- data/lib/themes/skype/0131-angel.png +0 -0
- data/lib/themes/skype/0132-envy.png +0 -0
- data/lib/themes/skype/0133-wait.png +0 -0
- data/lib/themes/skype/0134-bear.png +0 -0
- data/lib/themes/skype/0135-makeup.png +0 -0
- data/lib/themes/skype/0136-giggle.png +0 -0
- data/lib/themes/skype/0137-clapping.png +0 -0
- data/lib/themes/skype/0138-thinking.png +0 -0
- data/lib/themes/skype/0139-bow.png +0 -0
- data/lib/themes/skype/0140-rofl.png +0 -0
- data/lib/themes/skype/0141-whew.png +0 -0
- data/lib/themes/skype/0142-happy.png +0 -0
- data/lib/themes/skype/0143-smirk.png +0 -0
- data/lib/themes/skype/0144-nod.png +0 -0
- data/lib/themes/skype/0145-shake.png +0 -0
- data/lib/themes/skype/0146-punch.png +0 -0
- data/lib/themes/skype/0147-emo.png +0 -0
- data/lib/themes/skype/0148-yes.png +0 -0
- data/lib/themes/skype/0149-no.png +0 -0
- data/lib/themes/skype/0150-handshake.png +0 -0
- data/lib/themes/skype/0151-skype.png +0 -0
- data/lib/themes/skype/0152-heart.png +0 -0
- data/lib/themes/skype/0153-brokenheart.png +0 -0
- data/lib/themes/skype/0154-mail.png +0 -0
- data/lib/themes/skype/0155-flower.png +0 -0
- data/lib/themes/skype/0156-rain.png +0 -0
- data/lib/themes/skype/0157-sun.png +0 -0
- data/lib/themes/skype/0158-time.png +0 -0
- data/lib/themes/skype/0159-music.png +0 -0
- data/lib/themes/skype/0160-movie.png +0 -0
- data/lib/themes/skype/0161-phone.png +0 -0
- data/lib/themes/skype/0162-coffee.png +0 -0
- data/lib/themes/skype/0163-pizza.png +0 -0
- data/lib/themes/skype/0164-cash.png +0 -0
- data/lib/themes/skype/0165-muscle.png +0 -0
- data/lib/themes/skype/0166-cake.png +0 -0
- data/lib/themes/skype/0167-beer.png +0 -0
- data/lib/themes/skype/0168-drink.png +0 -0
- data/lib/themes/skype/0169-dance.png +0 -0
- data/lib/themes/skype/0170-ninja.png +0 -0
- data/lib/themes/skype/0171-star.png +0 -0
- data/lib/themes/skype/0172-mooning.png +0 -0
- data/lib/themes/skype/0173-middlefinger.png +0 -0
- data/lib/themes/skype/0174-bandit.png +0 -0
- data/lib/themes/skype/0175-drunk.png +0 -0
- data/lib/themes/skype/0176-smoke.png +0 -0
- data/lib/themes/skype/0177-toivo.png +0 -0
- data/lib/themes/skype/0178-rock.png +0 -0
- data/lib/themes/skype/0179-headbang.png +0 -0
- data/lib/themes/skype/0180-bug.png +0 -0
- data/lib/themes/skype/0181-fubar.png +0 -0
- data/lib/themes/skype/0182-poolparty.png +0 -0
- data/lib/themes/skype/0183-swear.png +0 -0
- data/lib/themes/skype/0184-tmi.png +0 -0
- data/lib/themes/skype/0185-heidy.png +0 -0
- data/lib/themes/skype/0186-myspace.png +0 -0
- data/test/helper.rb +10 -0
- data/test/test_remo.rb +58 -0
- metadata +212 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Jordan Bracco <jordan@bracco.name>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
rEmo - ruby emoticons parser
|
2
|
+
============================
|
3
|
+
|
4
|
+
rEmo transforms ASCII-emoticons to HTML.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
gem install remo
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
First you need to copy the themes in your project, for example, in irb:
|
13
|
+
|
14
|
+
Remo.copy!('public/images/emoticons')
|
15
|
+
|
16
|
+
It will copy the themes in `pwd`/public/images/emoticons/ ...
|
17
|
+
|
18
|
+
And, parse :
|
19
|
+
|
20
|
+
Remo.new(string).to_html
|
21
|
+
|
22
|
+
See the [rdoc][2] for advanced usage.
|
23
|
+
|
24
|
+
## Themes
|
25
|
+
|
26
|
+
Two themes are bundled into rEmo : [simplesmileys][3] and [skype][4]. You can preview the themes on the [homepage][1].
|
27
|
+
|
28
|
+
A theme is a YAML file of regexps->image name. You can create one, but it's not recommended for your mental health (regexps sucks!).
|
29
|
+
|
30
|
+
[1]: http://webs.github.com/remo/
|
31
|
+
[2]: http://rdoc.info/projects/webs/remo/
|
32
|
+
[3]: http://simplesmileys.org/
|
33
|
+
[4]: http://www.skype.com/intl/en/allfeatures/emoticons/
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "remo"
|
8
|
+
gem.summary = %Q{ruby emoticons parser}
|
9
|
+
gem.description = %Q{Parses a string and add Emoticons in it.}
|
10
|
+
gem.email = "jordan@bracco.name"
|
11
|
+
gem.homepage = "http://github.com/webs/remo"
|
12
|
+
gem.authors = ["Jordan Bracco"]
|
13
|
+
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |test|
|
23
|
+
test.libs << 'lib' << 'test'
|
24
|
+
test.pattern = 'test/**/test_*.rb'
|
25
|
+
test.verbose = true
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'rcov/rcovtask'
|
30
|
+
Rcov::RcovTask.new do |test|
|
31
|
+
test.libs << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
task :rcov do
|
37
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
task :test => :check_dependencies
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "remo #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/remo.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'yaml'
|
3
|
+
require 'fileutils'
|
4
|
+
class Remo
|
5
|
+
attr_reader :options, :emoticons, :string
|
6
|
+
|
7
|
+
# Initialize rEmo.
|
8
|
+
#
|
9
|
+
# +string+: the string to rEmotize!
|
10
|
+
#
|
11
|
+
# +options+: hash of options:
|
12
|
+
# - theme: the theme to use. Default is 'simplesmileys'
|
13
|
+
# - images_path: the path for the images. Default is '/images/emoticons/'
|
14
|
+
# - extras: Add more emoticons 'on the fly'. Hash of regexp => image. Default is an empty hash.
|
15
|
+
def initialize(string, options={})
|
16
|
+
options[:theme] ||= "simplesmileys"
|
17
|
+
options[:images_path] ||= "/images/emoticons/"
|
18
|
+
options[:extras] ||= {}
|
19
|
+
@string, @options = string, options
|
20
|
+
load_theme
|
21
|
+
end
|
22
|
+
|
23
|
+
# Converts all emoticons in +string+ to HTML-image tags.
|
24
|
+
def to_html
|
25
|
+
@emoticons.each do |regexp, image|
|
26
|
+
@string.gsub!(Regexp.new("(^|\s)(#{regexp})(\s|$)"), " <img src='#{@options[:images_path]}#{@options[:theme]}/#{image}'/> ")
|
27
|
+
end
|
28
|
+
@options[:extras].each do |regexp, image|
|
29
|
+
@string.gsub!(Regexp.new("(^|\s)(#{regexp})(\s|$)"), " <img src='#{@options[:images_path]}extras/#{image}'/> ")
|
30
|
+
end
|
31
|
+
@string
|
32
|
+
end
|
33
|
+
|
34
|
+
# Converts all emoticons in +string+ to Textile-image tags.
|
35
|
+
def to_textile
|
36
|
+
@emoticons.each do |regexp, image|
|
37
|
+
@string.gsub!(Regexp.new("(^|\s)(#{regexp})(\s|$)"), " !#{@options[:images_path]}#{@options[:theme]}/#{image}! ")
|
38
|
+
end
|
39
|
+
@options[:extras].each do |regexp, image|
|
40
|
+
@string.gsub!(Regexp.new("(^|\s)(#{regexp})(\s|$)"), " !#{@options[:images_path]}extras/#{image}! ")
|
41
|
+
end
|
42
|
+
@string
|
43
|
+
end
|
44
|
+
|
45
|
+
# Copy the themes to +directory+ (default is public/images/emoticons)
|
46
|
+
def self.copy!(directory='public/images/emoticons/')
|
47
|
+
dir = "#{Dir.pwd}/#{directory}"
|
48
|
+
FileUtils.cp_r "#{::File.expand_path(::File.dirname(__FILE__))}/themes/", dir
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def load_theme
|
53
|
+
file = "#{::File.expand_path(::File.dirname(__FILE__))}/themes/#{@options[:theme]}.yml"
|
54
|
+
if File.exists?(file)
|
55
|
+
@emoticons = YAML.load(File.read(file))
|
56
|
+
else
|
57
|
+
raise "Theme '#{@options[:theme]}' not found!"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Default rEmo theme - http://simplesmileys.org/
|
2
|
+
"((0|O|o)(:\)|:-\))|\(A\))": "Angel.png"
|
3
|
+
"(:@|:-@|\):\()": "Angry.png"
|
4
|
+
"((\'|\*|\°)(w|W)(\'|\*|\°)|(:\})|(:-\}))": "Aww.png"
|
5
|
+
"(\^(w|W)\^)": "Aww_2.png"
|
6
|
+
"(:(\"|')>)": "Blushing.png"
|
7
|
+
"((:|:-)(C|c))": "Childish.png"
|
8
|
+
"((:|:-)(S|s))": "Confused.png"
|
9
|
+
"((:|:-)E)": "Creepy.png"
|
10
|
+
"(:['\"*]-?[\(\[C]|='\()": "Crying.png"
|
11
|
+
"8(-|)E": "Cthulhu.png"
|
12
|
+
"((:|:-)3)": "Cute.png"
|
13
|
+
"((;|;-)3)": "Cute_Winking.png"
|
14
|
+
"((>(:|:-)\)|\(6\)))": "Devil.png"
|
15
|
+
"(>(_|__|)<)": "Gah.png"
|
16
|
+
"(>(\.|,)<)": "Gah_2.png"
|
17
|
+
"((:|:-|=)(0|O|o))": "Gasping.png"
|
18
|
+
"(\$(\)|-\)))": "Greedy.png"
|
19
|
+
"((:|:-|=)D)": "Grinning.png"
|
20
|
+
"((;|;-)D)": "Grinning_Winking.png"
|
21
|
+
"(^^)": "Happy.png"
|
22
|
+
"(^(-|_|--|__)^)": "Happy_2.png"
|
23
|
+
"(^(\.|,)^)": "Happy_3.png"
|
24
|
+
"(<3|\(L\))": "Heart.png"
|
25
|
+
#"": "Huh.png"
|
26
|
+
"((O|0)(\.|_|,|__)o)": "Huh_2.png"
|
27
|
+
"((x|X)(-|)D)": "Laughing.png"
|
28
|
+
"((:|:-)(x|X))": "Lips_Sealed.png"
|
29
|
+
"8(-|)D": "Madness.png"
|
30
|
+
"((\)|\])(:|:-)D)": "Malicious.png"
|
31
|
+
"((:|:-)&)": "Sick.png"
|
32
|
+
"(((:|=|:-)(\)|\])|\(:))": "Smiling.png"
|
33
|
+
"((:|:-)(I|\||l))": "Speechless.png"
|
34
|
+
"((\)|\])(:|:-)\))": "Spiteful.png"
|
35
|
+
"(8(-|)\))": "Stupid.png"
|
36
|
+
"(B(-|)\))": "Sunglasses.png"
|
37
|
+
"(D(-|):)": "Terrified.png"
|
38
|
+
"((-|--)(.|_|__|___)(-|--))": "Tired.png"
|
39
|
+
"((:|:-|=)(P|p))": "Tongue_Out.png"
|
40
|
+
"((x|X)(-|)P)": "Tongue_Out_Laughing.png"
|
41
|
+
"((:|:-)b)": "Tongue_Out_Left.png"
|
42
|
+
"((:|:-)q)": "Tongue_Out_Up.png"
|
43
|
+
"((:|:-)d)": "Tongue_Out_Up_Left.png"
|
44
|
+
"((;|;-)(P|p))": "Tongue_Out_Winking.png"
|
45
|
+
"((\:|:-)(\/|\\\))": "Uncertain.png"
|
46
|
+
"(((:|:-|=)(\[|\()|\):))": "Unhappy.png"
|
47
|
+
"(((;|;-)(\]|\))|\(;))": "Winking.png"
|
48
|
+
"(\(Y\))": "Thumb_Up.png"
|
49
|
+
"(\(N\))": "Thumb_Down.png"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# Skype emoticons - http://www.skype.com/intl/en/allfeatures/emoticons/
|
2
|
+
"(:\)|:-\)|=\)|:=\)|\^\^)": "0100-smile.png"
|
3
|
+
"(:\(|:-\()": "0101-sadsmile.png"
|
4
|
+
"(:d|:-d|:D|:-D)": "0102-bigsmile.png"
|
5
|
+
"(8-\)|8\))": "0103-cool.png"
|
6
|
+
"(:o|:O|:-o|:-O)": "0104-surprised.png"
|
7
|
+
"(;\)|;-\)|;=\))": "0105-wink.png"
|
8
|
+
"(:\'\(|:’\(|\(T_T\))": "0106-crying.png"
|
9
|
+
"(\(:\|)": "0107-sweating.png"
|
10
|
+
"(:\||:-\|)": "0108-speechless.png"
|
11
|
+
"(:\*|:-\*)": "0109-kiss.png"
|
12
|
+
"(:p|:P|:-p|:-P)": "0110-tongueout.png"
|
13
|
+
"(:\$|:-\$)": "0111-blush.png"
|
14
|
+
"(:\^\))": "0112-wondering.png"
|
15
|
+
"(\|-\))": "0113-sleepy.png"
|
16
|
+
"(\|-\()": "0114-dull.png"
|
17
|
+
"(\<3|\(H\))": "0152-heart.png"
|
18
|
+
"(\(love\)|\(L\))": "0115-inlove.png"
|
19
|
+
"(\]:\))": "0116-evilgrin.png"
|
20
|
+
"(\(talk\))": "0117-talking.png"
|
21
|
+
"(\(yawn\))": "0118-yawn.png"
|
22
|
+
"(\(puke\)|:\&|:-\&)": "0119-puke.png"
|
23
|
+
"(\(doh\)|\(toh\))": "0120-doh.png"
|
24
|
+
"(:\@|:-\@)": "0121-angry.png"
|
25
|
+
"(\(wasntme\))": "0122-itwasntme.png"
|
26
|
+
"(\(party\))": "0123-party.png"
|
27
|
+
"(:S|:-S|:-s|:s)": "0124-worried.png"
|
28
|
+
"(\(mm\)|\(mmm\))": "0125-mmm.png"
|
29
|
+
"(8-\|)": "0126-nerd.png"
|
30
|
+
"(:x|:X|:-X|:-x)": "0127-lipssealed.png"
|
31
|
+
"(\(wave\)|\(hi\))": "0128-hi.png"
|
32
|
+
"(\(call\))": "0129-call.png"
|
33
|
+
"(\(devil\)|:>|:->)": "0130-devil.png"
|
34
|
+
"(\(\^\.\^\)|:angel:|\(ange\)|:ange:|\(angel\))": "0131-angel.png"
|
35
|
+
"(\(wait\))": "0133-wait.png"
|
36
|
+
"(\(bear\)|\(ourson\))": "0134-bear.png"
|
37
|
+
"(\(makeup\))": "0135-makeup.png"
|
38
|
+
"(\(chuckle\))": "0136-giggle.png"
|
39
|
+
"(\(clap\))": "0137-clapping.png"
|
40
|
+
"(\(think\)|:-\?|:\?)": "0138-thinking.png"
|
41
|
+
"(\(bow\))": "0139-bow.png"
|
42
|
+
"(\(rofl\)|xD|mdr)": "0140-rofl.png"
|
43
|
+
"(\(whew\)|\(phew\))": "0141-whew.png"
|
44
|
+
"(\(happy\))": "0142-happy.png"
|
45
|
+
"(\(smirk\))": "0143-smirk.png"
|
46
|
+
"(\(nod\))": "0144-nod.png"
|
47
|
+
"(\(shake\))": "0145-shake.png"
|
48
|
+
"(\(punch\))": "0146-punch.png"
|
49
|
+
"(\(emo\))": "0147-emo.png"
|
50
|
+
"(\(Y\)|\(y\)|\(ok\)|\(yes\))": "0148-yes.png"
|
51
|
+
"(\(N\)|\(n\)|\(no\))": "0149-no.png"
|
52
|
+
"(\(handshake\))": "0150-handshake.png"
|
53
|
+
"(\(U\)|\(u\))": "0153-brokenheart.png"
|
54
|
+
"(\(m\)|\(mail\))": "0154-mail.png"
|
55
|
+
"(\(f\)|\(F\)|\(flower\))": "0155-flower.png"
|
56
|
+
"(\(rain\))": "0156-rain.png"
|
57
|
+
"(\(sun\))": "0157-sun.png"
|
58
|
+
"(\(O\)|\(o\))": "0158-time.png"
|
59
|
+
"(\(music\))": "0159-music.png"
|
60
|
+
"(\(~\)|\(movie\))": "0160-movie.png"
|
61
|
+
"(\(phone\))": "0161-phone.png"
|
62
|
+
"(\(coffee\)|\(cafe\))": "0162-coffee.png"
|
63
|
+
"(\(pi\)|\(pizza\))": "0163-pizza.png"
|
64
|
+
"(\(cash\)|\($\)|\(€\))": "0164-cash.png"
|
65
|
+
"(\(flex\)|\(muscle\))": "0165-muscle.png"
|
66
|
+
"(\(\^\)|\(cake\))": "0166-cake.png"
|
67
|
+
"(\(beer\))": "0167-beer.png"
|
68
|
+
"(\(drink\)|\(D\)|\(d\))": "0168-drink.png"
|
69
|
+
"(\\o\/)": "0169-dance.png"
|
70
|
+
"(\(ninja\))": "0170-ninja.png"
|
71
|
+
"(\(\*\))": "0171-star.png"
|
72
|
+
"(\(mooning\))": "0172-mooning.png"
|
73
|
+
"(\(finger\))": "0173-middlefinger.png"
|
74
|
+
"(\(bandit\))": "0174-bandit.png"
|
75
|
+
"(\(drunk\))": "0175-drunk.png"
|
76
|
+
"(\(smoke\)|\(ci\))": "0176-smoke.png"
|
77
|
+
"(\(toivo\))": "0177-toivo.png"
|
78
|
+
"(\(rock\))": "0178-rock.png"
|
79
|
+
"(\(headbang\)|\(banghead\)|\(bh\))": "0179-headbang.png"
|
80
|
+
"(\(poolparty\)|\(hrv\)|\(pool\))": "0182-poolparty.png"
|
81
|
+
"(\(swear\))": "0183-swear.png"
|
82
|
+
"(\(bug\))": "0180-bug.png"
|
83
|
+
"(\(fugbar\))": "0181-fubar.png"
|
84
|
+
"(\(tmi\))": "0184-tmi.png"
|
85
|
+
"(\(heidy\))": "0185-heidy.png"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/helper.rb
ADDED
data/test/test_remo.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestRemo < Test::Unit::TestCase
|
4
|
+
context 'new' do
|
5
|
+
should 'have default options' do
|
6
|
+
assert_equal Remo.new("hello").options, {:theme => 'simplesmileys', :images_path => '/images/emoticons/', :extras => {}}
|
7
|
+
end
|
8
|
+
|
9
|
+
should 'load the theme' do
|
10
|
+
assert_equal Remo.new("hello").emoticons, YAML.load(File.read("#{::File.expand_path(::File.dirname(__FILE__))}/../lib/themes/simplesmileys.yml"))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'to_html' do
|
15
|
+
should "transform ascii emoticons" do
|
16
|
+
assert_equal Remo.new("This test sucks a little bit :) ...").to_html, "This test sucks a little bit <img src='/images/emoticons/simplesmileys/Smiling.png'/> ..."
|
17
|
+
end
|
18
|
+
|
19
|
+
should "transform ascii emoticons with another theme" do
|
20
|
+
assert_equal Remo.new("This test sucks a little bit :) ...", {:theme=>'skype'}).to_html, "This test sucks a little bit <img src='/images/emoticons/skype/0100-smile.png'/> ..."
|
21
|
+
end
|
22
|
+
|
23
|
+
should "change the smiley path if options[:images_path] is specified" do
|
24
|
+
assert_equal Remo.new("This test sucks a little bit :) ...", {:images_path=>'/hello/'}).to_html, "This test sucks a little bit <img src='/hello/simplesmileys/Smiling.png'/> ..."
|
25
|
+
end
|
26
|
+
|
27
|
+
should "transform ascii extras emoticons" do
|
28
|
+
assert_equal Remo.new("This test sucks a little bit :helloworld: ...", {:extras=>{"(:helloworld:)"=>'helloworld.png'}}).to_html, "This test sucks a little bit <img src='/images/emoticons/extras/helloworld.png'/> ..."
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'to_textile' do
|
33
|
+
should "transform ascii emoticons" do
|
34
|
+
assert_equal Remo.new("This test sucks a little bit :) ...").to_textile, "This test sucks a little bit !/images/emoticons/simplesmileys/Smiling.png! ..."
|
35
|
+
end
|
36
|
+
|
37
|
+
should "transform ascii emoticons with another theme" do
|
38
|
+
assert_equal Remo.new("This test sucks a little bit :) ...", {:theme=>'skype'}).to_textile, "This test sucks a little bit !/images/emoticons/skype/0100-smile.png! ..."
|
39
|
+
end
|
40
|
+
|
41
|
+
should "change the smiley path if options[:images_path] is specified" do
|
42
|
+
assert_equal Remo.new("This test sucks a little bit :) ...", {:images_path=>'/hello/'}).to_textile, "This test sucks a little bit !/hello/simplesmileys/Smiling.png! ..."
|
43
|
+
end
|
44
|
+
|
45
|
+
should "transform ascii extras emoticons" do
|
46
|
+
assert_equal Remo.new("This test sucks a little bit :helloworld: ...", {:extras=>{"(:helloworld:)"=>'helloworld.png'}}).to_textile, "This test sucks a little bit !/images/emoticons/extras/helloworld.png! ..."
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'copy!' do
|
51
|
+
should 'copy in the right directory' do
|
52
|
+
FileUtils.mkdir 'tmp'
|
53
|
+
Remo.copy!('tmp/emoticons')
|
54
|
+
assert_equal Dir.entries("#{::File.expand_path(::File.dirname(__FILE__))}/../lib/themes/"), Dir.entries("tmp/emoticons/")
|
55
|
+
FileUtils.rm_r 'tmp'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: remo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jordan Bracco
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-13 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thoughtbot-shoulda
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: Parses a string and add Emoticons in it.
|
26
|
+
email: jordan@bracco.name
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.md
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- lib/remo.rb
|
42
|
+
- lib/themes/simplesmileys.yml
|
43
|
+
- lib/themes/simplesmileys/Angel.png
|
44
|
+
- lib/themes/simplesmileys/Angry.png
|
45
|
+
- lib/themes/simplesmileys/Aww.png
|
46
|
+
- lib/themes/simplesmileys/Aww_2.png
|
47
|
+
- lib/themes/simplesmileys/Blushing.png
|
48
|
+
- lib/themes/simplesmileys/Childish.png
|
49
|
+
- lib/themes/simplesmileys/Confused.png
|
50
|
+
- lib/themes/simplesmileys/Creepy.png
|
51
|
+
- lib/themes/simplesmileys/Crying.png
|
52
|
+
- lib/themes/simplesmileys/Cthulhu.png
|
53
|
+
- lib/themes/simplesmileys/Cute.png
|
54
|
+
- lib/themes/simplesmileys/Cute_Winking.png
|
55
|
+
- lib/themes/simplesmileys/Devil.png
|
56
|
+
- lib/themes/simplesmileys/Gah.png
|
57
|
+
- lib/themes/simplesmileys/Gah_2.png
|
58
|
+
- lib/themes/simplesmileys/Gasping.png
|
59
|
+
- lib/themes/simplesmileys/Greedy.png
|
60
|
+
- lib/themes/simplesmileys/Grinning.png
|
61
|
+
- lib/themes/simplesmileys/Grinning_Winking.png
|
62
|
+
- lib/themes/simplesmileys/Happy.png
|
63
|
+
- lib/themes/simplesmileys/Happy_2.png
|
64
|
+
- lib/themes/simplesmileys/Happy_3.png
|
65
|
+
- lib/themes/simplesmileys/Heart.png
|
66
|
+
- lib/themes/simplesmileys/Huh.png
|
67
|
+
- lib/themes/simplesmileys/Huh_2.png
|
68
|
+
- lib/themes/simplesmileys/Laughing.png
|
69
|
+
- lib/themes/simplesmileys/Lips_Sealed.png
|
70
|
+
- lib/themes/simplesmileys/Madness.png
|
71
|
+
- lib/themes/simplesmileys/Malicious.png
|
72
|
+
- lib/themes/simplesmileys/Sick.png
|
73
|
+
- lib/themes/simplesmileys/Smiling.png
|
74
|
+
- lib/themes/simplesmileys/Speechless.png
|
75
|
+
- lib/themes/simplesmileys/Spiteful.png
|
76
|
+
- lib/themes/simplesmileys/Stupid.png
|
77
|
+
- lib/themes/simplesmileys/Sunglasses.png
|
78
|
+
- lib/themes/simplesmileys/Terrified.png
|
79
|
+
- lib/themes/simplesmileys/Thumb_Down.png
|
80
|
+
- lib/themes/simplesmileys/Thumb_Up.png
|
81
|
+
- lib/themes/simplesmileys/Tired.png
|
82
|
+
- lib/themes/simplesmileys/Tongue_Out.png
|
83
|
+
- lib/themes/simplesmileys/Tongue_Out_Laughing.png
|
84
|
+
- lib/themes/simplesmileys/Tongue_Out_Left.png
|
85
|
+
- lib/themes/simplesmileys/Tongue_Out_Up.png
|
86
|
+
- lib/themes/simplesmileys/Tongue_Out_Up_Left.png
|
87
|
+
- lib/themes/simplesmileys/Tongue_Out_Winking.png
|
88
|
+
- lib/themes/simplesmileys/Uncertain.png
|
89
|
+
- lib/themes/simplesmileys/Uncertain_2.png
|
90
|
+
- lib/themes/simplesmileys/Unhappy.png
|
91
|
+
- lib/themes/simplesmileys/Winking.png
|
92
|
+
- lib/themes/skype.yml
|
93
|
+
- lib/themes/skype/0100-smile.png
|
94
|
+
- lib/themes/skype/0101-sadsmile.png
|
95
|
+
- lib/themes/skype/0102-bigsmile.png
|
96
|
+
- lib/themes/skype/0103-cool.png
|
97
|
+
- lib/themes/skype/0104-surprised.png
|
98
|
+
- lib/themes/skype/0105-wink.png
|
99
|
+
- lib/themes/skype/0106-crying.png
|
100
|
+
- lib/themes/skype/0107-sweating.png
|
101
|
+
- lib/themes/skype/0108-speechless.png
|
102
|
+
- lib/themes/skype/0109-kiss.png
|
103
|
+
- lib/themes/skype/0110-tongueout.png
|
104
|
+
- lib/themes/skype/0111-blush.png
|
105
|
+
- lib/themes/skype/0112-wondering.png
|
106
|
+
- lib/themes/skype/0113-sleepy.png
|
107
|
+
- lib/themes/skype/0114-dull.png
|
108
|
+
- lib/themes/skype/0115-inlove.png
|
109
|
+
- lib/themes/skype/0116-evilgrin.png
|
110
|
+
- lib/themes/skype/0117-talking.png
|
111
|
+
- lib/themes/skype/0118-yawn.png
|
112
|
+
- lib/themes/skype/0119-puke.png
|
113
|
+
- lib/themes/skype/0120-doh.png
|
114
|
+
- lib/themes/skype/0121-angry.png
|
115
|
+
- lib/themes/skype/0122-itwasntme.png
|
116
|
+
- lib/themes/skype/0123-party.png
|
117
|
+
- lib/themes/skype/0124-worried.png
|
118
|
+
- lib/themes/skype/0125-mmm.png
|
119
|
+
- lib/themes/skype/0126-nerd.png
|
120
|
+
- lib/themes/skype/0127-lipssealed.png
|
121
|
+
- lib/themes/skype/0128-hi.png
|
122
|
+
- lib/themes/skype/0129-call.png
|
123
|
+
- lib/themes/skype/0130-devil.png
|
124
|
+
- lib/themes/skype/0131-angel.png
|
125
|
+
- lib/themes/skype/0132-envy.png
|
126
|
+
- lib/themes/skype/0133-wait.png
|
127
|
+
- lib/themes/skype/0134-bear.png
|
128
|
+
- lib/themes/skype/0135-makeup.png
|
129
|
+
- lib/themes/skype/0136-giggle.png
|
130
|
+
- lib/themes/skype/0137-clapping.png
|
131
|
+
- lib/themes/skype/0138-thinking.png
|
132
|
+
- lib/themes/skype/0139-bow.png
|
133
|
+
- lib/themes/skype/0140-rofl.png
|
134
|
+
- lib/themes/skype/0141-whew.png
|
135
|
+
- lib/themes/skype/0142-happy.png
|
136
|
+
- lib/themes/skype/0143-smirk.png
|
137
|
+
- lib/themes/skype/0144-nod.png
|
138
|
+
- lib/themes/skype/0145-shake.png
|
139
|
+
- lib/themes/skype/0146-punch.png
|
140
|
+
- lib/themes/skype/0147-emo.png
|
141
|
+
- lib/themes/skype/0148-yes.png
|
142
|
+
- lib/themes/skype/0149-no.png
|
143
|
+
- lib/themes/skype/0150-handshake.png
|
144
|
+
- lib/themes/skype/0151-skype.png
|
145
|
+
- lib/themes/skype/0152-heart.png
|
146
|
+
- lib/themes/skype/0153-brokenheart.png
|
147
|
+
- lib/themes/skype/0154-mail.png
|
148
|
+
- lib/themes/skype/0155-flower.png
|
149
|
+
- lib/themes/skype/0156-rain.png
|
150
|
+
- lib/themes/skype/0157-sun.png
|
151
|
+
- lib/themes/skype/0158-time.png
|
152
|
+
- lib/themes/skype/0159-music.png
|
153
|
+
- lib/themes/skype/0160-movie.png
|
154
|
+
- lib/themes/skype/0161-phone.png
|
155
|
+
- lib/themes/skype/0162-coffee.png
|
156
|
+
- lib/themes/skype/0163-pizza.png
|
157
|
+
- lib/themes/skype/0164-cash.png
|
158
|
+
- lib/themes/skype/0165-muscle.png
|
159
|
+
- lib/themes/skype/0166-cake.png
|
160
|
+
- lib/themes/skype/0167-beer.png
|
161
|
+
- lib/themes/skype/0168-drink.png
|
162
|
+
- lib/themes/skype/0169-dance.png
|
163
|
+
- lib/themes/skype/0170-ninja.png
|
164
|
+
- lib/themes/skype/0171-star.png
|
165
|
+
- lib/themes/skype/0172-mooning.png
|
166
|
+
- lib/themes/skype/0173-middlefinger.png
|
167
|
+
- lib/themes/skype/0174-bandit.png
|
168
|
+
- lib/themes/skype/0175-drunk.png
|
169
|
+
- lib/themes/skype/0176-smoke.png
|
170
|
+
- lib/themes/skype/0177-toivo.png
|
171
|
+
- lib/themes/skype/0178-rock.png
|
172
|
+
- lib/themes/skype/0179-headbang.png
|
173
|
+
- lib/themes/skype/0180-bug.png
|
174
|
+
- lib/themes/skype/0181-fubar.png
|
175
|
+
- lib/themes/skype/0182-poolparty.png
|
176
|
+
- lib/themes/skype/0183-swear.png
|
177
|
+
- lib/themes/skype/0184-tmi.png
|
178
|
+
- lib/themes/skype/0185-heidy.png
|
179
|
+
- lib/themes/skype/0186-myspace.png
|
180
|
+
- test/helper.rb
|
181
|
+
- test/test_remo.rb
|
182
|
+
has_rdoc: true
|
183
|
+
homepage: http://github.com/webs/remo
|
184
|
+
licenses: []
|
185
|
+
|
186
|
+
post_install_message:
|
187
|
+
rdoc_options:
|
188
|
+
- --charset=UTF-8
|
189
|
+
require_paths:
|
190
|
+
- lib
|
191
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: "0"
|
196
|
+
version:
|
197
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: "0"
|
202
|
+
version:
|
203
|
+
requirements: []
|
204
|
+
|
205
|
+
rubyforge_project:
|
206
|
+
rubygems_version: 1.3.5
|
207
|
+
signing_key:
|
208
|
+
specification_version: 3
|
209
|
+
summary: ruby emoticons parser
|
210
|
+
test_files:
|
211
|
+
- test/helper.rb
|
212
|
+
- test/test_remo.rb
|