md2review 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -0
- data/lib/md2review/version.rb +1 -1
- data/lib/redcarpet/render/review.rb +6 -2
- data/test/review_test.rb +38 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19b686d5edb45716671bc879131637baf8555bb1
|
4
|
+
data.tar.gz: 8e2b3851dd0e906ac8d943b98a1a52d28b952503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d90bba198b259cdb8d00e86e0669529cb7c31c17477da4c92008cd53029a05db8803ce690dcc26d929df0efcaf08de7000917fc875f5ee53689d140399cbd787
|
7
|
+
data.tar.gz: 960a8281e3add6d09eddabab8cda6a2eaac12226ee870483df83ba60061aab0b844040b49eb1b4303a7ccaf8b84bd340490c41292f5974b82ae8115fe4920a15
|
data/Rakefile
CHANGED
data/lib/md2review/version.rb
CHANGED
@@ -20,6 +20,10 @@ module Redcarpet
|
|
20
20
|
text.gsub(/\}/){'\\}'}
|
21
21
|
end
|
22
22
|
|
23
|
+
def escape_href(text)
|
24
|
+
text.to_s.gsub(/,/){'\\,'}
|
25
|
+
end
|
26
|
+
|
23
27
|
def block_code(code, language)
|
24
28
|
code_text = normal_text(code).chomp
|
25
29
|
lang = ""
|
@@ -90,11 +94,11 @@ module Redcarpet
|
|
90
94
|
end
|
91
95
|
|
92
96
|
def autolink(link, link_type)
|
93
|
-
"@<href>{#{
|
97
|
+
"@<href>{#{escape_href(link)}}"
|
94
98
|
end
|
95
99
|
|
96
100
|
def link(link, title, content)
|
97
|
-
"@<href>{#{
|
101
|
+
"@<href>{#{escape_href(link)},#{escape_inline(content)}}"
|
98
102
|
end
|
99
103
|
|
100
104
|
def double_emphasis(text)
|
data/test/review_test.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
rootdir = File.dirname(File.dirname(__FILE__))
|
3
|
+
$LOAD_PATH.unshift "#{rootdir}/lib"
|
4
|
+
|
5
|
+
if defined? Encoding
|
6
|
+
Encoding.default_internal = 'UTF-8'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require 'redcarpet'
|
11
|
+
require 'redcarpet/render/review'
|
12
|
+
|
13
|
+
class ReVIEWTest < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@markdown = Redcarpet::Markdown.new(Redcarpet::Render::ReVIEW.new({}))
|
17
|
+
end
|
18
|
+
|
19
|
+
def render_with(flags, text)
|
20
|
+
Redcarpet::Markdown.new(Redcarpet::Render::ReVIEW, flags).render(text)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_that_simple_one_liner_goes_to_review
|
24
|
+
assert_respond_to @markdown, :render
|
25
|
+
assert_equal "\n\nHello World.\n", @markdown.render("Hello World.")
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_href
|
29
|
+
assert_respond_to @markdown, :render
|
30
|
+
assert_equal "\n\n@<href>{http://exmaple.com,example}\n", @markdown.render("[example](http://exmaple.com)")
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_href_with_comma
|
34
|
+
assert_respond_to @markdown, :render
|
35
|
+
assert_equal "\n\n@<href>{http://exmaple.com/foo\\,bar,example}\n", @markdown.render("[example](http://exmaple.com/foo,bar)")
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md2review
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- takahashim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/md2review/version.rb
|
43
43
|
- lib/redcarpet/render/review.rb
|
44
44
|
- md2review.gemspec
|
45
|
+
- test/review_test.rb
|
45
46
|
homepage: ''
|
46
47
|
licenses: []
|
47
48
|
metadata: {}
|
@@ -65,4 +66,5 @@ rubygems_version: 2.1.5
|
|
65
66
|
signing_key:
|
66
67
|
specification_version: 4
|
67
68
|
summary: a converter MD -> ReVIEW
|
68
|
-
test_files:
|
69
|
+
test_files:
|
70
|
+
- test/review_test.rb
|