md2review 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c560a9be30a083529292ae26d7a45d9fced085d
4
- data.tar.gz: 7ab713f3fda9726c9d138bfe418ef52c57ae2d56
3
+ metadata.gz: daa4fc112578f2e831f799f507fbb6422c85c8e8
4
+ data.tar.gz: 14f3cd47c2e1299f174480052bf11f37bf10e6bf
5
5
  SHA512:
6
- metadata.gz: '00689ab7e51fca52eae36f9137fbed5fde4f90d142b6bdc0e241301023caafb31996441ec4caa7eca3b2ebabc6fa457ba8cafd9607d4bac0cad37f0c7a57b4dd'
7
- data.tar.gz: 352be9cc2485f702ddfae7ebddaf941175e7e3f9e3aa93ab53bd3843111634eb9cd343ed953421e0482bdd0954b31f7d1758338c741c479cb23fc3fa13cd9517
6
+ metadata.gz: e583507badaf5e273e48f0ad787684bf9101f871efc77af533e618a7fba81f033e478ae8497f4b6af22f243221505a5d93c087b536d8283bcce7337ad9c38031
7
+ data.tar.gz: 3d6dabfe248a4788a75ec43ab2cd765a348ca9b0b35957ecdfb7e43bcab6246f8febeb78cbe71120057656e3a9662bea2479e3d67f49062a5031b7edd1fdc2a1
@@ -5,14 +5,14 @@ AllCops:
5
5
  Style/HashSyntax:
6
6
  Enabled: true
7
7
 
8
- Style/EmptyLines:
8
+ Layout/EmptyLines:
9
9
  Enabled: true
10
10
 
11
- Style/TrailingBlankLines:
11
+ Layout/TrailingBlankLines:
12
12
  Enabled: true
13
13
 
14
- Style/TrailingWhitespace:
15
- Enabled: true
14
+ Layout/TrailingWhitespace:
15
+ Enabled: false
16
16
 
17
17
  Style/MethodDefParentheses:
18
18
  Enabled: true
@@ -24,7 +24,7 @@ Style/BarePercentLiterals:
24
24
 
25
25
  # EnforcedStyle: empty_lines => 16 offenses
26
26
  # EnforcedStyle: no_empty_lines => 0 offense
27
- Style/EmptyLinesAroundBlockBody:
27
+ Layout/EmptyLinesAroundBlockBody:
28
28
  EnforcedStyle: no_empty_lines
29
29
  Enabled: true
30
30
 
@@ -36,12 +36,12 @@ Style/MethodName:
36
36
  EnforcedStyle: snake_case
37
37
  Enabled: true
38
38
 
39
- Style/SpaceInsideHashLiteralBraces:
39
+ Layout/SpaceInsideHashLiteralBraces:
40
40
  EnforcedStyle: no_space
41
41
  EnforcedStyleForEmptyBraces: no_space
42
42
  Enabled: true
43
43
 
44
- Style/SpaceInsideStringInterpolation:
44
+ Layout/SpaceInsideStringInterpolation:
45
45
  EnforcedStyle: no_space
46
46
  Enabled: true
47
47
 
@@ -3,15 +3,15 @@ sudo: false
3
3
 
4
4
 
5
5
  before_install:
6
- - gem update --system
7
- - gem update bundler
6
+ # - gem update --system
7
+ # - gem update bundler
8
8
 
9
9
  rvm:
10
10
  - 2.0
11
11
  - 2.1
12
12
  - 2.2
13
13
  - 2.3.3
14
- - 2.4.0
14
+ - 2.4.2
15
15
 
16
16
  branches:
17
17
  only:
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem "redcarpet", git: 'https://github.com/gnue/redcarpet.git', branch: 'denden'
6
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -43,6 +43,9 @@ Or install it yourself as:
43
43
 
44
44
  ## History
45
45
 
46
+ ### v1.12.0
47
+ * fix: anchor content should be escaped
48
+
46
49
  ### v1.11.0
47
50
  * add: option --empty-image-caption: switch to use `//image` or `//indepimage` with caption
48
51
 
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- # Usage: redcarpet [--parse-<extension>...] [--render-<extension>...] [--smarty] [<file>...]
3
- # Convert one or more Markdown files to ReVIEW and write to standard output. With
2
+ # Usage: md2review [--parse-<extension>...] [--render-<extension>...] [<file>...]
3
+ #
4
+ # Convert one or more Markdown files to Re:VIEW and write to standard output. With
4
5
  # no <file> or when <file> is '-', read Markdown source text from standard input.
5
6
  # With <extension>s, perform additional Markdown processing before writing output.
6
7
 
@@ -1,3 +1,3 @@
1
1
  module MD2ReVIEW
2
- VERSION = "1.11.0"
2
+ VERSION = "1.12.0"
3
3
  end
@@ -68,9 +68,10 @@ module Redcarpet
68
68
  text.to_s.gsub(/,/){ '\\,' }
69
69
  end
70
70
 
71
+ alias_method :escape_comma, :escape_href
72
+
71
73
  def block_code(code, language)
72
74
  code_text = normal_text(code).chomp
73
- lang = ""
74
75
  caption = ""
75
76
  if language
76
77
  if language =~ /caption=\"(.*)\"/
@@ -130,7 +131,9 @@ module Redcarpet
130
131
  when 6
131
132
  buf << "\n====== #{title}\n"
132
133
  else
134
+ # :nocov:
133
135
  raise "too long header"
136
+ # :nocov:
134
137
  end
135
138
  buf
136
139
  end
@@ -189,7 +192,7 @@ module Redcarpet
189
192
  footnotes(content) + footnote_ref(key)
190
193
  else
191
194
  content = escape_inline(remove_inline_markups(content))
192
- "@<href>{#{escape_href(link)},#{content}}"
195
+ "@<href>{#{escape_href(link)},#{escape_comma(content)}}"
193
196
  end
194
197
  end
195
198
 
@@ -236,7 +239,9 @@ module Redcarpet
236
239
  ret << " * " << item
237
240
  end
238
241
  else
242
+ # :nocov:
239
243
  raise "invalid type: #{list_type}"
244
+ # :nocov:
240
245
  end
241
246
  end
242
247
  ret << "\n"
@@ -255,7 +260,9 @@ module Redcarpet
255
260
  item = content.gsub(/\n(\s*[^* ])/){ $1 }.strip
256
261
  "#{item}\n"
257
262
  else
263
+ # :nocov:
258
264
  raise "invalid type: #{list_type}"
265
+ # :nocov:
259
266
  end
260
267
  end
261
268
 
@@ -2,6 +2,9 @@
2
2
  rootdir = File.dirname(File.dirname(__FILE__))
3
3
  $LOAD_PATH.unshift "#{rootdir}/lib"
4
4
 
5
+ require 'coveralls'
6
+ Coveralls.wear!
7
+
5
8
  if defined? Encoding
6
9
  Encoding.default_internal = 'UTF-8'
7
10
  end
@@ -35,6 +38,11 @@ class ReVIEWTest < Test::Unit::TestCase
35
38
  assert_equal "\n\n@<href>{http://exmaple.com/foo\\,bar,example}\n\n", @markdown.render("[example](http://exmaple.com/foo,bar)")
36
39
  end
37
40
 
41
+ def test_href_with_comma2
42
+ assert_respond_to @markdown, :render
43
+ assert_equal "\n\n@<href>{http://exmaple.com/foo,bar\\,example}\n\n", @markdown.render("[bar,example](http://exmaple.com/foo)")
44
+ end
45
+
38
46
  def test_href_in_footnote
39
47
  text = %Q[aaa [foo](http://example.jp/foo), [bar](http://example.jp/bar), [foo2](http://example.jp/foo)]
40
48
  rd = MD2ReVIEW::Markdown.new({link_in_footnote: true},{}).render(text)
@@ -63,11 +71,21 @@ class ReVIEWTest < Test::Unit::TestCase
63
71
  assert_equal "\n= AAA\n\n\nBBB\n\n\n== ccc\n\n\nddd\n\n", @markdown.render("#AAA\nBBB\n\n##ccc\n\nddd\n")
64
72
  end
65
73
 
74
+ def test_header34
75
+ assert_respond_to @markdown, :render
76
+ assert_equal "\n=== AAA\n\n\nBBB\n\n\n==== ccc\n\n\nddd\n\n", @markdown.render("###AAA\nBBB\n\n####ccc\n\nddd\n")
77
+ end
78
+
66
79
  def test_header56
67
80
  assert_respond_to @markdown, :render
68
81
  assert_equal "\n===== AAA\n\n\nBBB\n\n\n====== ccc\n\n\nddd\n\n", @markdown.render("#####AAA\nBBB\n\n######ccc\n\nddd\n")
69
82
  end
70
83
 
84
+ def test_header_offset
85
+ rev = render_with({}, "###test\n", {header_offset: 2})
86
+ assert_equal "\n= test\n", rev
87
+ end
88
+
71
89
  def test_header_attributes
72
90
  assert_respond_to @markdown, :render
73
91
  assert_equal "\n\#@# header_attribute: {-}\n= AAA\n\n\#@# header_attribute: {\#foo .bar title=hoge}\n= BBB\n", @markdown.render("\#AAA {-}\n\n\#BBB {\#foo .bar title=hoge}\n\n")
@@ -261,4 +279,41 @@ EOB
261
279
  assert_equal %Q[\n\nリンクの@<href>{http://example.jp/test,テスト}です。\nhttp://example.jp/test2/\n\n], rd
262
280
  end
263
281
 
282
+ def test_block_quote
283
+ expected = <<-EOB
284
+
285
+ //quote{
286
+ test
287
+ test2
288
+
289
+ //}
290
+ EOB
291
+ assert_equal expected, @markdown.render("> test\n> test2\n> \n")
292
+ end
293
+
294
+ def test_block_html
295
+ expected = <<-EOB
296
+
297
+ //emlist{
298
+ XXX: BLOCK_HTML: YOU SHOULD REWRITE IT
299
+ <div>
300
+ test
301
+ </div>
302
+ //}
303
+ EOB
304
+ assert_equal expected, @markdown.render("<div>\ntest\n</div>\n")
305
+ end
306
+
307
+ def test_hr
308
+ expected = <<-EOB
309
+
310
+ //hr
311
+ EOB
312
+ assert_equal expected, @markdown.render("***\n")
313
+ end
314
+
315
+ def test_strikethrough
316
+ rd = render_with({strikethrough: true}, "~~test~~ ~~test2~~\n")
317
+ assert_equal "\n\n@<del>{test} @<del>{test2}\n\n", rd
318
+ end
264
319
  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.11.0
4
+ version: 1.12.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-02-10 00:00:00.000000000 Z
11
+ date: 2017-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.6.8
111
+ rubygems_version: 2.6.13
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: a converter from Markdown to Re:VIEW