md2review 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/lib/md2review/version.rb +1 -1
- data/lib/redcarpet/render/review.rb +28 -3
- data/md2review.gemspec +2 -2
- data/test/review_test.rb +24 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fe75be532aea31066a8d4d72bf8d374c5012f5d
|
4
|
+
data.tar.gz: 8c8cc8e6ea93aa0130e3ae829afa6493b277fdf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b2ca4b637fbf6d5d5841b6cf855dc4945373247925a941b6d45de53a0221237f05aff3688945952df3f6496032e9b43d36f75937f2b09e48507886c2c82d8e2
|
7
|
+
data.tar.gz: 0bf1477d3c85f553ffe5bf31678093b883e3cd45dd6ab21d8ae6a17c242c506ae08f8d80f04367b981e3a7b259c264b396d125f332078d2879b468fac6457b9d
|
data/Gemfile
CHANGED
data/lib/md2review/version.rb
CHANGED
@@ -2,7 +2,7 @@ module Redcarpet
|
|
2
2
|
module Render
|
3
3
|
class ReVIEW < Base
|
4
4
|
|
5
|
-
def initialize(render_extensions)
|
5
|
+
def initialize(render_extensions={})
|
6
6
|
super()
|
7
7
|
@table_num = 0
|
8
8
|
@table_id_prefix = "tbl"
|
@@ -27,10 +27,15 @@ module Redcarpet
|
|
27
27
|
def block_code(code, language)
|
28
28
|
code_text = normal_text(code).chomp
|
29
29
|
lang = ""
|
30
|
+
caption = ""
|
30
31
|
if language
|
31
|
-
|
32
|
+
if language =~ /caption=\"(.*)\"/
|
33
|
+
caption = "["+$1+"]"
|
34
|
+
else
|
35
|
+
lang = "#\@# lang: #{language}\n"
|
36
|
+
end
|
32
37
|
end
|
33
|
-
"\n#{lang}//emlist{\n#{code_text}\n//}\n"
|
38
|
+
"\n#{lang}//emlist#{caption}{\n#{code_text}\n//}\n"
|
34
39
|
end
|
35
40
|
|
36
41
|
def block_quote(quote)
|
@@ -144,6 +149,26 @@ module Redcarpet
|
|
144
149
|
"#{@table_id_prefix}#{@table_num}"
|
145
150
|
end
|
146
151
|
|
152
|
+
def ruby(text)
|
153
|
+
rt, rb = text.split(/\|/, 2)
|
154
|
+
"@<ruby>{#{escape_inline(rt)},#{escape_inline(rb)}}"
|
155
|
+
end
|
156
|
+
|
157
|
+
def tcy(text)
|
158
|
+
"@<tcy>{#{escape_inline(text)}}"
|
159
|
+
end
|
160
|
+
|
161
|
+
def footnote_ref(number)
|
162
|
+
"@<fn>{#{number}}"
|
163
|
+
end
|
164
|
+
def footnotes(text)
|
165
|
+
"#{text}"
|
166
|
+
end
|
167
|
+
|
168
|
+
def footnote_def(text,number)
|
169
|
+
"\n//footnote[#{number}][#{escape_inline(text).strip}]\n"
|
170
|
+
end
|
171
|
+
|
147
172
|
end
|
148
173
|
end
|
149
174
|
end
|
data/md2review.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = MD2ReVIEW::VERSION
|
9
9
|
gem.authors = ["takahashim"]
|
10
10
|
gem.email = ["takahashimm@gmail.com"]
|
11
|
-
gem.description = %q{a converter
|
12
|
-
gem.summary = %q{a converter
|
11
|
+
gem.description = %q{a converter from Markdown to Re:VIEW. It uses redcarpet.}
|
12
|
+
gem.summary = %q{a converter from Markdown to Re:VIEW}
|
13
13
|
gem.homepage = ""
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
data/test/review_test.rb
CHANGED
@@ -40,4 +40,28 @@ class ReVIEWTest < Test::Unit::TestCase
|
|
40
40
|
assert_equal "\n= AAA\n\n\nBBB\n\n== ccc\n\n\nddd\n", @markdown.render("#AAA\nBBB\n\n##ccc\n\nddd\n")
|
41
41
|
end
|
42
42
|
|
43
|
+
def test_code_fence_with_caption
|
44
|
+
rd = render_with({:fenced_code_blocks => true}, %Q[~~~ {caption="test"}\ndef foo\n p "test"\nend\n~~~\n])
|
45
|
+
assert_equal %Q[\n//emlist[test]{\ndef foo\n p "test"\nend\n//}\n], rd
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_code_fence_without_flag
|
49
|
+
rd = render_with({}, %Q[~~~ {caption="test"}\ndef foo\n p "test"\nend\n~~~\n])
|
50
|
+
assert_equal %Q[\n\n~~~ {caption="test"}\ndef foo\n p "test"\nend\n~~~\n], rd
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_group_ruby
|
54
|
+
rd = render_with({:ruby => true}, "{電子出版|でんししゅっぱん}を手軽に\n")
|
55
|
+
assert_equal %Q[\n\n@<ruby>{電子出版,でんししゅっぱん}を手軽に\n], rd
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_tcy
|
59
|
+
rd = render_with({:tcy => true}, "昭和^53^年\n")
|
60
|
+
assert_equal %Q[\n\n昭和@<tcy>{53}年\n], rd
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_footnote
|
64
|
+
rd = render_with({:footnotes=>true}, "これは脚注付き[^1]の段落です。\n\n[^1]: そして、これが脚注です。\n")
|
65
|
+
assert_equal %Q|\n\nこれは脚注付き@<fn>{1}の段落です。\n\n//footnote[1][そして、これが脚注です。]\n|, rd
|
66
|
+
end
|
43
67
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- takahashim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: a converter
|
41
|
+
description: a converter from Markdown to Re:VIEW. It uses redcarpet.
|
42
42
|
email:
|
43
43
|
- takahashimm@gmail.com
|
44
44
|
executables:
|
@@ -77,9 +77,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.2.
|
80
|
+
rubygems_version: 2.2.2
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
|
-
summary: a converter
|
83
|
+
summary: a converter from Markdown to Re:VIEW
|
84
84
|
test_files:
|
85
85
|
- test/review_test.rb
|