Module: ForumRedCloth3

Defined in:
lib/forum_red_cloth3.rb

Instance Method Summary collapse

Instance Method Details

#smilies(text) ⇒ Object



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
# File 'lib/forum_red_cloth3.rb', line 3

def smilies(text)
  emoticons = {
	':)' => 'happy',
	':|' => 'neutral',
	':(' => 'sad',
	':D' => 'grin',
	':O' => 'surprised',
	';)' => 'wink',
	'}:)' => 'devil',
	':P' => 'tongue',
	':[' => 'mad',
	'8|' => 'shocked',
	':@' => 'lol',
	'B]' => 'cool'
}

  # old syntax carried over from vanilla
  text.gsub!(/\:(angry|smile|bigsmile|confused|cool|cry|devil|neutral|sad|shamed|shocked|surprised|tongue|wink)\:/) do |w| 
    %{<img src="/images/emoticons/#{$1}.gif" alt="(#{$1})" title="#{$1}" class="smiley" />} 
  end

  # these are generally put in by the punymce toolbar, so we use their nasty but effective combination of blank image with sprite background
text.gsub!(/(\}\:\)|\:\)|\:\||\:\(|\:D|\:O|\;\)|\:P|\:\@|8\||\:\[|B\])/) do |w| 
  %{<img src="/images/furniture/blank.png" class="emoticon #{emoticons[w]}" />}; 
end
end