bluecloth 2.0.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/ChangeLog +784 -0
  2. data/LICENSE +27 -0
  3. data/LICENSE.discount +47 -0
  4. data/README +81 -0
  5. data/Rakefile +346 -0
  6. data/Rakefile.local +63 -0
  7. data/bin/bluecloth +84 -0
  8. data/ext/Csio.c +61 -0
  9. data/ext/VERSION +1 -0
  10. data/ext/amalloc.h +29 -0
  11. data/ext/bluecloth.c +377 -0
  12. data/ext/config.h +51 -0
  13. data/ext/css.c +76 -0
  14. data/ext/cstring.h +74 -0
  15. data/ext/docheader.c +43 -0
  16. data/ext/extconf.rb +48 -0
  17. data/ext/generate.c +1481 -0
  18. data/ext/markdown.c +970 -0
  19. data/ext/markdown.h +145 -0
  20. data/ext/mkdio.c +303 -0
  21. data/ext/mkdio.h +78 -0
  22. data/ext/resource.c +155 -0
  23. data/ext/version.c +28 -0
  24. data/ext/xml.c +82 -0
  25. data/ext/xmlpage.c +48 -0
  26. data/lib/bluecloth.rb +161 -0
  27. data/rake/191_compat.rb +26 -0
  28. data/rake/dependencies.rb +76 -0
  29. data/rake/helpers.rb +412 -0
  30. data/rake/hg.rb +214 -0
  31. data/rake/manual.rb +782 -0
  32. data/rake/packaging.rb +135 -0
  33. data/rake/publishing.rb +321 -0
  34. data/rake/rdoc.rb +30 -0
  35. data/rake/style.rb +62 -0
  36. data/rake/svn.rb +668 -0
  37. data/rake/testing.rb +187 -0
  38. data/rake/verifytask.rb +64 -0
  39. data/rake/win32.rb +190 -0
  40. data/spec/bluecloth/101_changes_spec.rb +141 -0
  41. data/spec/bluecloth/autolinks_spec.rb +49 -0
  42. data/spec/bluecloth/blockquotes_spec.rb +143 -0
  43. data/spec/bluecloth/code_spans_spec.rb +164 -0
  44. data/spec/bluecloth/emphasis_spec.rb +164 -0
  45. data/spec/bluecloth/entities_spec.rb +65 -0
  46. data/spec/bluecloth/hrules_spec.rb +90 -0
  47. data/spec/bluecloth/images_spec.rb +92 -0
  48. data/spec/bluecloth/inline_html_spec.rb +238 -0
  49. data/spec/bluecloth/links_spec.rb +171 -0
  50. data/spec/bluecloth/lists_spec.rb +294 -0
  51. data/spec/bluecloth/paragraphs_spec.rb +75 -0
  52. data/spec/bluecloth/titles_spec.rb +305 -0
  53. data/spec/bluecloth_spec.rb +250 -0
  54. data/spec/bugfix_spec.rb +136 -0
  55. data/spec/contributions_spec.rb +85 -0
  56. data/spec/data/antsugar.txt +34 -0
  57. data/spec/data/markdowntest/Amps and angle encoding.html +17 -0
  58. data/spec/data/markdowntest/Amps and angle encoding.text +21 -0
  59. data/spec/data/markdowntest/Auto links.html +18 -0
  60. data/spec/data/markdowntest/Auto links.text +13 -0
  61. data/spec/data/markdowntest/Backslash escapes.html +118 -0
  62. data/spec/data/markdowntest/Backslash escapes.text +120 -0
  63. data/spec/data/markdowntest/Blockquotes with code blocks.html +15 -0
  64. data/spec/data/markdowntest/Blockquotes with code blocks.text +11 -0
  65. data/spec/data/markdowntest/Code Blocks.html +18 -0
  66. data/spec/data/markdowntest/Code Blocks.text +14 -0
  67. data/spec/data/markdowntest/Code Spans.html +5 -0
  68. data/spec/data/markdowntest/Code Spans.text +5 -0
  69. data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.html +8 -0
  70. data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.text +8 -0
  71. data/spec/data/markdowntest/Horizontal rules.html +71 -0
  72. data/spec/data/markdowntest/Horizontal rules.text +67 -0
  73. data/spec/data/markdowntest/Inline HTML (Advanced).html +15 -0
  74. data/spec/data/markdowntest/Inline HTML (Advanced).text +15 -0
  75. data/spec/data/markdowntest/Inline HTML (Simple).html +72 -0
  76. data/spec/data/markdowntest/Inline HTML (Simple).text +69 -0
  77. data/spec/data/markdowntest/Inline HTML comments.html +13 -0
  78. data/spec/data/markdowntest/Inline HTML comments.text +13 -0
  79. data/spec/data/markdowntest/Links, inline style.html +11 -0
  80. data/spec/data/markdowntest/Links, inline style.text +12 -0
  81. data/spec/data/markdowntest/Links, reference style.html +52 -0
  82. data/spec/data/markdowntest/Links, reference style.text +71 -0
  83. data/spec/data/markdowntest/Links, shortcut references.html +9 -0
  84. data/spec/data/markdowntest/Links, shortcut references.text +20 -0
  85. data/spec/data/markdowntest/Literal quotes in titles.html +3 -0
  86. data/spec/data/markdowntest/Literal quotes in titles.text +7 -0
  87. data/spec/data/markdowntest/Markdown Documentation - Basics.html +314 -0
  88. data/spec/data/markdowntest/Markdown Documentation - Basics.text +306 -0
  89. data/spec/data/markdowntest/Markdown Documentation - Syntax.html +942 -0
  90. data/spec/data/markdowntest/Markdown Documentation - Syntax.text +888 -0
  91. data/spec/data/markdowntest/Nested blockquotes.html +9 -0
  92. data/spec/data/markdowntest/Nested blockquotes.text +5 -0
  93. data/spec/data/markdowntest/Ordered and unordered lists.html +148 -0
  94. data/spec/data/markdowntest/Ordered and unordered lists.text +131 -0
  95. data/spec/data/markdowntest/Strong and em together.html +7 -0
  96. data/spec/data/markdowntest/Strong and em together.text +7 -0
  97. data/spec/data/markdowntest/Tabs.html +25 -0
  98. data/spec/data/markdowntest/Tabs.text +21 -0
  99. data/spec/data/markdowntest/Tidyness.html +8 -0
  100. data/spec/data/markdowntest/Tidyness.text +5 -0
  101. data/spec/data/ml-announce.txt +17 -0
  102. data/spec/data/re-overflow.txt +67 -0
  103. data/spec/data/re-overflow2.txt +281 -0
  104. data/spec/discount_spec.rb +67 -0
  105. data/spec/lib/constants.rb +5 -0
  106. data/spec/lib/helpers.rb +137 -0
  107. data/spec/lib/matchers.rb +235 -0
  108. data/spec/markdowntest_spec.rb +79 -0
  109. metadata +329 -0
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent
7
+
8
+ libdir = basedir + 'lib'
9
+ extdir = basedir + 'ext'
10
+
11
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
12
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
13
+ }
14
+
15
+ require 'spec'
16
+ require 'bluecloth'
17
+
18
+ require 'spec/lib/helpers'
19
+ require 'spec/lib/constants'
20
+ require 'spec/lib/matchers'
21
+
22
+
23
+ #####################################################################
24
+ ### C O N T E X T S
25
+ #####################################################################
26
+
27
+ describe BlueCloth, "document with entities" do
28
+ include BlueCloth::TestConstants,
29
+ BlueCloth::Matchers
30
+
31
+ it "escapes special characters" do
32
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
33
+ The left shift operator, which is written as <<, is often used & greatly admired.
34
+ ---
35
+ <p>The left shift operator, which is written as &lt;&lt;, is often used &amp; greatly admired.</p>
36
+ ---
37
+ end
38
+
39
+ it "preserves named entities" do
40
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
41
+ The left shift operator, which is written as &lt;&lt;, is often used &amp; greatly admired.
42
+ ---
43
+ <p>The left shift operator, which is written as &lt;&lt;, is often used &amp; greatly admired.</p>
44
+ ---
45
+ end
46
+
47
+ it "preserves decimal-encoded entities" do
48
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
49
+ The left shift operator, which is written as &#060;&#060;, is often used &#038; greatly admired.
50
+ ---
51
+ <p>The left shift operator, which is written as &#060;&#060;, is often used &#038; greatly admired.</p>
52
+ ---
53
+ end
54
+
55
+ it "preserves hex-encoded entities" do
56
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
57
+ The left shift operator, which is written as &#x3c;&#x3c;, is often used &#x26; greatly admired.
58
+ ---
59
+ <p>The left shift operator, which is written as &#x3c;&#x3c;, is often used &#x26; greatly admired.</p>
60
+ ---
61
+ end
62
+
63
+ end
64
+
65
+
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent
7
+
8
+ libdir = basedir + 'lib'
9
+ extdir = basedir + 'ext'
10
+
11
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
12
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
13
+ }
14
+
15
+ require 'spec'
16
+ require 'bluecloth'
17
+
18
+ require 'spec/lib/helpers'
19
+ require 'spec/lib/constants'
20
+ require 'spec/lib/matchers'
21
+
22
+
23
+ #####################################################################
24
+ ### C O N T E X T S
25
+ #####################################################################
26
+
27
+ describe BlueCloth, "horizontal rules" do
28
+ include BlueCloth::TestConstants,
29
+ BlueCloth::Matchers
30
+
31
+ # Hrule -- three asterisks
32
+ it "produces a horizontal rule tag from three asterisks on a line by themselves" do
33
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
34
+ ***
35
+ ---
36
+ <hr />
37
+ ---
38
+ end
39
+
40
+ # Hrule -- three spaced-out asterisks
41
+ it "produces a horizontal rule tag from three asterisks with intervening spaces on a line " +
42
+ " by themselves" do
43
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
44
+ * * *
45
+ ---
46
+ <hr />
47
+ ---
48
+ end
49
+
50
+ # Indented Hrule -- three spaced-out asterisks
51
+ it "produces a horizontal rule tag from three asterisks with intervening spaces on a line " +
52
+ " by themselves, even if they're indented less than 4 spaces" do
53
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
54
+ * * *
55
+ ---
56
+ <hr />
57
+ ---
58
+ end
59
+
60
+ # Hrule -- more than three asterisks
61
+ it "produces a horizontal rule tag from more than three asterisks on a line by themselves" do
62
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
63
+ *****
64
+ ---
65
+ <hr />
66
+ ---
67
+ end
68
+
69
+ # Hrule -- a line of dashes
70
+ it "produces a horizontal rule tag from three dashes on a line by themselves" do
71
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
72
+ ---------------------------------------
73
+ ---
74
+ <hr />
75
+ ---
76
+ end
77
+
78
+ # Hrule -- three spaced-out dashes
79
+ it "produces a horizontal rule tag from three dashes with intervening spaces on a line " +
80
+ " by themselves" do
81
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
82
+ - - -
83
+ ---
84
+ <hr />
85
+ ---
86
+ end
87
+
88
+ end
89
+
90
+
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent
7
+
8
+ libdir = basedir + 'lib'
9
+ extdir = basedir + 'ext'
10
+
11
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
12
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
13
+ }
14
+
15
+ require 'spec'
16
+ require 'bluecloth'
17
+
18
+ require 'spec/lib/helpers'
19
+ require 'spec/lib/constants'
20
+ require 'spec/lib/matchers'
21
+
22
+
23
+ #####################################################################
24
+ ### C O N T E X T S
25
+ #####################################################################
26
+
27
+ describe BlueCloth, "images" do
28
+ include BlueCloth::TestConstants,
29
+ BlueCloth::Matchers
30
+
31
+ ### [Images]
32
+
33
+ # Inline image with title
34
+ it "transforms inline images with a title in double quotes to an IMG tag" do
35
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
36
+ ![alt text](/path/img.jpg "Title")
37
+ ---
38
+ <p><img src="/path/img.jpg" title="Title" alt="alt text" /></p>
39
+ ---
40
+ end
41
+
42
+ # Inline image with title (single-quotes)
43
+ it "transforms inline images with a title in single quotes to an IMG tag" do
44
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
45
+ ![alt text](/path/img.jpg 'Title')
46
+ ---
47
+ <p><img src="/path/img.jpg" title="Title" alt="alt text" /></p>
48
+ ---
49
+ end
50
+
51
+ # Inline image with title (with embedded quotes)
52
+ it "transforms inline images with a title that includes quotes to an IMG tag" do
53
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
54
+ ![alt text](/path/img.jpg 'The "Title" Image')
55
+ ---
56
+ <p><img src="/path/img.jpg" title="The &quot;Title&quot; Image" alt="alt text" /></p>
57
+ ---
58
+ end
59
+
60
+ # Inline image without title
61
+ it "transforms inline images without a title to an IMG tag" do
62
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
63
+ ![alt text](/path/img.jpg)
64
+ ---
65
+ <p><img src="/path/img.jpg" alt="alt text" /></p>
66
+ ---
67
+ end
68
+
69
+ # Inline image with quoted alt text
70
+ it "transforms inline images with quoted alt text to an IMG tag" do
71
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
72
+ ![the "alt text"](/path/img.jpg)
73
+ ---
74
+ <p><img src="/path/img.jpg" alt="the &quot;alt text&quot;" /></p>
75
+ ---
76
+ end
77
+
78
+
79
+ # Reference image
80
+ it "transforms image references with a title to an IMG tag" do
81
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
82
+ ![alt text][id]
83
+
84
+ [id]: /url/to/img.jpg "Title"
85
+ ---
86
+ <p><img src="/url/to/img.jpg" title="Title" alt="alt text" /></p>
87
+ ---
88
+ end
89
+
90
+ end
91
+
92
+
@@ -0,0 +1,238 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent
7
+
8
+ libdir = basedir + 'lib'
9
+ extdir = basedir + 'ext'
10
+
11
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
12
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
13
+ }
14
+
15
+ require 'spec'
16
+ require 'bluecloth'
17
+
18
+ require 'spec/lib/helpers'
19
+ require 'spec/lib/constants'
20
+ require 'spec/lib/matchers'
21
+
22
+
23
+ #####################################################################
24
+ ### C O N T E X T S
25
+ #####################################################################
26
+
27
+ describe BlueCloth, "document with inline HTML" do
28
+ include BlueCloth::TestConstants,
29
+ BlueCloth::Matchers
30
+
31
+ it "preserves TABLE block" do
32
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
33
+ This is a regular paragraph.
34
+
35
+ <table>
36
+ <tr>
37
+ <td>Foo</td>
38
+ </tr>
39
+ </table>
40
+
41
+ This is another regular paragraph.
42
+ ---
43
+ <p>This is a regular paragraph.</p>
44
+
45
+ <table>
46
+ <tr>
47
+ <td>Foo</td>
48
+ </tr>
49
+ </table>
50
+
51
+ <p>This is another regular paragraph.</p>
52
+ ---
53
+ end
54
+
55
+ it "preserves DIV block" do
56
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
57
+ This is a regular paragraph.
58
+
59
+ <div>
60
+ Something
61
+ </div>
62
+ Something else.
63
+ ---
64
+ <p>This is a regular paragraph.</p>
65
+
66
+ <div>
67
+ Something
68
+ </div>
69
+
70
+ <p>Something else.</p>
71
+ ---
72
+ end
73
+
74
+
75
+ it "preserves HRs" do
76
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
77
+ This is a regular paragraph.
78
+
79
+ <hr />
80
+
81
+ Something else.
82
+ ---
83
+ <p>This is a regular paragraph.</p>
84
+
85
+ <hr />
86
+
87
+ <p>Something else.</p>
88
+ ---
89
+ end
90
+
91
+
92
+ it "preserves fancy HRs" do
93
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
94
+ This is a regular paragraph.
95
+
96
+ <hr class="publishers-mark" id="first-hrule" />
97
+
98
+ Something else.
99
+ ---
100
+ <p>This is a regular paragraph.</p>
101
+
102
+ <hr class="publishers-mark" id="first-hrule" />
103
+
104
+ <p>Something else.</p>
105
+ ---
106
+ end
107
+
108
+
109
+ it "preserves IFRAMEs" do
110
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
111
+ This is a regular paragraph.
112
+
113
+ <iframe src="foo.html" id="foo-frame"></iframe>
114
+
115
+ Something else.
116
+ ---
117
+ <p>This is a regular paragraph.</p>
118
+
119
+ <iframe src="foo.html" id="foo-frame"></iframe>
120
+
121
+ <p>Something else.</p>
122
+ ---
123
+ end
124
+
125
+
126
+ it "preserves MathML block" do
127
+ pending "discount doesn't support this, it explicitly matches block-level HTML elements only"
128
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
129
+ Examples
130
+ --------
131
+
132
+ Now that we have met some of the key players, it is time to see what we can
133
+ do. Here are some examples and comments which illustrate the use of the basic
134
+ layout and token elements. Consider the expression x2 + 4x + 4 = 0. A basic
135
+ MathML presentation encoding for this would be:
136
+
137
+ <math>
138
+ <mrow>
139
+ <msup>
140
+ <mi>x</mi>
141
+ <mn>2</mn>
142
+ </msup>
143
+ <mo>+</mo>
144
+ <mn>4</mn>
145
+ <mi>x</mi>
146
+ <mo>+</mo>
147
+ <mn>4</mn>
148
+ <mo>=</mo>
149
+ <mn>0</mn>
150
+ </mrow>
151
+ </math>
152
+
153
+ This encoding will display as you would expect. However, if we were interested
154
+ in reusing this expression in unknown situations, we would likely want to spend
155
+ a little more effort analyzing and encoding the logical expression structure.
156
+ ---
157
+ <h2>Examples</h2>
158
+
159
+ <p>Now that we have met some of the key players, it is time to see what we can
160
+ do. Here are some examples and comments which illustrate the use of the basic
161
+ layout and token elements. Consider the expression x2 + 4x + 4 = 0. A basic
162
+ MathML presentation encoding for this would be:</p>
163
+
164
+ <math>
165
+ <mrow>
166
+ <msup>
167
+ <mi>x</mi>
168
+ <mn>2</mn>
169
+ </msup>
170
+ <mo>+</mo>
171
+ <mn>4</mn>
172
+ <mi>x</mi>
173
+ <mo>+</mo>
174
+ <mn>4</mn>
175
+ <mo>=</mo>
176
+ <mn>0</mn>
177
+ </mrow>
178
+ </math>
179
+
180
+ <p>This encoding will display as you would expect. However, if we were interested
181
+ in reusing this expression in unknown situations, we would likely want to spend
182
+ a little more effort analyzing and encoding the logical expression structure.</p>
183
+ ---
184
+ end
185
+
186
+
187
+ it "preserves span-level HTML" do
188
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
189
+ This is some stuff with a <span class="foo">spanned bit of text</span> in
190
+ it. And <del>this *should* be a bit of deleted text</del> which should be
191
+ preserved, and part of it emphasized.
192
+ ---
193
+ <p>This is some stuff with a <span class="foo">spanned bit of text</span> in
194
+ it. And <del>this <em>should</em> be a bit of deleted text</del> which should be
195
+ preserved, and part of it emphasized.</p>
196
+ ---
197
+ end
198
+
199
+ it "preserves block-level HTML case-insensitively" do
200
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
201
+ This is a regular paragraph.
202
+
203
+ <TABLE>
204
+ <TR>
205
+ <TD>Foo</TD>
206
+ </TR>
207
+ </TABLE>
208
+
209
+ This is another regular paragraph.
210
+ ---
211
+ <p>This is a regular paragraph.</p>
212
+
213
+ <TABLE>
214
+ <TR>
215
+ <TD>Foo</TD>
216
+ </TR>
217
+ </TABLE>
218
+
219
+ <p>This is another regular paragraph.</p>
220
+ ---
221
+ end
222
+
223
+ it "preserves span-level HTML case-insensitively" do
224
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
225
+ This is some stuff with a <SPAN CLASS="foo">spanned bit of text</SPAN> in
226
+ it. And <DEL>this *should* be a bit of deleted text</DEL> which should be
227
+ preserved, and part of it emphasized.
228
+ ---
229
+ <p>This is some stuff with a <SPAN CLASS="foo">spanned bit of text</SPAN> in
230
+ it. And <DEL>this <em>should</em> be a bit of deleted text</DEL> which should be
231
+ preserved, and part of it emphasized.</p>
232
+ ---
233
+ end
234
+
235
+
236
+ end
237
+
238
+