mongoid_markdown_extension 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08e47e09a6f271247b003d6e9051218f4ae2b9c4
4
- data.tar.gz: a4f8e3af8c6f79438da0f35338af3cc04aacd605
3
+ metadata.gz: 03c4b02c10ad8781fb5c2a38dbe9274656e00fd1
4
+ data.tar.gz: 7ecd48c6d029381424e1b485b97e072eaeba4107
5
5
  SHA512:
6
- metadata.gz: beb5a9b02298e33e107b70f4cb5318de38bc0ad608b8fefc428007ce5dd23c3d41d8ee6b74b7f24a1f65a17517d8360345de582468e9033eb929dda16a8b25d4
7
- data.tar.gz: d0cee900de531b3273e0359f23694dcdedd7baad7c0f68433c29eda4e421226c0210280bcb78820cec626539673674cdd51bec3e593d270092d357d7044e0346
6
+ metadata.gz: 549ad3c2e30fc62e3396da409a1c860bfdedb285f25ed31b2a097e5afd82f6bf3af7f18bee5697dfa3180672ada70011ab9ce3b3ac361037efd8c822de5da6a5
7
+ data.tar.gz: 9ef5d2486dc80d828034a63dc4e6ee6b4b877458f88a145848c34d3a526e09bdb43413e305e00173f93195afa0ed6e8e6a3e1dbe3b3557475a7a93175e6181d2
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ .DS_Store
@@ -1,4 +1,5 @@
1
1
  require 'redcarpet'
2
+ require 'redcarpet/render_strip'
2
3
 
3
4
  module MongoidMarkdownExtension
4
5
  class Markdown < String
@@ -20,6 +21,10 @@ module MongoidMarkdownExtension
20
21
  markdown_inline_renderer.render(@str).html_safe
21
22
  end
22
23
 
24
+ def to_stripped_s
25
+ markdown_stripdown_renderer.render(@str)
26
+ end
27
+
23
28
  def mongoize
24
29
  @str
25
30
  end
@@ -37,6 +42,10 @@ module MongoidMarkdownExtension
37
42
  Redcarpet::Markdown.new(InlineRenderer, tables: false)
38
43
  end
39
44
 
45
+ def markdown_stripdown_renderer
46
+ Redcarpet::Markdown.new(Redcarpet::Render::StripDown, space_after_headers: true)
47
+ end
48
+
40
49
  # ---------------------------------------------------------------------
41
50
 
42
51
  class << self
@@ -1,3 +1,3 @@
1
1
  module MongoidMarkdownExtension
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -62,6 +62,15 @@ module MongoidMarkdownExtension
62
62
  end
63
63
  end
64
64
 
65
+ describe '#to_stripped_s' do
66
+ it 'survives nil' do
67
+ MongoidMarkdownExtension::Markdown.new(nil).to_stripped_s.must_equal ''
68
+ end
69
+ it 'converts the markdown to stripped string' do
70
+ subject.to_stripped_s.wont_include "_"
71
+ end
72
+ end
73
+
65
74
  describe '#mongoize' do
66
75
  it 'returns string' do
67
76
  subject.mongoize.must_equal string
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_markdown_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Celizna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-03 00:00:00.000000000 Z
11
+ date: 2015-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet