md_emoji 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ require 'rails/engine'
2
+
1
3
  module MdEmoji
2
4
  class Engine < ::Rails::Engine
3
5
  end
@@ -1,6 +1,13 @@
1
1
  module MdEmoji
2
2
  class Render < Redcarpet::Render::HTML
3
+ def initialize(options={})
4
+ @options = options
5
+ super options
6
+ end
7
+
3
8
  def paragraph(text)
9
+ text.gsub!("\n", "<br>\n") if @options[:hard_wrap]
10
+
4
11
  "<p>#{replace_emoji(text)}</p>\n"
5
12
  end
6
13
 
@@ -1,3 +1,3 @@
1
1
  module MdEmoji
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -58,6 +58,26 @@ class MdEmojiTest < ActiveSupport::TestCase
58
58
  "Hyperlink not present in parsed text: #{parsed_text}"
59
59
  end
60
60
 
61
+ test "works with no_styles enabled" do
62
+ @markdown = Redcarpet::Markdown.new(MdEmoji::Render.new(:no_styles => true))
63
+
64
+ text = ":wink2: <a style='color: red;'></a>"
65
+ parsed_text = @markdown.render(text)
66
+
67
+ assert_emoji 'wink2', parsed_text
68
+ end
69
+
70
+ test "works with hard_wrap enabled" do
71
+ @markdown = Redcarpet::Markdown.new(MdEmoji::Render.new(:hard_wrap => true))
72
+
73
+ text = ":wink2:\nline"
74
+ parsed_text = @markdown.render(text)
75
+
76
+ assert_emoji 'wink2', parsed_text
77
+ assert parsed_text.include?(%{<br>}),
78
+ "<br> not present in parsed text: #{parsed_text}"
79
+ end
80
+
61
81
  test "does not render emoji in codeblocks" do
62
82
  text = %{```ruby
63
83
  def hello
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.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-08 00:00:00.000000000Z
12
+ date: 2012-06-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: &2163509160 !ruby/object:Gem::Requirement
15
+ name: railties
16
+ requirement: &2159043500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2163509160
24
+ version_requirements: *2159043500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redcarpet
27
- requirement: &2163508660 !ruby/object:Gem::Requirement
27
+ requirement: &2159043000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,18 @@ dependencies:
32
32
  version: '2.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2163508660
35
+ version_requirements: *2159043000
36
+ - !ruby/object:Gem::Dependency
37
+ name: rails
38
+ requirement: &2159042540 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2159042540
36
47
  description: Rails gem which adds emoji parsing to markdown
37
48
  email:
38
49
  - jordan@ducksoupsoftware.com
@@ -587,7 +598,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
587
598
  version: '0'
588
599
  segments:
589
600
  - 0
590
- hash: 2508333947300250217
601
+ hash: 2878078479402414121
591
602
  required_rubygems_version: !ruby/object:Gem::Requirement
592
603
  none: false
593
604
  requirements:
@@ -596,7 +607,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
596
607
  version: '0'
597
608
  segments:
598
609
  - 0
599
- hash: 2508333947300250217
610
+ hash: 2878078479402414121
600
611
  requirements: []
601
612
  rubyforge_project:
602
613
  rubygems_version: 1.8.15