md_emoji 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,11 @@
1
1
  module MdEmoji
2
2
  class Render < Redcarpet::Render::HTML
3
- def preprocess(document)
4
- if include_emoji?(document)
5
- replace_emoji(document)
6
- else
7
- document
8
- end
9
- end
10
-
11
- def block_code(text, lang)
12
- "<pre><code#{%{ class="#{lang}"} if lang}>#{revert_emoji(text)}</code></pre>"
3
+ def paragraph(text)
4
+ "<p>#{replace_emoji(text)}</p>\n"
13
5
  end
14
6
 
15
- def codespan(text)
16
- "<code>#{revert_emoji(text)}</code>"
7
+ def list_item(text, list_type)
8
+ "<li>#{replace_emoji(text)}</li>"
17
9
  end
18
10
 
19
11
  # Replaces valid emoji characters, ie :smile:, with img tags
@@ -43,12 +35,5 @@ module MdEmoji
43
35
  def include_emoji?(text)
44
36
  text && text[/:\S+:/]
45
37
  end
46
-
47
- # Replaces emoji images with plain text
48
- def revert_emoji(text)
49
- text.gsub(/<[^>]+class="emoji"\stitle="(:\S+:)"[^>]+>/) do |emoji|
50
- $1
51
- end
52
- end
53
38
  end
54
39
  end
@@ -1,3 +1,3 @@
1
1
  module MdEmoji
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -31,6 +31,14 @@ class MdEmojiTest < ActiveSupport::TestCase
31
31
  assert_emoji 'sweat_drops', parsed_text
32
32
  end
33
33
 
34
+ test "works within list items" do
35
+ text = "- wow :smile:\n- amazing"
36
+
37
+ parsed_text = @markdown.render(text)
38
+
39
+ assert_emoji 'smile', parsed_text
40
+ end
41
+
34
42
  test "skips emoji which aren't supported" do
35
43
  text = "Hello :jordan_byron: world!"
36
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md_emoji
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,30 +9,30 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-19 00:00:00.000000000Z
12
+ date: 2012-03-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2164372920 !ruby/object:Gem::Requirement
16
+ requirement: &2163509160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164372920
24
+ version_requirements: *2163509160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redcarpet
27
- requirement: &2164372060 !ruby/object:Gem::Requirement
27
+ requirement: &2163508660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ~>
30
+ - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: '2.1'
32
+ version: '2.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2164372060
35
+ version_requirements: *2163508660
36
36
  description: Rails gem which adds emoji parsing to markdown
37
37
  email:
38
38
  - jordan@ducksoupsoftware.com
@@ -587,7 +587,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
587
587
  version: '0'
588
588
  segments:
589
589
  - 0
590
- hash: 67226181594492248
590
+ hash: 2508333947300250217
591
591
  required_rubygems_version: !ruby/object:Gem::Requirement
592
592
  none: false
593
593
  requirements:
@@ -596,7 +596,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
596
596
  version: '0'
597
597
  segments:
598
598
  - 0
599
- hash: 67226181594492248
599
+ hash: 2508333947300250217
600
600
  requirements: []
601
601
  rubyforge_project:
602
602
  rubygems_version: 1.8.15