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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03c4b02c10ad8781fb5c2a38dbe9274656e00fd1
|
4
|
+
data.tar.gz: 7ecd48c6d029381424e1b485b97e072eaeba4107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 549ad3c2e30fc62e3396da409a1c860bfdedb285f25ed31b2a097e5afd82f6bf3af7f18bee5697dfa3180672ada70011ab9ce3b3ac361037efd8c822de5da6a5
|
7
|
+
data.tar.gz: 9ef5d2486dc80d828034a63dc4e6ee6b4b877458f88a145848c34d3a526e09bdb43413e305e00173f93195afa0ed6e8e6a3e1dbe3b3557475a7a93175e6181d2
|
data/.gitignore
CHANGED
@@ -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
|
@@ -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.
|
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-
|
11
|
+
date: 2015-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|