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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26d828ba35042062e4e8d534bdf6c84b57f3519d
4
- data.tar.gz: a9dd76ad0f29ea57c4c38cf5e214abdf0c27e7b8
3
+ metadata.gz: 19b686d5edb45716671bc879131637baf8555bb1
4
+ data.tar.gz: 8e2b3851dd0e906ac8d943b98a1a52d28b952503
5
5
  SHA512:
6
- metadata.gz: 932e10a53407736e0090698f5a84364b5ad3d962978a11ae40133c458e9b285871500ae589fcc5790d66b0e024cb85702de59515b4d3097dc464672e44015981
7
- data.tar.gz: 51ee71ac7c2479acd43d8d76d471e6349dbf98bb98e6ce581ea8952897a32a6a24179308797f4d69d7baef2ed363c71bddd2751b26ffa7827fa6039fcb0312d5
6
+ metadata.gz: d90bba198b259cdb8d00e86e0669529cb7c31c17477da4c92008cd53029a05db8803ce690dcc26d929df0efcaf08de7000917fc875f5ee53689d140399cbd787
7
+ data.tar.gz: 960a8281e3add6d09eddabab8cda6a2eaac12226ee870483df83ba60061aab0b844040b49eb1b4303a7ccaf8b84bd340490c41292f5974b82ae8115fe4920a15
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ require 'rake/testtask'
4
+ Rake::TestTask.new('test:unit') do |t|
5
+ t.test_files = FileList['test/*_test.rb']
6
+ end
7
+ task :test => ['test:unit']
@@ -1,3 +1,3 @@
1
1
  module MD2ReVIEW
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -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>{#{escape_inline(link)}}"
97
+ "@<href>{#{escape_href(link)}}"
94
98
  end
95
99
 
96
100
  def link(link, title, content)
97
- "@<href>{#{escape_inline(link)},#{escape_inline(content)}}"
101
+ "@<href>{#{escape_href(link)},#{escape_inline(content)}}"
98
102
  end
99
103
 
100
104
  def double_emphasis(text)
@@ -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.1
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-10-19 00:00:00.000000000 Z
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