md2review 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/md2review/version.rb +1 -1
- data/lib/redcarpet/render/review.rb +8 -2
- data/test/review_test.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d8b18e0e9542e371228ec43dc79fd5e91ebfc80
|
4
|
+
data.tar.gz: 5596daa94be80f6eb847003ebf0d96780c090b84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289771273affbc3a4c597297c91f120662ddeb79e9eb87cf6887bc2bcd77b387deebb2f9aacd1a8e971d0b2c54f370bb45bdc59632fd2f42d25f6f11fe3504cf
|
7
|
+
data.tar.gz: 242562c5061128eb046ddf80b998662dc787c1cb7a8f3257653ab65e38d7a4406501bdd969b293f0330f55a439ed6553041af3ab2ec8eb0bfdf866b3e4bcf191
|
data/README.md
CHANGED
data/lib/md2review/version.rb
CHANGED
@@ -15,6 +15,7 @@ module Redcarpet
|
|
15
15
|
@header_offset = render_extensions[:header_offset]
|
16
16
|
end
|
17
17
|
@links = {}
|
18
|
+
@cmd = render_extensions[:enable_cmd]
|
18
19
|
end
|
19
20
|
|
20
21
|
def normal_text(text)
|
@@ -37,10 +38,15 @@ module Redcarpet
|
|
37
38
|
if language =~ /caption=\"(.*)\"/
|
38
39
|
caption = "["+$1+"]"
|
39
40
|
else
|
40
|
-
|
41
|
+
caption = "[][#{language}]"
|
41
42
|
end
|
42
43
|
end
|
43
|
-
|
44
|
+
|
45
|
+
if @cmd && (language == "shell-session" || language == "console")
|
46
|
+
"\n//cmd{\n#{code_text}\n//}\n"
|
47
|
+
else
|
48
|
+
"\n//emlist#{caption}{\n#{code_text}\n//}\n"
|
49
|
+
end
|
44
50
|
end
|
45
51
|
|
46
52
|
def block_quote(quote)
|
data/test/review_test.rb
CHANGED
@@ -102,6 +102,20 @@ class ReVIEWTest < Test::Unit::TestCase
|
|
102
102
|
assert_equal %Q[\n\n~~~ {caption="test"}\ndef foo\n p "test"\nend\n~~~\n\n], rd
|
103
103
|
end
|
104
104
|
|
105
|
+
def test_code_fence_with_lang
|
106
|
+
rd = render_with({:fenced_code_blocks => true}, %Q[~~~ruby\ndef foo\n p "test"\nend\n~~~\n])
|
107
|
+
assert_equal %Q[\n//emlist[][ruby]{\ndef foo\n p "test"\nend\n//}\n], rd
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_code_fence_with_console
|
111
|
+
rd = render_with({:fenced_code_blocks => true}, %Q[~~~console\ndef foo\n p "test"\nend\n~~~\n])
|
112
|
+
assert_equal %Q[\n//emlist[][console]{\ndef foo\n p "test"\nend\n//}\n], rd
|
113
|
+
rd = render_with({:fenced_code_blocks => true},
|
114
|
+
%Q[~~~console\ndef foo\n p "test"\nend\n~~~\n],
|
115
|
+
{:enable_cmd => true})
|
116
|
+
assert_equal %Q[\n//cmd{\ndef foo\n p "test"\nend\n//}\n], rd
|
117
|
+
end
|
118
|
+
|
105
119
|
def test_group_ruby
|
106
120
|
rd = render_with({:ruby => true}, "{電子出版|でんししゅっぱん}を手軽に\n")
|
107
121
|
assert_equal %Q[\n\n@<ruby>{電子出版,でんししゅっぱん}を手軽に\n\n], rd
|