rpeg-markdown 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/README +25 -1
  2. data/Rakefile +85 -16
  3. data/ext/extconf.h +3 -0
  4. data/ext/extconf.rb +13 -2
  5. data/ext/markdown.c +27 -71
  6. data/ext/markdown_lib.c +181 -0
  7. data/ext/markdown_lib.h +19 -0
  8. data/ext/markdown_output.c +313 -327
  9. data/ext/markdown_parser.c +2817 -2920
  10. data/ext/markdown_peg.h +10 -24
  11. data/ext/parsing_functions.c +104 -0
  12. data/ext/utility_functions.c +220 -0
  13. data/lib/markdown.rb +22 -2
  14. data/test/MarkdownTest_1.0/MarkdownTest.pl +157 -0
  15. data/test/MarkdownTest_1.0/Tests/Amps and angle encoding.html +17 -0
  16. data/test/MarkdownTest_1.0/Tests/Amps and angle encoding.text +21 -0
  17. data/test/MarkdownTest_1.0/Tests/Auto links.html +18 -0
  18. data/test/MarkdownTest_1.0/Tests/Auto links.text +13 -0
  19. data/test/MarkdownTest_1.0/Tests/Backslash escapes.html +102 -0
  20. data/test/MarkdownTest_1.0/Tests/Backslash escapes.text +104 -0
  21. data/test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.html +15 -0
  22. data/test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.text +11 -0
  23. data/test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
  24. data/test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
  25. data/test/MarkdownTest_1.0/Tests/Horizontal rules.html +71 -0
  26. data/test/MarkdownTest_1.0/Tests/Horizontal rules.text +67 -0
  27. data/test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).html +14 -0
  28. data/test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).text +14 -0
  29. data/test/MarkdownTest_1.0/Tests/Inline HTML (Simple).html +72 -0
  30. data/test/MarkdownTest_1.0/Tests/Inline HTML (Simple).text +69 -0
  31. data/test/MarkdownTest_1.0/Tests/Inline HTML comments.html +13 -0
  32. data/test/MarkdownTest_1.0/Tests/Inline HTML comments.text +13 -0
  33. data/test/MarkdownTest_1.0/Tests/Links, inline style.html +9 -0
  34. data/test/MarkdownTest_1.0/Tests/Links, inline style.text +9 -0
  35. data/test/MarkdownTest_1.0/Tests/Links, reference style.html +18 -0
  36. data/test/MarkdownTest_1.0/Tests/Links, reference style.text +31 -0
  37. data/test/MarkdownTest_1.0/Tests/Literal quotes in titles.html +3 -0
  38. data/test/MarkdownTest_1.0/Tests/Literal quotes in titles.text +7 -0
  39. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.html +314 -0
  40. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.text +306 -0
  41. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.html +942 -0
  42. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.text +888 -0
  43. data/test/MarkdownTest_1.0/Tests/Nested blockquotes.html +9 -0
  44. data/test/MarkdownTest_1.0/Tests/Nested blockquotes.text +5 -0
  45. data/test/MarkdownTest_1.0/Tests/Ordered and unordered lists.html +137 -0
  46. data/test/MarkdownTest_1.0/Tests/Ordered and unordered lists.text +122 -0
  47. data/test/MarkdownTest_1.0/Tests/Strong and em together.html +7 -0
  48. data/test/MarkdownTest_1.0/Tests/Strong and em together.text +7 -0
  49. data/test/MarkdownTest_1.0/Tests/Tabs.html +25 -0
  50. data/test/MarkdownTest_1.0/Tests/Tabs.text +21 -0
  51. data/test/MarkdownTest_1.0/Tests/Tidyness.html +8 -0
  52. data/test/MarkdownTest_1.0/Tests/Tidyness.text +5 -0
  53. data/test/MarkdownTest_1.0.3/MarkdownTest.pl +176 -0
  54. data/test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html +17 -0
  55. data/test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text +21 -0
  56. data/test/MarkdownTest_1.0.3/Tests/Auto links.html +18 -0
  57. data/test/MarkdownTest_1.0.3/Tests/Auto links.text +13 -0
  58. data/test/MarkdownTest_1.0.3/Tests/Backslash escapes.html +118 -0
  59. data/test/MarkdownTest_1.0.3/Tests/Backslash escapes.text +120 -0
  60. data/test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html +15 -0
  61. data/test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text +11 -0
  62. data/test/MarkdownTest_1.0.3/Tests/Code Blocks.html +18 -0
  63. data/test/MarkdownTest_1.0.3/Tests/Code Blocks.text +14 -0
  64. data/test/MarkdownTest_1.0.3/Tests/Code Spans.html +6 -0
  65. data/test/MarkdownTest_1.0.3/Tests/Code Spans.text +6 -0
  66. data/test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
  67. data/test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
  68. data/test/MarkdownTest_1.0.3/Tests/Horizontal rules.html +71 -0
  69. data/test/MarkdownTest_1.0.3/Tests/Horizontal rules.text +67 -0
  70. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html +15 -0
  71. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text +15 -0
  72. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html +72 -0
  73. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text +69 -0
  74. data/test/MarkdownTest_1.0.3/Tests/Inline HTML comments.html +13 -0
  75. data/test/MarkdownTest_1.0.3/Tests/Inline HTML comments.text +13 -0
  76. data/test/MarkdownTest_1.0.3/Tests/Links, inline style.html +11 -0
  77. data/test/MarkdownTest_1.0.3/Tests/Links, inline style.text +12 -0
  78. data/test/MarkdownTest_1.0.3/Tests/Links, reference style.html +52 -0
  79. data/test/MarkdownTest_1.0.3/Tests/Links, reference style.text +71 -0
  80. data/test/MarkdownTest_1.0.3/Tests/Links, shortcut references.html +9 -0
  81. data/test/MarkdownTest_1.0.3/Tests/Links, shortcut references.text +20 -0
  82. data/test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html +3 -0
  83. data/test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text +7 -0
  84. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html +314 -0
  85. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text +306 -0
  86. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html +942 -0
  87. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text +888 -0
  88. data/test/MarkdownTest_1.0.3/Tests/Nested blockquotes.html +9 -0
  89. data/test/MarkdownTest_1.0.3/Tests/Nested blockquotes.text +5 -0
  90. data/test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html +148 -0
  91. data/test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text +131 -0
  92. data/test/MarkdownTest_1.0.3/Tests/Strong and em together.html +7 -0
  93. data/test/MarkdownTest_1.0.3/Tests/Strong and em together.text +7 -0
  94. data/test/MarkdownTest_1.0.3/Tests/Tabs.html +25 -0
  95. data/test/MarkdownTest_1.0.3/Tests/Tabs.text +21 -0
  96. data/test/MarkdownTest_1.0.3/Tests/Tidyness.html +8 -0
  97. data/test/MarkdownTest_1.0.3/Tests/Tidyness.text +5 -0
  98. data/test/benchmark.rb +49 -0
  99. data/test/markdown_test.rb +78 -0
  100. metadata +96 -6
  101. data/ext/markdown_buffer.c +0 -46
  102. data/ext/markdown_buffer.h +0 -6
  103. data/test.rb +0 -25
@@ -0,0 +1,9 @@
1
+ <blockquote>
2
+ <p>foo</p>
3
+
4
+ <blockquote>
5
+ <p>bar</p>
6
+ </blockquote>
7
+
8
+ <p>foo</p>
9
+ </blockquote>
@@ -0,0 +1,5 @@
1
+ > foo
2
+ >
3
+ > > bar
4
+ >
5
+ > foo
@@ -0,0 +1,148 @@
1
+ <h2>Unordered</h2>
2
+
3
+ <p>Asterisks tight:</p>
4
+
5
+ <ul>
6
+ <li>asterisk 1</li>
7
+ <li>asterisk 2</li>
8
+ <li>asterisk 3</li>
9
+ </ul>
10
+
11
+ <p>Asterisks loose:</p>
12
+
13
+ <ul>
14
+ <li><p>asterisk 1</p></li>
15
+ <li><p>asterisk 2</p></li>
16
+ <li><p>asterisk 3</p></li>
17
+ </ul>
18
+
19
+ <hr />
20
+
21
+ <p>Pluses tight:</p>
22
+
23
+ <ul>
24
+ <li>Plus 1</li>
25
+ <li>Plus 2</li>
26
+ <li>Plus 3</li>
27
+ </ul>
28
+
29
+ <p>Pluses loose:</p>
30
+
31
+ <ul>
32
+ <li><p>Plus 1</p></li>
33
+ <li><p>Plus 2</p></li>
34
+ <li><p>Plus 3</p></li>
35
+ </ul>
36
+
37
+ <hr />
38
+
39
+ <p>Minuses tight:</p>
40
+
41
+ <ul>
42
+ <li>Minus 1</li>
43
+ <li>Minus 2</li>
44
+ <li>Minus 3</li>
45
+ </ul>
46
+
47
+ <p>Minuses loose:</p>
48
+
49
+ <ul>
50
+ <li><p>Minus 1</p></li>
51
+ <li><p>Minus 2</p></li>
52
+ <li><p>Minus 3</p></li>
53
+ </ul>
54
+
55
+ <h2>Ordered</h2>
56
+
57
+ <p>Tight:</p>
58
+
59
+ <ol>
60
+ <li>First</li>
61
+ <li>Second</li>
62
+ <li>Third</li>
63
+ </ol>
64
+
65
+ <p>and:</p>
66
+
67
+ <ol>
68
+ <li>One</li>
69
+ <li>Two</li>
70
+ <li>Three</li>
71
+ </ol>
72
+
73
+ <p>Loose using tabs:</p>
74
+
75
+ <ol>
76
+ <li><p>First</p></li>
77
+ <li><p>Second</p></li>
78
+ <li><p>Third</p></li>
79
+ </ol>
80
+
81
+ <p>and using spaces:</p>
82
+
83
+ <ol>
84
+ <li><p>One</p></li>
85
+ <li><p>Two</p></li>
86
+ <li><p>Three</p></li>
87
+ </ol>
88
+
89
+ <p>Multiple paragraphs:</p>
90
+
91
+ <ol>
92
+ <li><p>Item 1, graf one.</p>
93
+
94
+ <p>Item 2. graf two. The quick brown fox jumped over the lazy dog's
95
+ back.</p></li>
96
+ <li><p>Item 2.</p></li>
97
+ <li><p>Item 3.</p></li>
98
+ </ol>
99
+
100
+ <h2>Nested</h2>
101
+
102
+ <ul>
103
+ <li>Tab
104
+ <ul>
105
+ <li>Tab
106
+ <ul>
107
+ <li>Tab</li>
108
+ </ul></li>
109
+ </ul></li>
110
+ </ul>
111
+
112
+ <p>Here's another:</p>
113
+
114
+ <ol>
115
+ <li>First</li>
116
+ <li>Second:
117
+ <ul>
118
+ <li>Fee</li>
119
+ <li>Fie</li>
120
+ <li>Foe</li>
121
+ </ul></li>
122
+ <li>Third</li>
123
+ </ol>
124
+
125
+ <p>Same thing but with paragraphs:</p>
126
+
127
+ <ol>
128
+ <li><p>First</p></li>
129
+ <li><p>Second:</p>
130
+
131
+ <ul>
132
+ <li>Fee</li>
133
+ <li>Fie</li>
134
+ <li>Foe</li>
135
+ </ul></li>
136
+ <li><p>Third</p></li>
137
+ </ol>
138
+
139
+
140
+ <p>This was an error in Markdown 1.0.1:</p>
141
+
142
+ <ul>
143
+ <li><p>this</p>
144
+
145
+ <ul><li>sub</li></ul>
146
+
147
+ <p>that</p></li>
148
+ </ul>
@@ -0,0 +1,131 @@
1
+ ## Unordered
2
+
3
+ Asterisks tight:
4
+
5
+ * asterisk 1
6
+ * asterisk 2
7
+ * asterisk 3
8
+
9
+
10
+ Asterisks loose:
11
+
12
+ * asterisk 1
13
+
14
+ * asterisk 2
15
+
16
+ * asterisk 3
17
+
18
+ * * *
19
+
20
+ Pluses tight:
21
+
22
+ + Plus 1
23
+ + Plus 2
24
+ + Plus 3
25
+
26
+
27
+ Pluses loose:
28
+
29
+ + Plus 1
30
+
31
+ + Plus 2
32
+
33
+ + Plus 3
34
+
35
+ * * *
36
+
37
+
38
+ Minuses tight:
39
+
40
+ - Minus 1
41
+ - Minus 2
42
+ - Minus 3
43
+
44
+
45
+ Minuses loose:
46
+
47
+ - Minus 1
48
+
49
+ - Minus 2
50
+
51
+ - Minus 3
52
+
53
+
54
+ ## Ordered
55
+
56
+ Tight:
57
+
58
+ 1. First
59
+ 2. Second
60
+ 3. Third
61
+
62
+ and:
63
+
64
+ 1. One
65
+ 2. Two
66
+ 3. Three
67
+
68
+
69
+ Loose using tabs:
70
+
71
+ 1. First
72
+
73
+ 2. Second
74
+
75
+ 3. Third
76
+
77
+ and using spaces:
78
+
79
+ 1. One
80
+
81
+ 2. Two
82
+
83
+ 3. Three
84
+
85
+ Multiple paragraphs:
86
+
87
+ 1. Item 1, graf one.
88
+
89
+ Item 2. graf two. The quick brown fox jumped over the lazy dog's
90
+ back.
91
+
92
+ 2. Item 2.
93
+
94
+ 3. Item 3.
95
+
96
+
97
+
98
+ ## Nested
99
+
100
+ * Tab
101
+ * Tab
102
+ * Tab
103
+
104
+ Here's another:
105
+
106
+ 1. First
107
+ 2. Second:
108
+ * Fee
109
+ * Fie
110
+ * Foe
111
+ 3. Third
112
+
113
+ Same thing but with paragraphs:
114
+
115
+ 1. First
116
+
117
+ 2. Second:
118
+ * Fee
119
+ * Fie
120
+ * Foe
121
+
122
+ 3. Third
123
+
124
+
125
+ This was an error in Markdown 1.0.1:
126
+
127
+ * this
128
+
129
+ * sub
130
+
131
+ that
@@ -0,0 +1,7 @@
1
+ <p><strong><em>This is strong and em.</em></strong></p>
2
+
3
+ <p>So is <strong><em>this</em></strong> word.</p>
4
+
5
+ <p><strong><em>This is strong and em.</em></strong></p>
6
+
7
+ <p>So is <strong><em>this</em></strong> word.</p>
@@ -0,0 +1,7 @@
1
+ ***This is strong and em.***
2
+
3
+ So is ***this*** word.
4
+
5
+ ___This is strong and em.___
6
+
7
+ So is ___this___ word.
@@ -0,0 +1,25 @@
1
+ <ul>
2
+ <li><p>this is a list item
3
+ indented with tabs</p></li>
4
+ <li><p>this is a list item
5
+ indented with spaces</p></li>
6
+ </ul>
7
+
8
+ <p>Code:</p>
9
+
10
+ <pre><code>this code block is indented by one tab
11
+ </code></pre>
12
+
13
+ <p>And:</p>
14
+
15
+ <pre><code> this code block is indented by two tabs
16
+ </code></pre>
17
+
18
+ <p>And:</p>
19
+
20
+ <pre><code>+ this is an example list item
21
+ indented with tabs
22
+
23
+ + this is an example list item
24
+ indented with spaces
25
+ </code></pre>
@@ -0,0 +1,21 @@
1
+ + this is a list item
2
+ indented with tabs
3
+
4
+ + this is a list item
5
+ indented with spaces
6
+
7
+ Code:
8
+
9
+ this code block is indented by one tab
10
+
11
+ And:
12
+
13
+ this code block is indented by two tabs
14
+
15
+ And:
16
+
17
+ + this is an example list item
18
+ indented with tabs
19
+
20
+ + this is an example list item
21
+ indented with spaces
@@ -0,0 +1,8 @@
1
+ <blockquote>
2
+ <p>A list within a blockquote:</p>
3
+ <ul>
4
+ <li>asterisk 1</li>
5
+ <li>asterisk 2</li>
6
+ <li>asterisk 3</li>
7
+ </ul>
8
+ </blockquote>
@@ -0,0 +1,5 @@
1
+ > A list within a blockquote:
2
+ >
3
+ > * asterisk 1
4
+ > * asterisk 2
5
+ > * asterisk 3
data/test/benchmark.rb ADDED
@@ -0,0 +1,49 @@
1
+ require 'rubygems'
2
+
3
+ iterations = 100
4
+ test_file = "#{File.dirname(__FILE__)}/benchmark.txt"
5
+ implementations = %w[BlueCloth RDiscount Maruku Markdown]
6
+
7
+ # Attempt to require each implementation and remove any that are not
8
+ # installed.
9
+ implementations.reject! do |class_name|
10
+ begin
11
+ require class_name.downcase
12
+ false
13
+ rescue LoadError => boom
14
+ puts "#{class_name} excluded from benchmark. (Try: gem install #{class_name.downcase})"
15
+ true
16
+ end
17
+ end
18
+
19
+ # Grab actual class objects.
20
+ implementations.map! { |class_name| Object.const_get(class_name) }
21
+
22
+ # The actual benchmark.
23
+ def benchmark(implementation, text, iterations)
24
+ start = Time.now
25
+ iterations.times do |i|
26
+ implementation.new(text).to_html
27
+ end
28
+ Time.now - start
29
+ end
30
+
31
+ # Read test file
32
+ test_data = File.read(test_file)
33
+
34
+ # Prime the pump
35
+ puts "Spinning up ..."
36
+ implementations.each { |impl| benchmark(impl, test_data, 1) }
37
+
38
+ # Run benchmarks; gather results.
39
+ puts "Running benchmarks ..."
40
+ results =
41
+ implementations.inject([]) do |r,impl|
42
+ GC.start
43
+ r << [ impl, benchmark(impl, test_data, iterations) ]
44
+ end
45
+
46
+ puts "Results for #{iterations} iterations:"
47
+ results.each do |impl,time|
48
+ printf " %10s %09.06fs total time, %09.06fs average\n", "#{impl}:", time, time / iterations
49
+ end
@@ -0,0 +1,78 @@
1
+ $: << File.join(File.dirname(__FILE__), "../lib")
2
+
3
+ require 'test/unit'
4
+ require 'markdown'
5
+
6
+ MARKDOWN_TEST_DIR = "#{File.dirname(__FILE__)}/MarkdownTest_1.0.3"
7
+
8
+ class MarkdownTest < Test::Unit::TestCase
9
+
10
+ def test_that_extension_methods_are_present_on_markdown_class
11
+ assert Markdown.instance_methods.include?('to_html'),
12
+ "Markdown class should respond to #to_html"
13
+ end
14
+
15
+ def test_that_simple_one_liner_goes_to_html
16
+ markdown = Markdown.new('Hello World.')
17
+ assert_respond_to markdown, :to_html
18
+ assert_equal "<p>Hello World.</p>", markdown.to_html.strip
19
+ end
20
+
21
+ def test_that_inline_markdown_goes_to_html
22
+ markdown = Markdown.new('_Hello World_!')
23
+ assert_respond_to markdown, :to_html
24
+ assert_equal "<p><em>Hello World</em>!</p>", markdown.to_html.strip
25
+ end
26
+
27
+ def test_that_bluecloth_restrictions_are_supported
28
+ markdown = Markdown.new('Hello World.')
29
+ [:filter_html, :filter_styles].each do |restriction|
30
+ assert_respond_to markdown, restriction
31
+ assert_respond_to markdown, "#{restriction}="
32
+ end
33
+ assert_not_equal true, markdown.filter_html
34
+ assert_not_equal true, markdown.filter_styles
35
+
36
+ markdown = Markdown.new('Hello World.', :filter_html, :filter_styles)
37
+ assert_equal true, markdown.filter_html
38
+ assert_equal true, markdown.filter_styles
39
+ end
40
+
41
+ def test_that_redcloth_attributes_are_supported
42
+ markdown = Markdown.new('Hello World.')
43
+ assert_respond_to markdown, :fold_lines
44
+ assert_respond_to markdown, :fold_lines=
45
+ assert_not_equal true, markdown.fold_lines
46
+
47
+ markdown = Markdown.new('Hello World.', :fold_lines)
48
+ assert_equal true, markdown.fold_lines
49
+ end
50
+
51
+ def test_that_redcloth_to_html_with_single_arg_is_supported
52
+ markdown = Markdown.new('Hello World.')
53
+ assert_nothing_raised(ArgumentError) { markdown.to_html(true) }
54
+ end
55
+
56
+ # Build tests for each file in the MarkdownTest test suite
57
+
58
+ Dir["#{MARKDOWN_TEST_DIR}/Tests/*.text"].each do |text_file|
59
+
60
+ basename = File.basename(text_file).sub(/\.text$/, '')
61
+ html_file = text_file.sub(/text$/, 'html')
62
+ method_name = basename.gsub(/[-,]/, '').gsub(/\s+/, '_').downcase
63
+
64
+ define_method "test_#{method_name}" do
65
+ markdown = Markdown.new(File.read(text_file))
66
+ actual_html = markdown.to_html
67
+ assert_not_nil actual_html
68
+ end
69
+
70
+ define_method "test_#{method_name}_with_smarty_enabled" do
71
+ markdown = Markdown.new(File.read(text_file), :smart)
72
+ actual_html = markdown.to_html
73
+ assert_not_nil actual_html
74
+ end
75
+
76
+ end
77
+
78
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpeg-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-21 00:00:00 -04:00
12
+ date: 2008-07-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -26,15 +26,105 @@ files:
26
26
  - README
27
27
  - LICENSE
28
28
  - Rakefile
29
- - test.rb
30
29
  - lib/markdown.rb
31
30
  - ext/extconf.rb
31
+ - test/benchmark.rb
32
+ - test/markdown_test.rb
32
33
  - ext/markdown.c
33
- - ext/markdown_buffer.c
34
+ - ext/markdown_lib.c
34
35
  - ext/markdown_output.c
35
36
  - ext/markdown_parser.c
36
- - ext/markdown_buffer.h
37
+ - ext/parsing_functions.c
38
+ - ext/utility_functions.c
39
+ - ext/extconf.h
40
+ - ext/markdown_lib.h
37
41
  - ext/markdown_peg.h
42
+ - test/MarkdownTest_1.0/MarkdownTest.pl
43
+ - test/MarkdownTest_1.0/Tests
44
+ - test/MarkdownTest_1.0/Tests/Amps and angle encoding.html
45
+ - test/MarkdownTest_1.0/Tests/Amps and angle encoding.text
46
+ - test/MarkdownTest_1.0/Tests/Auto links.html
47
+ - test/MarkdownTest_1.0/Tests/Auto links.text
48
+ - test/MarkdownTest_1.0/Tests/Backslash escapes.html
49
+ - test/MarkdownTest_1.0/Tests/Backslash escapes.text
50
+ - test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.html
51
+ - test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.text
52
+ - test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.html
53
+ - test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.text
54
+ - test/MarkdownTest_1.0/Tests/Horizontal rules.html
55
+ - test/MarkdownTest_1.0/Tests/Horizontal rules.text
56
+ - test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).html
57
+ - test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).text
58
+ - test/MarkdownTest_1.0/Tests/Inline HTML (Simple).html
59
+ - test/MarkdownTest_1.0/Tests/Inline HTML (Simple).text
60
+ - test/MarkdownTest_1.0/Tests/Inline HTML comments.html
61
+ - test/MarkdownTest_1.0/Tests/Inline HTML comments.text
62
+ - test/MarkdownTest_1.0/Tests/Links, inline style.html
63
+ - test/MarkdownTest_1.0/Tests/Links, inline style.text
64
+ - test/MarkdownTest_1.0/Tests/Links, reference style.html
65
+ - test/MarkdownTest_1.0/Tests/Links, reference style.text
66
+ - test/MarkdownTest_1.0/Tests/Literal quotes in titles.html
67
+ - test/MarkdownTest_1.0/Tests/Literal quotes in titles.text
68
+ - test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.html
69
+ - test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.text
70
+ - test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.html
71
+ - test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.text
72
+ - test/MarkdownTest_1.0/Tests/Nested blockquotes.html
73
+ - test/MarkdownTest_1.0/Tests/Nested blockquotes.text
74
+ - test/MarkdownTest_1.0/Tests/Ordered and unordered lists.html
75
+ - test/MarkdownTest_1.0/Tests/Ordered and unordered lists.text
76
+ - test/MarkdownTest_1.0/Tests/Strong and em together.html
77
+ - test/MarkdownTest_1.0/Tests/Strong and em together.text
78
+ - test/MarkdownTest_1.0/Tests/Tabs.html
79
+ - test/MarkdownTest_1.0/Tests/Tabs.text
80
+ - test/MarkdownTest_1.0/Tests/Tidyness.html
81
+ - test/MarkdownTest_1.0/Tests/Tidyness.text
82
+ - test/MarkdownTest_1.0.3/MarkdownTest.pl
83
+ - test/MarkdownTest_1.0.3/Tests
84
+ - test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html
85
+ - test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text
86
+ - test/MarkdownTest_1.0.3/Tests/Auto links.html
87
+ - test/MarkdownTest_1.0.3/Tests/Auto links.text
88
+ - test/MarkdownTest_1.0.3/Tests/Backslash escapes.html
89
+ - test/MarkdownTest_1.0.3/Tests/Backslash escapes.text
90
+ - test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html
91
+ - test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text
92
+ - test/MarkdownTest_1.0.3/Tests/Code Blocks.html
93
+ - test/MarkdownTest_1.0.3/Tests/Code Blocks.text
94
+ - test/MarkdownTest_1.0.3/Tests/Code Spans.html
95
+ - test/MarkdownTest_1.0.3/Tests/Code Spans.text
96
+ - test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html
97
+ - test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text
98
+ - test/MarkdownTest_1.0.3/Tests/Horizontal rules.html
99
+ - test/MarkdownTest_1.0.3/Tests/Horizontal rules.text
100
+ - test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html
101
+ - test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text
102
+ - test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html
103
+ - test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text
104
+ - test/MarkdownTest_1.0.3/Tests/Inline HTML comments.html
105
+ - test/MarkdownTest_1.0.3/Tests/Inline HTML comments.text
106
+ - test/MarkdownTest_1.0.3/Tests/Links, inline style.html
107
+ - test/MarkdownTest_1.0.3/Tests/Links, inline style.text
108
+ - test/MarkdownTest_1.0.3/Tests/Links, reference style.html
109
+ - test/MarkdownTest_1.0.3/Tests/Links, reference style.text
110
+ - test/MarkdownTest_1.0.3/Tests/Links, shortcut references.html
111
+ - test/MarkdownTest_1.0.3/Tests/Links, shortcut references.text
112
+ - test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html
113
+ - test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text
114
+ - test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html
115
+ - test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text
116
+ - test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html
117
+ - test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text
118
+ - test/MarkdownTest_1.0.3/Tests/Nested blockquotes.html
119
+ - test/MarkdownTest_1.0.3/Tests/Nested blockquotes.text
120
+ - test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html
121
+ - test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text
122
+ - test/MarkdownTest_1.0.3/Tests/Strong and em together.html
123
+ - test/MarkdownTest_1.0.3/Tests/Strong and em together.text
124
+ - test/MarkdownTest_1.0.3/Tests/Tabs.html
125
+ - test/MarkdownTest_1.0.3/Tests/Tabs.text
126
+ - test/MarkdownTest_1.0.3/Tests/Tidyness.html
127
+ - test/MarkdownTest_1.0.3/Tests/Tidyness.text
38
128
  - bin/rpeg-markdown
39
129
  has_rdoc: true
40
130
  homepage: http://github.com/rtomayko/rpeg-markdown
@@ -63,4 +153,4 @@ signing_key:
63
153
  specification_version: 2
64
154
  summary: Ruby extension library for peg-markdown
65
155
  test_files:
66
- - test.rb
156
+ - test/markdown_test.rb
@@ -1,46 +0,0 @@
1
- #include <stdio.h>
2
- #include <stdarg.h>
3
- #include "ruby.h"
4
- #include "markdown_buffer.h"
5
-
6
- static VALUE markdown_buffer;
7
- static int registered = 0;
8
-
9
- VALUE rb_markdown_buffer_init(long size) {
10
- if ( registered != 1 ) {
11
- rb_gc_register_address(&markdown_buffer);
12
- registered = 1;
13
- }
14
- markdown_buffer = rb_str_buf_new(size);
15
- return markdown_buffer;
16
- }
17
-
18
- void rb_markdown_buffer_free(void) {
19
- markdown_buffer = Qnil;
20
- }
21
-
22
- int rb_markdown_buffer_printf(const char * format, ...)
23
- {
24
- va_list args;
25
- int length;
26
- char * buf = NULL;
27
-
28
- va_start(args, format);
29
- length = vasprintf(&buf, format, args);
30
- va_end(args);
31
-
32
- if ( buf != NULL ) {
33
- rb_str_buf_cat(markdown_buffer, buf, length);
34
- free(buf);
35
- } else {
36
- /* TODO: handle out of memory condition */
37
- }
38
-
39
- return length;
40
- }
41
-
42
- char rb_markdown_buffer_putchar(char c)
43
- {
44
- rb_str_buf_cat(markdown_buffer, &c, 1);
45
- return c;
46
- }
@@ -1,6 +0,0 @@
1
- #include "ruby.h"
2
-
3
- VALUE rb_markdown_buffer_init(long size);
4
- void rb_markdown_buffer_free(void);
5
- int rb_markdown_buffer_printf(const char * format, ...);
6
- char rb_markdown_buffer_putchar(char c);