md2review 1.9.0 → 1.10.0

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: e1044d852345e611794a38f4bc2cd8053f668c8a
4
- data.tar.gz: 9f0343040dcb3e15a05ac4830b13a5eb828cf946
3
+ metadata.gz: 0b0c25dd78674626ae763d7e22a3d0f3bb0d1bbe
4
+ data.tar.gz: a20ad0bfc4b7a8cc8911fe45e62c463b9a6e809c
5
5
  SHA512:
6
- metadata.gz: a14a611b1e9349247fa8a66ac4e0357022754c0b879245a74caad1b8251571aebfdf8c253bd294f8f22536ef1710440ba135cb5f558d99e727add5ebc8dafb53
7
- data.tar.gz: 1d2db2f93a8a6b47fc00d0c1006613b6d627d4732dea754635682cf222bd677b243d47b5d6ba63056af85fadcefadab3e312070c2d044d3bbc408781967ee904
6
+ metadata.gz: b6f7e6c11a967266328ad668175f77c3c8e66664e57a77d7a421a2037ffaf54ca8af49090dfd69ac8084258a3bef3db913e0cb4f6e8abee1b17ec8e97cb2c48c
7
+ data.tar.gz: 839647f7b807bff78490e84b5f2665cffb33c83fb298f446a9a31d18b5b6affd1b09c581532147d17930182c4f1fb6d162a468b205b4c6abccb1e10c94e2811f
data/README.md CHANGED
@@ -5,6 +5,26 @@
5
5
  md2review is a CLI tool to convert from Markdown into Re:VIEW (http://reviewml.org/ ).
6
6
  This command uses Redcarpet gem to parse markdown.
7
7
 
8
+ ## Usage
9
+
10
+ You can use the commmand md2review as:
11
+
12
+ $ md2review [options] your-document.md > your-document.re
13
+
14
+ ### Options
15
+
16
+ * `--version`: show version
17
+ * `--help`: show help
18
+ * `--render-header-offset = N`: use offset of header levels
19
+ * `--render-disable-image-caption`: disable image caption; coverting into `//indepimage`
20
+ * `--render-link-in-footnote`: enable links in footnote.
21
+ * `--render-enable-cmd`: support `//cmd{...//}` for `shell-session` and `console` blocks
22
+ * `--render-math`: support `@<m>{...}` and `//texequation{...}`
23
+ * `--render-table-cation`: support table caption before table like `Table: some captions`
24
+ * `--parse-no-intra-emphasis`: do not parse emphasis inside of words.
25
+ * `--parse-autolink`: parse links even when they are not enclosed in `<>` characters.
26
+
27
+
8
28
  ## Installation
9
29
 
10
30
  Add this line to your application's Gemfile:
@@ -19,14 +39,13 @@ Or install it yourself as:
19
39
 
20
40
  $ gem install md2review
21
41
 
22
- ## Usage
23
-
24
- You can use the commmand md2review as:
25
-
26
- $ md2review your-document.md > your-document.re
27
-
28
42
  ## History
29
43
 
44
+ * 1.10.0
45
+ * add: option --image-table to support `//imgtable` with `![Table:foo](...)`
46
+ * fix: olist before/after ulist
47
+ * 1.9.0
48
+ * fix: fix math support for complex cases
30
49
  * 1.8.0
31
50
  * add: option --version
32
51
  * add: option --render-math to support `@<m>{...}` and `//texequation{\n...\n}\n`
data/appveyor.yml CHANGED
@@ -1,21 +1,28 @@
1
1
  ---
2
2
  install:
3
3
  - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4
- - ruby --version
5
- - gem --version
6
4
  - bundle install
7
- build_script:
8
- - bundle exec rake
5
+
6
+ build: off
7
+
9
8
  test_script:
10
9
  - bundle exec rake test
10
+
11
+ before_test:
12
+ - ruby -v
13
+ - gem -v
14
+ - bundle -v
15
+
11
16
  artifacts:
12
17
  - path: pkg\*.gem
13
18
 
14
19
  environment:
15
20
  matrix:
16
- - ruby_version: "200"
17
- - ruby_version: "200-x64"
18
21
  - ruby_version: "21"
19
22
  - ruby_version: "21-x64"
20
23
  - ruby_version: "22"
21
24
  - ruby_version: "22-x64"
25
+ - ruby_version: "23"
26
+ - ruby_version: "23-x64"
27
+
28
+ skip_branch_with_pr: true
@@ -1,3 +1,3 @@
1
1
  module MD2ReVIEW
2
- VERSION = "1.9.0"
2
+ VERSION = "1.10.0"
3
3
  end
@@ -11,6 +11,7 @@ module Redcarpet
11
11
  @header_offset = 0
12
12
  @link_in_footnote = render_extensions[:link_in_footnote]
13
13
  @image_caption = !render_extensions[:disable_image_caption]
14
+ @image_table = render_extensions[:image_table]
14
15
  if render_extensions[:header_offset]
15
16
  @header_offset = render_extensions[:header_offset]
16
17
  end
@@ -20,6 +21,7 @@ module Redcarpet
20
21
  @table_caption = nil
21
22
  @math = render_extensions[:math]
22
23
  @math_buf = []
24
+ @sep = nil
23
25
  end
24
26
 
25
27
  def preprocess(text)
@@ -160,7 +162,10 @@ module Redcarpet
160
162
 
161
163
  def image(link, title, alt_text)
162
164
  filename = File.basename(link, ".*")
163
- if @image_caption
165
+ if @image_table && alt_text =~ /\ATable:\s*(.*)/
166
+ caption = $1
167
+ "//imgtable[#{filename}][#{caption}]{\n//}\n"
168
+ elsif @image_caption
164
169
  "//image[#{filename}][#{alt_text}]{\n//}\n"
165
170
  else
166
171
  "//indepimage[#{filename}]\n"
@@ -228,6 +233,7 @@ module Redcarpet
228
233
  raise "invalid type: #{list_type}"
229
234
  end
230
235
  end
236
+ ret << "\n"
231
237
  ret
232
238
  end
233
239
 
data/test/review_test.rb CHANGED
@@ -92,25 +92,34 @@ class ReVIEWTest < Test::Unit::TestCase
92
92
  assert_equal "\n\n//indepimage[image]\n\n\n", rev
93
93
  end
94
94
 
95
+ def test_image_table
96
+ rev = render_with({}, "![Table:test](path/to/image.jpg)\n",{:image_table => true})
97
+ assert_equal "\n\n//imgtable[image][test]{\n//}\n\n\n", rev
98
+ end
99
+
95
100
  def test_nested_ulist
96
- assert_equal " * aaa\n ** bbb\n * ccc\n", @markdown.render("- aaa\n - bbb\n- ccc\n")
101
+ assert_equal " * aaa\n ** bbb\n * ccc\n\n", @markdown.render("- aaa\n - bbb\n- ccc\n")
97
102
  end
98
103
 
99
104
  def test_olist
100
- assert_equal " 1. aaa\n 1. bbb\n 1. ccc\n", @markdown.render("1. aaa\n2. bbb\n3. ccc\n")
105
+ assert_equal " 1. aaa\n 1. bbb\n 1. ccc\n\n", @markdown.render("1. aaa\n2. bbb\n3. ccc\n")
101
106
  end
102
107
 
103
108
  def test_nested_olist
104
109
  ## XXX not support yet in Re:VIEW
105
- assert_equal " 1. aaa\n 1. bbb\n 1. ccc\n", @markdown.render("1. aaa\n 2. bbb\n3. ccc\n")
110
+ assert_equal " 1. aaa\n 1. bbb\n 1. ccc\n\n", @markdown.render("1. aaa\n 2. bbb\n3. ccc\n")
106
111
  end
107
112
 
108
113
  def test_olist_image
109
- assert_equal " 1. aaa@<icon>{foo}\n 1. bbb\n 1. ccc\n", @markdown.render("1. aaa\n ![test](foo.jpg)\n2. bbb\n3. ccc\n")
114
+ assert_equal " 1. aaa@<icon>{foo}\n 1. bbb\n 1. ccc\n\n", @markdown.render("1. aaa\n ![test](foo.jpg)\n2. bbb\n3. ccc\n")
110
115
  end
111
116
 
112
117
  def test_olist_image2
113
- assert_equal " 1. aaa@<br>{}@<icon>{foo}\n 1. bbb\n 1. ccc\n", @markdown.render("1. aaa \n ![test](foo.jpg)\n2. bbb\n3. ccc\n")
118
+ assert_equal " 1. aaa@<br>{}@<icon>{foo}\n 1. bbb\n 1. ccc\n\n", @markdown.render("1. aaa \n ![test](foo.jpg)\n2. bbb\n3. ccc\n")
119
+ end
120
+
121
+ def test_olist_and_ulist
122
+ assert_equal " * ddd\n\n 1. aaa\n 1. bbb\n 1. ccc\n\n * eee\n\n", @markdown.render("* ddd\n\n1. aaa\n2. bbb\n3. ccc\n\n* eee\n")
114
123
  end
115
124
 
116
125
  def test_table_with_empty_cell
@@ -231,4 +240,15 @@ EOB
231
240
  rd = render_with({:footnotes=>true}, "これは*脚注*付き[^1]の段落です。\n\n\n[^1]: そして、これが脚注です。\n")
232
241
  assert_equal %Q|\n\nこれは@<b>{脚注}付き@<fn>{1}の段落です。\n\n\n//footnote[1][そして、これが脚注です。]\n|, rd
233
242
  end
243
+
244
+ def test_autolink
245
+ rd = render_with({:autolink => true}, "リンクの[テスト](http://example.jp/test)です。\nhttp://example.jp/test2/\n")
246
+ assert_equal %Q[\n\nリンクの@<href>{http://example.jp/test,テスト}です。\n@<href>{http://example.jp/test2/}\n\n], rd
247
+ end
248
+
249
+ def test_no_autolink
250
+ rd = render_with({}, "リンクの[テスト](http://example.jp/test)です。\nhttp://example.jp/test2/\n")
251
+ assert_equal %Q[\n\nリンクの@<href>{http://example.jp/test,テスト}です。\nhttp://example.jp/test2/\n\n], rd
252
+ end
253
+
234
254
  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.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - takahashim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-21 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet