bluecloth 2.0.5-x86-mingw32 → 2.0.6.pre120-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/rake/manual.rb CHANGED
@@ -69,7 +69,7 @@ module Manual
69
69
  DEFAULT_CONFIG = {
70
70
  'filters' => [ 'erb', 'links', 'textile' ],
71
71
  'layout' => 'default.page',
72
- 'cleanup' => true,
72
+ 'cleanup' => false,
73
73
  }.freeze
74
74
 
75
75
  # Pattern to match a source page with a YAML header
data/rake/packaging.rb CHANGED
@@ -1,14 +1,12 @@
1
- #
2
- # Packaging Rake Tasks
3
-
4
- #
1
+ #####################################################################
2
+ ### P A C K A G I N G T A S K S
3
+ #####################################################################
5
4
 
6
5
  require 'rbconfig'
7
6
  require 'pathname'
8
7
  require 'rake/packagetask'
9
8
  require 'rake/gempackagetask'
10
9
 
11
- require Pathname( __FILE__ ).dirname.expand_path + 'hg.rb'
12
10
 
13
11
  include Config
14
12
 
@@ -25,35 +23,19 @@ task :package => [:gem]
25
23
 
26
24
 
27
25
  ### Task: gem
28
- gempath = PKGDIR + GEM_FILE_NAME
29
-
30
- desc "Build a RubyGem package (#{GEM_FILE_NAME})"
31
- task :gem => gempath.to_s
32
- file gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
33
- when_writing( "Creating GEM" ) do
34
- Gem::Builder.new( GEMSPEC ).build
35
- verbose( true ) do
36
- mv GEM_FILE_NAME, gempath
37
- end
38
- end
39
- end
40
-
41
-
42
- prerelease_gempath = PKGDIR + SNAPSHOT_GEM_NAME
43
-
44
- desc "Build a pre-release RubyGem package"
45
- task :prerelease_gem => prerelease_gempath.to_s
46
- file prerelease_gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
47
- when_writing( "Creating prerelease GEM" ) do
48
- gemspec = GEMSPEC.clone
49
- gemspec.version = Gem::Version.create( "%s.%s" % [GEMSPEC.version, PKG_BUILD] )
50
- Gem::Builder.new( gemspec ).build
51
- verbose( true ) do
52
- mv SNAPSHOT_GEM_NAME, prerelease_gempath
53
- end
54
- end
55
- end
56
-
26
+ # gempath = PKGDIR + GEM_FILE_NAME
27
+ #
28
+ # desc "Build a RubyGem package (#{GEM_FILE_NAME})"
29
+ # task :gem => gempath.to_s
30
+ # file gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
31
+ # when_writing( "Creating GEM" ) do
32
+ # Gem::Builder.new( GEMSPEC ).build
33
+ # verbose( true ) do
34
+ # mv GEM_FILE_NAME, gempath
35
+ # end
36
+ # end
37
+ # end
38
+ #
57
39
 
58
40
  ### Task: install
59
41
  desc "Install #{PKG_NAME} as a conventional library"
@@ -133,3 +115,12 @@ end
133
115
 
134
116
 
135
117
 
118
+ desc "Add development depdendencies to the gemspec -- this is meant to be chained " +
119
+ "together with :gem"
120
+ task :include_dev_dependencies do
121
+ DEVELOPMENT_DEPENDENCIES.each do |name, version|
122
+ version = '>= 0' if version.length.zero?
123
+ GEMSPEC.add_development_dependency( name, version )
124
+ end
125
+ end
126
+
data/rake/publishing.rb CHANGED
@@ -34,7 +34,7 @@ class Net::SMTP
34
34
 
35
35
  def do_ssl_start( helodomain, user, secret, authtype )
36
36
  raise IOError, 'SMTP session already started' if @started
37
- check_auth_args user, secret, authtype if user or secret
37
+ check_auth_args( user, secret, 'plain' ) if user or secret
38
38
 
39
39
  # Open the connection
40
40
  @debug_output << "opening connection to #{@address}...\n" if @debug_output
@@ -85,7 +85,6 @@ begin
85
85
  require 'tmail'
86
86
  require 'net/smtp'
87
87
  require 'etc'
88
- require 'rubyforge'
89
88
  require 'socket'
90
89
  require 'text/format'
91
90
 
@@ -116,15 +115,12 @@ begin
116
115
  desc "Generate the release notes"
117
116
  task :notes => [RELEASE_NOTES_FILE]
118
117
  file RELEASE_NOTES_FILE do |task|
119
- last_rel_tag = get_latest_release_tag() or
120
- fail ">>> No releases tagged! Try running 'rake prep_release' first"
121
- trace "Last release tag is: %p" % [ last_rel_tag ]
122
- start = get_last_changed_rev( last_rel_tag ) || 1
123
- trace "Starting rev is: %p" % [ start ]
124
- log_output = make_svn_log( '.', start, 'HEAD' )
118
+ last_tag = MercurialHelpers.get_tags.grep( /\d+\.\d+\.\d+/ ).
119
+ collect {|ver| vvec(ver) }.sort.last.unpack( 'N*' ).join('.')
125
120
 
126
121
  File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
127
- fh.print( log_output )
122
+ fh.puts "Release Notes for #{PKG_VERSION}",
123
+ "--------------------------------", '', ''
128
124
  end
129
125
 
130
126
  edit task.name
@@ -198,14 +194,16 @@ begin
198
194
  desc 'Send out a release announcement'
199
195
  task :announce => [RELEASE_ANNOUNCE_FILE] do
200
196
  email = TMail::Mail.new
201
- if $publish_privately
197
+
198
+ if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
202
199
  trace "Sending private announce mail"
203
200
  email.to = 'rubymage@gmail.com'
204
201
  else
205
202
  trace "Sending public announce mail"
206
- email.to = 'Ruby-Talk List <ruby-talk@ruby-lang.org>'
203
+ email.to = RELEASE_ANNOUNCE_ADDRESSES
207
204
  email.bcc = 'rubymage@gmail.com'
208
205
  end
206
+
209
207
  email.from = GEMSPEC.email
210
208
  email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
211
209
  email.body = File.read( RELEASE_ANNOUNCE_FILE )
@@ -218,7 +216,7 @@ begin
218
216
  email.to_s,
219
217
  '---'
220
218
 
221
- ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
219
+ ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
222
220
  pwent = Etc.getpwuid( Process.euid )
223
221
  curuser = pwent ? pwent.name : 'unknown'
224
222
  username = prompt_with_default( "SMTP user", curuser )
@@ -239,61 +237,11 @@ begin
239
237
  end
240
238
 
241
239
 
242
- desc 'Publish the new release to RubyForge'
243
- task :publish => [:clean, :package, :notes] do |task|
244
- project = GEMSPEC.rubyforge_project
245
-
246
- if $publish_privately
247
- log "Skipping push of release files to RubyForge"
248
- else
249
- rf = RubyForge.new
250
- log "Loading RubyForge config"
251
- rf.configure
252
-
253
- group_id = rf.autoconfig['group_ids'][RUBYFORGE_GROUP] or
254
- fail "Your configuration doesn't have a group id for '#{RUBYFORGE_GROUP}'"
255
-
256
- # If this project doesn't yet exist, create it
257
- unless rf.autoconfig['package_ids'].key?( project )
258
- ask_for_confirmation( "Package '#{project}' doesn't exist on RubyForge. Create it?" ) do
259
- log "Creating new package '#{project}'"
260
- rf.create_package( group_id, project )
261
- end
262
- end
263
-
264
- package_id = rf.autoconfig['package_ids'][ project ]
265
-
266
- # Make sure this release doesn't already exist
267
- releases = rf.autoconfig['release_ids']
268
- if releases.key?( GEMSPEC.name ) && releases[ GEMSPEC.name ].key?( PKG_VERSION )
269
- log "Rubyforge seems to already have #{ PKG_FILE_NAME }"
270
- else
271
- config = rf.userconfig or
272
- fail "You apparently haven't set up your RubyForge credentials on this machine."
273
- config['release_notes'] = GEMSPEC.description
274
- config['release_changes'] = File.read( RELEASE_NOTES_FILE )
275
-
276
- files = FileList[ PKGDIR + GEM_FILE_NAME ]
277
- files.include PKGDIR + "#{PKG_FILE_NAME}.tar.gz"
278
- files.include PKGDIR + "#{PKG_FILE_NAME}.tar.bz2"
279
- files.include PKGDIR + "#{PKG_FILE_NAME}.zip"
280
-
281
- log "Releasing #{PKG_FILE_NAME}"
282
- when_writing do
283
- log "Publishing to RubyForge: \n",
284
- "\tproject: #{RUBYFORGE_GROUP}\n",
285
- "\tpackage: #{PKG_NAME.downcase}\n",
286
- "\tpackage version: #{PKG_VERSION}\n",
287
- "\tfiles: " + files.collect {|f| f.to_s }.join(', ') + "\n"
288
-
289
- ask_for_confirmation( "Publish to RubyForge?" ) do
290
- log 'Logging in...'
291
- rf.login
292
- log "Adding the new release to the '#{project}' project"
293
- rf.add_release( group_id, package_id, PKG_VERSION, *files )
294
- end
295
- end
296
- end
240
+ desc 'Publish the new release to Gemcutter'
241
+ task :publish => [:clean, :gem, :notes] do |task|
242
+ ask_for_confirmation( "Publish #{GEM_FILE_NAME} to Gemcutter?", false ) do
243
+ gempath = PKGDIR + GEM_FILE_NAME
244
+ sh 'gem', 'push', gempath
297
245
  end
298
246
  end
299
247
  end
@@ -113,28 +113,30 @@ describe BlueCloth, "blockquotes" do
113
113
 
114
114
  # Blockquotes with a <pre> section
115
115
  it "supports block-level HTML inside of blockquotes" do
116
- the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
117
- > The best approximation of the problem is the following code:
118
- >
119
- > <pre>
120
- > foo + bar; foo.factorize; foo.display
121
- > </pre>
122
- >
123
- > This should result in an error on any little-endian platform.
124
- >
125
- > <div>- Garrick Mettronne</div>
126
- ---
127
- <blockquote><p>The best approximation of the problem is the following code:</p>
128
-
129
- <pre>
130
- foo + bar; foo.factorize; foo.display
131
- </pre>
132
-
133
- <p>This should result in an error on any little-endian platform.</p>
134
-
135
- <div>- Garrick Mettronne</div>
136
- </blockquote>
137
- ---
116
+ pending "a fix in Discount" do
117
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
118
+ > The best approximation of the problem is the following code:
119
+ >
120
+ > <pre>
121
+ > foo + bar; foo.factorize; foo.display
122
+ > </pre>
123
+ >
124
+ > This should result in an error on any little-endian platform.
125
+ >
126
+ > <div>- Garrick Mettronne</div>
127
+ ---
128
+ <blockquote><p>The best approximation of the problem is the following code:</p>
129
+
130
+ <pre>
131
+ foo + bar; foo.factorize; foo.display
132
+ </pre>
133
+
134
+ <p>This should result in an error on any little-endian platform.</p>
135
+
136
+ <div>- Garrick Mettronne</div>
137
+ </blockquote>
138
+ ---
139
+ end
138
140
  end
139
141
 
140
142
 
@@ -60,6 +60,20 @@ describe BlueCloth do
60
60
  end
61
61
 
62
62
 
63
+ it "handles non-string content safely" do
64
+ BlueCloth.new( nil ).text.should == ''
65
+ end
66
+
67
+
68
+ it "inherits the taintedness of its input" do
69
+ str = "a string"
70
+ BlueCloth.new( str ).should_not be_tainted()
71
+
72
+ str.taint
73
+ BlueCloth.new( str ).should be_tainted()
74
+ end
75
+
76
+
63
77
  it "allows output to be rendered several times" do
64
78
  bc = BlueCloth.new( "Some text" )
65
79
  bc.to_html.should == bc.to_html
@@ -245,6 +259,23 @@ describe BlueCloth do
245
259
  end
246
260
  end
247
261
 
262
+
263
+ describe "encoding under Ruby 1.9.x" do
264
+
265
+ before( :each ) do
266
+ pending "only valid under a version of Ruby that has the Encoding class" unless
267
+ Object.const_defined?( :Encoding )
268
+ end
269
+
270
+
271
+ it "outputs HTML in the same encoding as the source string" do
272
+ utf8 = "a string".encode( "UTF-8" )
273
+ out = BlueCloth.new( utf8 ).to_html
274
+
275
+ out.encoding.name.should == 'UTF-8'
276
+ end
277
+ end
278
+
248
279
  end
249
280
 
250
281
  # vim: set nosta noet ts=4 sw=4:
data/spec/bugfix_spec.rb CHANGED
@@ -120,7 +120,7 @@ describe BlueCloth, "bugfixes" do
120
120
  the_indented_markdown( <<-"END_MARKDOWN" ).should be_transformed_into(<<-"END_HTML").without_indentation
121
121
  This line of markdown below will hang you if you're running BlueCloth 1.x.
122
122
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
123
-
123
+
124
124
  END_MARKDOWN
125
125
  <p>This line of markdown below will hang you if you're running BlueCloth 1.x.</p>
126
126
 
@@ -128,6 +128,42 @@ describe BlueCloth, "bugfixes" do
128
128
  END_HTML
129
129
  end
130
130
 
131
+ it "recognizes closing block tags even when they're not on their own line" do
132
+ the_indented_markdown( <<-"END_MARKDOWN" ).should be_transformed_into(<<-"END_HTML").without_indentation
133
+ Para 1
134
+
135
+ <div><pre>HTML block
136
+ </pre></div>
137
+
138
+ Para 2 [Link](#anchor)
139
+ END_MARKDOWN
140
+ <p>Para 1</p>
141
+
142
+ <div><pre>HTML block
143
+ </pre></div>
144
+
145
+ <p>Para 2 <a href=\"#anchor\">Link</a></p>
146
+ END_HTML
147
+ end
148
+
149
+ it "correctly wraps lines after a code block in a list item" do
150
+ the_indented_markdown( <<-"END_MARKDOWN" ).should be_transformed_into(<<-"END_HTML").without_indentation
151
+ * testing
152
+
153
+ pre
154
+
155
+ more li
156
+ END_MARKDOWN
157
+ <ul>
158
+ <li><p>testing</p>
159
+
160
+ <pre><code>pre
161
+ </code></pre>
162
+
163
+ <p>more li</p></li>
164
+ </ul>
165
+ END_HTML
166
+ end
131
167
 
132
168
  end
133
169
 
@@ -60,6 +60,123 @@ describe BlueCloth, "implementation of Discount-specific features" do
60
60
  end
61
61
 
62
62
  end
63
+
64
+
65
+ describe "Markdown-Extra tables" do
66
+
67
+ it "renders the example from orc's blog" do
68
+ the_indented_markdown( <<-"END_MARKDOWN", :strict => false ).should be_transformed_into(<<-"END_HTML").without_indentation
69
+ a | b
70
+ -----|-----
71
+ hello|sailor
72
+ END_MARKDOWN
73
+ <table>
74
+ <thead>
75
+ <tr>
76
+ <th> a </th>
77
+ <th> b</th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>
81
+ <tr>
82
+ <td>hello</td>
83
+ <td>sailor</td>
84
+ </tr>
85
+ </tbody>
86
+ </table>
87
+ END_HTML
88
+ end
89
+
90
+ it "renders simple markdown-extra tables" do
91
+ the_indented_markdown( <<-"END_MARKDOWN", :strict => false ).should be_transformed_into(<<-"END_HTML").without_indentation
92
+ First Header | Second Header
93
+ ------------- | -------------
94
+ Content Cell | Content Cell
95
+ END_MARKDOWN
96
+ <table>
97
+ <thead>
98
+ <tr>
99
+ <th>First Header </th>
100
+ <th> Second Header</th>
101
+ </tr>
102
+ </thead>
103
+ <tbody>
104
+ <tr>
105
+ <td>Content Cell </td>
106
+ <td> Content Cell</td>
107
+ </tr>
108
+ </tbody>
109
+ </table>
110
+ END_HTML
111
+
112
+ end
113
+
114
+ it "renders tables with leading and trailing pipes" do
115
+ pending "Discount doesn't support this kind (yet?)" do
116
+ the_indented_markdown( <<-"END_MARKDOWN", :tables => true ).should be_transformed_into(<<-"END_HTML").without_indentation
117
+ | First Header | Second Header |
118
+ | ------------- | ------------- |
119
+ | Content Cell | Content Cell |
120
+ | Content Cell | Content Cell |
121
+ END_MARKDOWN
122
+ <table>
123
+ <thead>
124
+ <tr>
125
+ <th>First Header </th>
126
+ <th> Second Header</th>
127
+ </tr>
128
+ </thead>
129
+ <tbody>
130
+ <tr>
131
+ <td>Content Cell </td>
132
+ <td> Content Cell</td>
133
+ </tr>
134
+ <tr>
135
+ <td>Content Cell </td>
136
+ <td> Content Cell</td>
137
+ </tr>
138
+ </tbody>
139
+ </table>
140
+ END_HTML
141
+ end
142
+ end
143
+
144
+ it "renders tables with aligned columns" do
145
+ pending "Discount doesn't support this kind (yet?)" do
146
+ the_indented_markdown( <<-"END_MARKDOWN", :tables => true ).should be_transformed_into(<<-"END_HTML").without_indentation
147
+ | Item | Value |
148
+ | --------- | -----:|
149
+ | Computer | $1600 |
150
+ | Phone | $12 |
151
+ | Pipe | $1 |
152
+ END_MARKDOWN
153
+ <table>
154
+ <thead>
155
+ <tr>
156
+ <th>Item </th>
157
+ <th align="right"> Value</th>
158
+ </tr>
159
+ </thead>
160
+ <tbody>
161
+ <tr>
162
+ <td>Computer </td>
163
+ <td align="right"> $1600</td>
164
+ </tr>
165
+ <tr>
166
+ <td>Phone </td>
167
+ <td align="right"> $12</td>
168
+ </tr>
169
+ <tr>
170
+ <td>Pipe </td>
171
+ <td align="right"> $1</td>
172
+ </tr>
173
+ </tbody>
174
+ </table>
175
+ END_HTML
176
+ end
177
+ end
178
+ end
179
+
63
180
  end
64
181
 
65
182