bluecloth 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/ChangeLog +29 -2
- data/Rakefile +18 -15
- data/ext/VERSION +1 -1
- data/ext/bluecloth.c +26 -5
- data/ext/config.h +13 -2
- data/ext/css.c +14 -5
- data/ext/cstring.h +1 -1
- data/ext/docheader.c +13 -7
- data/ext/emmatch.c +1 -1
- data/ext/generate.c +134 -48
- data/ext/markdown.c +207 -94
- data/ext/markdown.h +37 -28
- data/ext/mkdio.c +39 -32
- data/ext/mkdio.h +34 -24
- data/ext/resource.c +3 -1
- data/ext/setup.c +47 -0
- data/ext/tags.c +15 -2
- data/ext/tags.h +1 -0
- data/lib/bluecloth.rb +65 -40
- data/rake/documentation.rb +9 -1
- data/rake/hg.rb +34 -3
- data/rake/packaging.rb +1 -1
- data/rake/publishing.rb +2 -9
- data/rake/testing.rb +53 -88
- data/spec/bluecloth/101_changes_spec.rb +17 -17
- data/spec/bluecloth/autolinks_spec.rb +1 -1
- data/spec/bluecloth/blockquotes_spec.rb +18 -18
- data/spec/bluecloth/code_spans_spec.rb +1 -1
- data/spec/bluecloth/emphasis_spec.rb +1 -1
- data/spec/bluecloth/entities_spec.rb +1 -1
- data/spec/bluecloth/hrules_spec.rb +1 -1
- data/spec/bluecloth/images_spec.rb +1 -1
- data/spec/bluecloth/inline_html_spec.rb +1 -1
- data/spec/bluecloth/links_spec.rb +1 -1
- data/spec/bluecloth/lists_spec.rb +1 -1
- data/spec/bluecloth/paragraphs_spec.rb +1 -1
- data/spec/bluecloth/titles_spec.rb +1 -1
- data/spec/bluecloth_spec.rb +13 -13
- data/spec/bugfix_spec.rb +6 -1
- data/spec/contributions_spec.rb +1 -1
- data/spec/discount_spec.rb +2 -2
- data/spec/lib/helpers.rb +1 -124
- data/spec/lib/matchers.rb +1 -1
- data/spec/markdowntest_spec.rb +1 -1
- metadata +10 -10
- metadata.gz.sig +0 -0
@@ -4,16 +4,16 @@
|
|
4
4
|
BEGIN {
|
5
5
|
require 'pathname'
|
6
6
|
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
7
|
-
|
7
|
+
|
8
8
|
libdir = basedir + 'lib'
|
9
9
|
extdir = basedir + 'ext'
|
10
|
-
|
10
|
+
|
11
11
|
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
12
12
|
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
13
13
|
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
14
14
|
}
|
15
15
|
|
16
|
-
require '
|
16
|
+
require 'rspec'
|
17
17
|
require 'bluecloth'
|
18
18
|
|
19
19
|
require 'spec/lib/helpers'
|
@@ -25,7 +25,7 @@ require 'spec/lib/matchers'
|
|
25
25
|
### C O N T E X T S
|
26
26
|
#####################################################################
|
27
27
|
|
28
|
-
describe BlueCloth, "1.0.1 changes" do
|
28
|
+
describe BlueCloth, "after the 1.0.1 changes" do
|
29
29
|
include BlueCloth::TestConstants,
|
30
30
|
BlueCloth::Matchers
|
31
31
|
|
@@ -36,16 +36,16 @@ describe BlueCloth, "1.0.1 changes" do
|
|
36
36
|
formatting syntax. For example, if you wanted to surround a word with
|
37
37
|
literal asterisks (instead of an HTML `<em>` tag), you can backslashes
|
38
38
|
before the asterisks, like this:
|
39
|
-
|
39
|
+
|
40
40
|
\\*literal asterisks\\*
|
41
|
-
|
41
|
+
|
42
42
|
---
|
43
43
|
<p>Markdown allows you to use backslash escapes to generate literal
|
44
44
|
characters which would otherwise have special meaning in Markdown's
|
45
45
|
formatting syntax. For example, if you wanted to surround a word with
|
46
46
|
literal asterisks (instead of an HTML <code><em></code> tag), you can backslashes
|
47
47
|
before the asterisks, like this:</p>
|
48
|
-
|
48
|
+
|
49
49
|
<pre><code>\\*literal asterisks\\*
|
50
50
|
</code></pre>
|
51
51
|
---
|
@@ -63,11 +63,11 @@ describe BlueCloth, "1.0.1 changes" do
|
|
63
63
|
it "converts reference-style links at or deeper than tab width to code blocks" do
|
64
64
|
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
65
65
|
An [example][ex] reference-style link.
|
66
|
-
|
66
|
+
|
67
67
|
[ex]: http://www.bluefi.com/
|
68
68
|
---
|
69
69
|
<p>An [example][ex] reference-style link.</p>
|
70
|
-
|
70
|
+
|
71
71
|
<pre><code>[ex]: http://www.bluefi.com/
|
72
72
|
</code></pre>
|
73
73
|
---
|
@@ -115,23 +115,23 @@ describe BlueCloth, "1.0.1 changes" do
|
|
115
115
|
it "correctly marks up header + list + code" do
|
116
116
|
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
117
117
|
## This is a header.
|
118
|
-
|
118
|
+
|
119
119
|
1. This is the first list item.
|
120
120
|
2. This is the second list item.
|
121
|
-
|
121
|
+
|
122
122
|
Here's some example code:
|
123
|
-
|
123
|
+
|
124
124
|
return shell_exec("echo $input | $markdown_script");
|
125
125
|
---
|
126
126
|
<h2>This is a header.</h2>
|
127
|
-
|
127
|
+
|
128
128
|
<ol>
|
129
|
-
<li>This is the first list item.</li>
|
130
|
-
<li>This is the second list item.</li>
|
129
|
+
<li> This is the first list item.</li>
|
130
|
+
<li> This is the second list item.</li>
|
131
131
|
</ol>
|
132
|
-
|
132
|
+
|
133
133
|
<p>Here's some example code:</p>
|
134
|
-
|
134
|
+
|
135
135
|
<pre><code>return shell_exec("echo $input | $markdown_script");
|
136
136
|
</code></pre>
|
137
137
|
---
|
@@ -4,16 +4,16 @@
|
|
4
4
|
BEGIN {
|
5
5
|
require 'pathname'
|
6
6
|
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
7
|
-
|
7
|
+
|
8
8
|
libdir = basedir + 'lib'
|
9
9
|
extdir = basedir + 'ext'
|
10
|
-
|
10
|
+
|
11
11
|
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
12
12
|
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
13
13
|
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
14
14
|
}
|
15
15
|
|
16
|
-
require '
|
16
|
+
require 'rspec'
|
17
17
|
require 'bluecloth'
|
18
18
|
|
19
19
|
require 'spec/lib/helpers'
|
@@ -72,14 +72,14 @@ describe BlueCloth, "blockquotes" do
|
|
72
72
|
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
|
73
73
|
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
|
74
74
|
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
|
75
|
-
|
75
|
+
|
76
76
|
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
|
77
77
|
id sem consectetuer libero luctus adipiscing.
|
78
78
|
---
|
79
79
|
<blockquote><p>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
|
80
80
|
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
|
81
81
|
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.</p>
|
82
|
-
|
82
|
+
|
83
83
|
<p>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
|
84
84
|
id sem consectetuer libero luctus adipiscing.</p></blockquote>
|
85
85
|
---
|
@@ -90,23 +90,23 @@ describe BlueCloth, "blockquotes" do
|
|
90
90
|
it "supports other Markdown elements in blockquote sections" do
|
91
91
|
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
92
92
|
> ## This is a header.
|
93
|
-
>
|
93
|
+
>
|
94
94
|
> 1. This is the first list item.
|
95
95
|
> 2. This is the second list item.
|
96
|
-
>
|
96
|
+
>
|
97
97
|
> Here's some example code:
|
98
|
-
>
|
98
|
+
>
|
99
99
|
> return shell_exec("echo $input | $markdown_script");
|
100
100
|
---
|
101
101
|
<blockquote><h2>This is a header.</h2>
|
102
|
-
|
102
|
+
|
103
103
|
<ol>
|
104
|
-
<li>This is the first list item.</li>
|
105
|
-
<li>This is the second list item.</li>
|
104
|
+
<li> This is the first list item.</li>
|
105
|
+
<li> This is the second list item.</li>
|
106
106
|
</ol>
|
107
|
-
|
107
|
+
|
108
108
|
<p>Here's some example code:</p>
|
109
|
-
|
109
|
+
|
110
110
|
<pre><code>return shell_exec("echo $input | $markdown_script");
|
111
111
|
</code></pre></blockquote>
|
112
112
|
---
|
@@ -121,19 +121,19 @@ describe BlueCloth, "blockquotes" do
|
|
121
121
|
> <pre>
|
122
122
|
> foo + bar; foo.factorize; foo.display
|
123
123
|
> </pre>
|
124
|
-
>
|
124
|
+
>
|
125
125
|
> This should result in an error on any little-endian platform.
|
126
|
-
>
|
126
|
+
>
|
127
127
|
> <div>- Garrick Mettronne</div>
|
128
128
|
---
|
129
129
|
<blockquote><p>The best approximation of the problem is the following code:</p>
|
130
|
-
|
130
|
+
|
131
131
|
<pre>
|
132
132
|
foo + bar; foo.factorize; foo.display
|
133
133
|
</pre>
|
134
|
-
|
134
|
+
|
135
135
|
<p>This should result in an error on any little-endian platform.</p>
|
136
|
-
|
136
|
+
|
137
137
|
<div>- Garrick Mettronne</div>
|
138
138
|
</blockquote>
|
139
139
|
---
|
data/spec/bluecloth_spec.rb
CHANGED
@@ -13,7 +13,7 @@ BEGIN {
|
|
13
13
|
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
14
14
|
}
|
15
15
|
|
16
|
-
require '
|
16
|
+
require 'rspec'
|
17
17
|
require 'bluecloth'
|
18
18
|
|
19
19
|
require 'spec/lib/helpers'
|
@@ -119,7 +119,7 @@ describe BlueCloth do
|
|
119
119
|
you might want to prevent.
|
120
120
|
---
|
121
121
|
<p>This is an example
|
122
|
-
[of something](javascript:
|
122
|
+
[of something](javascript:do<em>something</em>bad())
|
123
123
|
you might want to prevent.</p>
|
124
124
|
---
|
125
125
|
end
|
@@ -153,7 +153,7 @@ describe BlueCloth do
|
|
153
153
|
|
154
154
|
it "correctly expands id: links when :pseudoprotocols are enabled" do
|
155
155
|
input = "It was [just as he said](id:foo) it would be."
|
156
|
-
expected = %{<p>It was <
|
156
|
+
expected = %{<p>It was <span id="foo">just as he said</span> it would be.</p>}
|
157
157
|
|
158
158
|
the_markdown( input, :pseudoprotocols => true ).should be_transformed_into( expected )
|
159
159
|
end
|
@@ -174,30 +174,30 @@ describe BlueCloth do
|
|
174
174
|
|
175
175
|
it "correctly adds IDs to headers when :header_labels is enabled" do
|
176
176
|
input = %{# A header\n\nSome stuff\n\n## Another header\n\nMore stuff.\n\n}
|
177
|
-
expected = %{<h1 id=\"A
|
178
|
-
%{<h2 id=\"Another
|
177
|
+
expected = %{<h1 id=\"A.header\">A header</h1>\n\n<p>Some stuff</p>\n\n} +
|
178
|
+
%{<h2 id=\"Another.header\">Another header</h2>\n\n<p>More stuff.</p>}
|
179
179
|
|
180
180
|
the_markdown( input, :header_labels => true ).should be_transformed_into( expected )
|
181
181
|
end
|
182
182
|
|
183
|
-
it "expands superscripts when :
|
183
|
+
it "expands superscripts only when :superscript is enabled" do
|
184
184
|
input = %{It used to be that E = mc^2 used to be the province of physicists.}
|
185
185
|
expected = %{<p>It used to be that E = mc<sup>2</sup> used to be the province} +
|
186
186
|
%{ of physicists.</p>}
|
187
|
-
|
187
|
+
disabled = %{<p>It used to be that E = mc^2 used to be the province} +
|
188
188
|
%{ of physicists.</p>}
|
189
189
|
|
190
|
-
the_markdown( input, :
|
191
|
-
the_markdown( input, :
|
190
|
+
the_markdown( input, :superscript => false ).should be_transformed_into( disabled )
|
191
|
+
the_markdown( input, :superscript => true ).should be_transformed_into( expected )
|
192
192
|
end
|
193
193
|
|
194
|
-
it "uses relaxed emphasis when :
|
194
|
+
it "uses relaxed emphasis when :relaxed is enabled" do
|
195
195
|
input = %{If you use size_t instead, you _won't_ have to worry as much about portability.}
|
196
|
-
|
196
|
+
relaxed = %{<p>If you use size_t instead, you <em>won't</em> have to worry as much about portability.</p>}
|
197
197
|
strict = %{<p>If you use size<em>t instead, you </em>won't_ have to worry as much about portability.</p>}
|
198
198
|
|
199
|
-
the_markdown( input, :
|
200
|
-
the_markdown( input, :
|
199
|
+
the_markdown( input, :relaxed => true ).should be_transformed_into( relaxed )
|
200
|
+
the_markdown( input, :relaxed => false ).should be_transformed_into( strict )
|
201
201
|
end
|
202
202
|
|
203
203
|
end
|
data/spec/bugfix_spec.rb
CHANGED
@@ -14,7 +14,7 @@ BEGIN {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
require 'rubygems'
|
17
|
-
require '
|
17
|
+
require 'rspec'
|
18
18
|
require 'bluecloth'
|
19
19
|
|
20
20
|
require 'spec/lib/helpers'
|
@@ -242,6 +242,11 @@ describe BlueCloth, "bugfixes" do
|
|
242
242
|
END_HTML
|
243
243
|
end
|
244
244
|
|
245
|
+
it "renders alignments in code blocks without changing indentation (#71)" do
|
246
|
+
the_indented_markdown( " Самообучение\n Bugaga\n" ).
|
247
|
+
should be_transformed_into( "<pre><code>Самообучение\nBugaga\n</code></pre>" )
|
248
|
+
end
|
249
|
+
|
245
250
|
end
|
246
251
|
|
247
252
|
|
data/spec/contributions_spec.rb
CHANGED
data/spec/discount_spec.rb
CHANGED
@@ -14,7 +14,7 @@ BEGIN {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
require 'rubygems'
|
17
|
-
require '
|
17
|
+
require 'rspec'
|
18
18
|
require 'bluecloth'
|
19
19
|
|
20
20
|
require 'spec/lib/helpers'
|
@@ -48,7 +48,7 @@ describe BlueCloth, "implementation of Discount-specific features" do
|
|
48
48
|
|
49
49
|
it "renders id: links as anchors with an ID" do
|
50
50
|
the_markdown( "[foo](id:bar)", :pseudoprotocols => true ).
|
51
|
-
should be_transformed_into( '<p><
|
51
|
+
should be_transformed_into( '<p><span id="bar">foo</span></p>' )
|
52
52
|
end
|
53
53
|
|
54
54
|
it "renders class: links as SPANs with a CLASS" do
|
data/spec/lib/helpers.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'rspec'
|
5
5
|
require 'bluecloth'
|
6
6
|
|
7
7
|
|
@@ -12,126 +12,3 @@ module BlueCloth::SpecHelpers
|
|
12
12
|
###############
|
13
13
|
|
14
14
|
end
|
15
|
-
|
16
|
-
|
17
|
-
# Override the badly-formatted output of the RSpec HTML formatter
|
18
|
-
require 'spec/runner/formatter/html_formatter'
|
19
|
-
|
20
|
-
class Spec::Runner::Formatter::HtmlFormatter
|
21
|
-
def example_failed( example, counter, failure )
|
22
|
-
failure_style = failure.pending_fixed? ? 'pending_fixed' : 'failed'
|
23
|
-
|
24
|
-
unless @header_red
|
25
|
-
@output.puts " <script type=\"text/javascript\">makeRed('rspec-header');</script>"
|
26
|
-
@header_red = true
|
27
|
-
end
|
28
|
-
|
29
|
-
unless @example_group_red
|
30
|
-
css_class = 'example_group_%d' % [current_example_group_number||0]
|
31
|
-
@output.puts " <script type=\"text/javascript\">makeRed('#{css_class}');</script>"
|
32
|
-
@example_group_red = true
|
33
|
-
end
|
34
|
-
|
35
|
-
move_progress()
|
36
|
-
|
37
|
-
@output.puts " <dd class=\"spec #{failure_style}\">",
|
38
|
-
" <span class=\"failed_spec_name\">#{h(example.description)}</span>",
|
39
|
-
" <div class=\"failure\" id=\"failure_#{counter}\">"
|
40
|
-
if failure.exception
|
41
|
-
backtrace = format_backtrace( failure.exception.backtrace )
|
42
|
-
message = failure.exception.message
|
43
|
-
|
44
|
-
@output.puts " <div class=\"message\"><code>#{h message}</code></div>",
|
45
|
-
" <div class=\"backtrace\"><pre>#{backtrace}</pre></div>"
|
46
|
-
end
|
47
|
-
|
48
|
-
if extra = extra_failure_content( failure )
|
49
|
-
@output.puts( extra )
|
50
|
-
end
|
51
|
-
|
52
|
-
@output.puts " </div>",
|
53
|
-
" </dd>"
|
54
|
-
@output.flush
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
alias_method :default_global_styles, :global_styles
|
59
|
-
|
60
|
-
def global_styles
|
61
|
-
css = default_global_styles()
|
62
|
-
css << %Q{
|
63
|
-
/* Stuff added by #{__FILE__} */
|
64
|
-
|
65
|
-
/* Overrides */
|
66
|
-
#rspec-header {
|
67
|
-
-webkit-box-shadow: #333 0 2px 5px;
|
68
|
-
margin-bottom: 1em;
|
69
|
-
}
|
70
|
-
|
71
|
-
.example_group dt {
|
72
|
-
-webkit-box-shadow: #333 0 2px 3px;
|
73
|
-
}
|
74
|
-
|
75
|
-
/* Style for log output */
|
76
|
-
dd.log-message {
|
77
|
-
background: #eee;
|
78
|
-
padding: 0 2em;
|
79
|
-
margin: 0.2em 1em;
|
80
|
-
border-bottom: 1px dotted #999;
|
81
|
-
border-top: 1px dotted #999;
|
82
|
-
text-indent: -1em;
|
83
|
-
}
|
84
|
-
|
85
|
-
/* Parts of the message */
|
86
|
-
dd.log-message .log-time {
|
87
|
-
font-weight: bold;
|
88
|
-
}
|
89
|
-
dd.log-message .log-time:after {
|
90
|
-
content: ": ";
|
91
|
-
}
|
92
|
-
dd.log-message .log-level {
|
93
|
-
font-variant: small-caps;
|
94
|
-
border: 1px solid #ccc;
|
95
|
-
padding: 1px 2px;
|
96
|
-
}
|
97
|
-
dd.log-message .log-name {
|
98
|
-
font-size: 1.2em;
|
99
|
-
color: #1e51b2;
|
100
|
-
}
|
101
|
-
dd.log-message .log-name:before { content: "«"; }
|
102
|
-
dd.log-message .log-name:after { content: "»"; }
|
103
|
-
|
104
|
-
dd.log-message .log-message-text {
|
105
|
-
padding-left: 4px;
|
106
|
-
font-family: Monaco, "Andale Mono", "Vera Sans Mono", mono;
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
/* Distinguish levels */
|
111
|
-
dd.log-message.debug { color: #666; }
|
112
|
-
dd.log-message.info {}
|
113
|
-
|
114
|
-
dd.log-message.warn,
|
115
|
-
dd.log-message.error {
|
116
|
-
background: #ff9;
|
117
|
-
}
|
118
|
-
dd.log-message.error .log-level,
|
119
|
-
dd.log-message.error .log-message-text {
|
120
|
-
color: #900;
|
121
|
-
}
|
122
|
-
dd.log-message.fatal {
|
123
|
-
background: #900;
|
124
|
-
color: white;
|
125
|
-
font-weight: bold;
|
126
|
-
border: 0;
|
127
|
-
}
|
128
|
-
dd.log-message.fatal .log-name {
|
129
|
-
color: white;
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
return css
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
|