redcarpet 3.3.4 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of redcarpet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.markdown +21 -11
- data/ext/redcarpet/autolink.c +7 -0
- data/ext/redcarpet/houdini_href_e.c +5 -11
- data/ext/redcarpet/html.c +18 -1
- data/ext/redcarpet/html_blocks.h +68 -70
- data/ext/redcarpet/html_smartypants.c +3 -3
- data/ext/redcarpet/markdown.c +5 -7
- data/ext/redcarpet/rc_markdown.c +7 -1
- data/ext/redcarpet/rc_render.c +9 -0
- data/lib/redcarpet.rb +1 -1
- data/lib/redcarpet/cli.rb +1 -1
- data/redcarpet.gemspec +3 -2
- data/test/custom_render_test.rb +30 -1
- data/test/html5_test.rb +51 -38
- data/test/html_render_test.rb +80 -60
- data/test/html_toc_render_test.rb +11 -4
- data/test/markdown_test.rb +216 -181
- data/test/redcarpet_bin_test.rb +2 -2
- data/test/smarty_html_test.rb +5 -5
- data/test/smarty_pants_test.rb +5 -0
- data/test/stripdown_render_test.rb +6 -6
- data/test/test_helper.rb +9 -1
- metadata +17 -3
data/test/redcarpet_bin_test.rb
CHANGED
@@ -64,8 +64,8 @@ class RedcarpetBinTest < Redcarpet::TestCase
|
|
64
64
|
|
65
65
|
def run_bin(*args)
|
66
66
|
bin_path = File.expand_path('../../bin/redcarpet', __FILE__)
|
67
|
-
|
68
|
-
IO.popen("#{bin_path} #{args.join(" ")}") do |stream|
|
67
|
+
ruby = "ruby " if RUBY_PLATFORM =~ /mswin|mingw/
|
68
|
+
IO.popen("#{ruby}#{bin_path} #{args.join(" ")}") do |stream|
|
69
69
|
@output = stream.read
|
70
70
|
end
|
71
71
|
end
|
data/test/smarty_html_test.rb
CHANGED
@@ -8,27 +8,27 @@ class SmartyHTMLTest < Redcarpet::TestCase
|
|
8
8
|
|
9
9
|
def test_that_smartyhtml_converts_single_quotes
|
10
10
|
markdown = render("They're not for sale.")
|
11
|
-
assert_equal "<p>They’re not for sale.</p
|
11
|
+
assert_equal "<p>They’re not for sale.</p>", markdown
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_that_smartyhtml_converts_double_quotes
|
15
15
|
rd = render(%("Quoted text"))
|
16
|
-
assert_equal %(<p>“Quoted text”</p
|
16
|
+
assert_equal %(<p>“Quoted text”</p>), rd
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_that_smartyhtml_converts_double_hyphen
|
20
20
|
rd = render("double hyphen -- ndash")
|
21
|
-
assert_equal "<p>double hyphen – ndash</p
|
21
|
+
assert_equal "<p>double hyphen – ndash</p>", rd
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_that_smartyhtml_converts_triple_hyphen
|
25
25
|
rd = render("triple hyphen --- mdash")
|
26
|
-
assert_equal "<p>triple hyphen — mdash</p
|
26
|
+
assert_equal "<p>triple hyphen — mdash</p>", rd
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_that_smartyhtml_ignores_double_hyphen_in_code
|
30
30
|
rd = render("double hyphen in `--option`")
|
31
|
-
assert_equal "<p>double hyphen in <code>--option</code></p
|
31
|
+
assert_equal "<p>double hyphen in <code>--option</code></p>", rd
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_that_smartyhtml_ignores_pre
|
data/test/smarty_pants_test.rb
CHANGED
@@ -50,4 +50,9 @@ class SmartyPantsTest < Redcarpet::TestCase
|
|
50
50
|
rd = @pants.render('I am 1/4... of the way to 1/4/2000')
|
51
51
|
assert_equal "I am ¼… of the way to 1/4/2000", rd
|
52
52
|
end
|
53
|
+
|
54
|
+
def test_that_smart_converts_multiple_single_quotes
|
55
|
+
rd = @pants.render(%(<p>'First' and 'second' and 'third'</p>))
|
56
|
+
assert_equal %(<p>‘First’ and ‘second’ and ‘third’</p>), rd
|
57
|
+
end
|
53
58
|
end
|
@@ -10,21 +10,21 @@ class StripDownRender < Redcarpet::TestCase
|
|
10
10
|
markdown = "# Foo bar"
|
11
11
|
output = render(markdown)
|
12
12
|
|
13
|
-
assert_equal "Foo bar
|
13
|
+
assert_equal "Foo bar", output
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_code_blocks
|
17
17
|
markdown = "\tclass Foo\n\tend"
|
18
18
|
output = render(markdown)
|
19
19
|
|
20
|
-
assert_equal "class Foo\nend
|
20
|
+
assert_equal "class Foo\nend", output
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_images
|
24
24
|
markdown = "Look at this ![picture](http://example.org/picture.png)\n" \
|
25
25
|
"And this: ![](http://example.org/image.jpg)"
|
26
26
|
expected = "Look at this picture http://example.org/picture.png\n" \
|
27
|
-
"And this: http://example.org/image.jpg
|
27
|
+
"And this: http://example.org/image.jpg"
|
28
28
|
output = render(markdown)
|
29
29
|
|
30
30
|
assert_equal expected, output
|
@@ -32,7 +32,7 @@ class StripDownRender < Redcarpet::TestCase
|
|
32
32
|
|
33
33
|
def test_links
|
34
34
|
markdown = "Here's an [example](https://github.com)"
|
35
|
-
expected = "Here's an example (https://github.com)
|
35
|
+
expected = "Here's an example (https://github.com)"
|
36
36
|
output = render(markdown)
|
37
37
|
|
38
38
|
assert_equal expected, output
|
@@ -45,7 +45,7 @@ class StripDownRender < Redcarpet::TestCase
|
|
45
45
|
"| col 2 is | centered | $12 |"
|
46
46
|
expected = "Left-Aligned\tCentre Aligned\tRight Aligned\t\n" \
|
47
47
|
"col 3 is\tsome wordy text\t$1600\t\n" \
|
48
|
-
"col 2 is\tcentered\t$12\t
|
48
|
+
"col 2 is\tcentered\t$12\t"
|
49
49
|
output = render(markdown, with: [:tables])
|
50
50
|
|
51
51
|
assert_equal expected, output
|
@@ -53,7 +53,7 @@ class StripDownRender < Redcarpet::TestCase
|
|
53
53
|
|
54
54
|
def test_highlight
|
55
55
|
markdown = "==Hello world!=="
|
56
|
-
expected = "Hello world
|
56
|
+
expected = "Hello world!"
|
57
57
|
output = render(markdown, with: [:highlight])
|
58
58
|
|
59
59
|
assert_equal expected, output
|
data/test/test_helper.rb
CHANGED
@@ -28,7 +28,7 @@ class Redcarpet::TestCase < Test::Unit::TestCase
|
|
28
28
|
|
29
29
|
parser = Redcarpet::Markdown.new(render, options)
|
30
30
|
|
31
|
-
parser.render(markdown)
|
31
|
+
parser.render(markdown).chomp
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
@@ -36,4 +36,12 @@ class Redcarpet::TestCase < Test::Unit::TestCase
|
|
36
36
|
def renderer
|
37
37
|
@renderer ||= Redcarpet::Render::HTML
|
38
38
|
end
|
39
|
+
|
40
|
+
# Imported from Active Support
|
41
|
+
class ::String
|
42
|
+
def strip_heredoc
|
43
|
+
indent = scan(/^ *(?=\S)/).min.size || 0
|
44
|
+
gsub(/^[ \t]{#{indent}}/, '')
|
45
|
+
end
|
46
|
+
end
|
39
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redcarpet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natacha Porté
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '10.5'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '10.5'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: rake-compiler
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
127
|
version: '0'
|
114
128
|
requirements: []
|
115
129
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.5.2
|
117
131
|
signing_key:
|
118
132
|
specification_version: 4
|
119
133
|
summary: Markdown that smells nice
|