bluecloth 2.0.7 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +36 -6
- data/Rakefile +46 -26
- data/Rakefile.local +13 -6
- data/ext/VERSION +1 -1
- data/ext/bluecloth.c +46 -21
- data/ext/bluecloth.h +13 -2
- data/ext/cstring.h +3 -1
- data/ext/emmatch.c +188 -0
- data/ext/generate.c +203 -248
- data/ext/html5.c +24 -0
- data/ext/markdown.c +122 -98
- data/ext/markdown.h +16 -2
- data/ext/mkdio.c +43 -9
- data/ext/mkdio.h +11 -0
- data/ext/resource.c +1 -1
- data/ext/tags.c +110 -0
- data/ext/tags.h +18 -0
- data/lib/bluecloth.rb +33 -26
- data/rake/documentation.rb +115 -0
- data/rake/helpers.rb +375 -308
- data/rake/hg.rb +17 -3
- data/rake/manual.rb +11 -6
- data/rake/packaging.rb +7 -1
- data/rake/publishing.rb +162 -88
- data/spec/bluecloth/101_changes_spec.rb +1 -0
- data/spec/bluecloth/autolinks_spec.rb +1 -0
- data/spec/bluecloth/blockquotes_spec.rb +1 -0
- data/spec/bluecloth/code_spans_spec.rb +1 -0
- data/spec/bluecloth/emphasis_spec.rb +1 -0
- data/spec/bluecloth/entities_spec.rb +1 -0
- data/spec/bluecloth/hrules_spec.rb +1 -0
- data/spec/bluecloth/images_spec.rb +1 -0
- data/spec/bluecloth/inline_html_spec.rb +25 -61
- data/spec/bluecloth/lists_spec.rb +1 -0
- data/spec/bluecloth/paragraphs_spec.rb +1 -0
- data/spec/bluecloth/titles_spec.rb +1 -0
- data/spec/bluecloth_spec.rb +22 -6
- data/spec/bugfix_spec.rb +79 -2
- data/spec/contributions_spec.rb +1 -0
- data/spec/discount_spec.rb +46 -2
- data/spec/lib/helpers.rb +8 -8
- data/spec/lib/matchers.rb +5 -17
- data/spec/markdowntest_spec.rb +2 -34
- metadata +48 -17
- metadata.gz.sig +0 -0
- data/rake/rdoc.rb +0 -30
data/rake/hg.rb
CHANGED
@@ -22,6 +22,8 @@ unless defined?( HG_DOTDIR )
|
|
22
22
|
###
|
23
23
|
|
24
24
|
module MercurialHelpers
|
25
|
+
require './helpers.rb' unless defined?( RakefileHelpers )
|
26
|
+
include RakefileHelpers
|
25
27
|
|
26
28
|
###############
|
27
29
|
module_function
|
@@ -83,7 +85,7 @@ unless defined?( HG_DOTDIR )
|
|
83
85
|
|
84
86
|
### Return the list of files which are of status 'unknown'
|
85
87
|
def get_unknown_files
|
86
|
-
list = read_command_output( 'hg', 'status', '-un', '--
|
88
|
+
list = read_command_output( 'hg', 'status', '-un', '--color', 'never' )
|
87
89
|
list = list.split( /\n/ )
|
88
90
|
|
89
91
|
trace "New files: %p" % [ list ]
|
@@ -213,13 +215,20 @@ unless defined?( HG_DOTDIR )
|
|
213
215
|
paths = get_repo_paths()
|
214
216
|
if origin_url = paths['default']
|
215
217
|
ask_for_confirmation( "Pull and update from '#{origin_url}'?", false ) do
|
216
|
-
|
218
|
+
Rake::Task['hg:pull_without_confirmation'].invoke
|
217
219
|
end
|
218
220
|
else
|
219
221
|
trace "Skipping pull: No 'default' path."
|
220
222
|
end
|
221
223
|
end
|
222
224
|
|
225
|
+
|
226
|
+
desc "Pull and update without confirmation"
|
227
|
+
task :pull_without_confirmation do
|
228
|
+
run 'hg', 'pull', '-u'
|
229
|
+
end
|
230
|
+
|
231
|
+
|
223
232
|
desc "Check the current code in if tests pass"
|
224
233
|
task :checkin => ['hg:pull', 'hg:newfiles', 'test', COMMIT_MSG_FILE] do
|
225
234
|
targets = get_target_args()
|
@@ -240,13 +249,18 @@ unless defined?( HG_DOTDIR )
|
|
240
249
|
paths = get_repo_paths()
|
241
250
|
if origin_url = paths['default']
|
242
251
|
ask_for_confirmation( "Push to '#{origin_url}'?", false ) do
|
243
|
-
|
252
|
+
Rake::Task['hg:push_without_confirmation'].invoke
|
244
253
|
end
|
245
254
|
else
|
246
255
|
trace "Skipping push: No 'default' path."
|
247
256
|
end
|
248
257
|
end
|
249
258
|
|
259
|
+
desc "Push to the default repo without confirmation"
|
260
|
+
task :push_without_confirmation do
|
261
|
+
run 'hg', 'push'
|
262
|
+
end
|
263
|
+
|
250
264
|
end
|
251
265
|
|
252
266
|
if HG_DOTDIR.exist?
|
data/rake/manual.rb
CHANGED
@@ -147,9 +147,14 @@ module Manual
|
|
147
147
|
|
148
148
|
layout = self.config['layout'].sub( /\.page$/, '' )
|
149
149
|
templatepath = @layouts_dir + "#{layout}.page"
|
150
|
-
template =
|
151
|
-
|
150
|
+
template = nil
|
151
|
+
if Object.const_defined?( :Encoding )
|
152
|
+
template = ERB.new( templatepath.read(:encoding => 'UTF-8') )
|
153
|
+
else
|
154
|
+
template = ERB.new( templatepath.read )
|
155
|
+
end
|
152
156
|
|
157
|
+
page = self
|
153
158
|
html = template.result( binding() )
|
154
159
|
|
155
160
|
# Use Tidy to clean up the html if 'cleanup' is turned on, but remove the Tidy
|
@@ -565,7 +570,7 @@ module Manual
|
|
565
570
|
manual_pages = setup_page_conversion_tasks( sourcedir, outputdir, catalog )
|
566
571
|
|
567
572
|
desc "Build the manual"
|
568
|
-
task :build => [ :
|
573
|
+
task :build => [ :apidocs, :copy_resources, :copy_apidocs, :generate_pages ]
|
569
574
|
|
570
575
|
task :clobber do
|
571
576
|
RakeFileUtils.verbose( $verbose ) do
|
@@ -686,8 +691,8 @@ module Manual
|
|
686
691
|
end
|
687
692
|
|
688
693
|
desc "Copy API documentation to the manual output directory"
|
689
|
-
task :copy_apidocs => :
|
690
|
-
cp_r(
|
694
|
+
task :copy_apidocs => :apidocs do
|
695
|
+
cp_r( API_DOCSDIR, outputdir )
|
691
696
|
end
|
692
697
|
|
693
698
|
# Now group all the resource file tasks into a containing task
|
@@ -713,7 +718,7 @@ if MANUALDIR.exist?
|
|
713
718
|
|
714
719
|
Manual::GenTask.new do |manual|
|
715
720
|
manual.metadata.version = PKG_VERSION
|
716
|
-
manual.metadata.api_dir =
|
721
|
+
manual.metadata.api_dir = API_DOCSDIR
|
717
722
|
manual.output_dir = MANUALOUTPUTDIR
|
718
723
|
manual.base_dir = MANUALDIR
|
719
724
|
manual.source_dir = 'src'
|
data/rake/packaging.rb
CHANGED
@@ -12,7 +12,13 @@ include Config
|
|
12
12
|
### Task: prerelease
|
13
13
|
desc "Append the package build number to package versions"
|
14
14
|
task :prerelease do
|
15
|
-
GEMSPEC.version.version
|
15
|
+
GEMSPEC.version.version << ".#{PKG_BUILD}"
|
16
|
+
Rake::Task[:gem].clear
|
17
|
+
|
18
|
+
Gem::PackageTask.new( GEMSPEC ) do |pkg|
|
19
|
+
pkg.need_zip = true
|
20
|
+
pkg.need_tar = true
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
|
data/rake/publishing.rb
CHANGED
@@ -13,6 +13,7 @@ $publish_privately = false
|
|
13
13
|
|
14
14
|
### Add SSL to Net::SMTP
|
15
15
|
class Net::SMTP
|
16
|
+
|
16
17
|
def ssl_start( helo='localhost.localdomain', user=nil, secret=nil, authtype=nil )
|
17
18
|
if block_given?
|
18
19
|
begin
|
@@ -93,6 +94,9 @@ begin
|
|
93
94
|
require 'etc'
|
94
95
|
require 'socket'
|
95
96
|
require 'text/format'
|
97
|
+
require 'rubygems/gemcutter_utilities'
|
98
|
+
|
99
|
+
include Gem::GemcutterUtilities
|
96
100
|
|
97
101
|
### Generate a valid RFC822 message-id
|
98
102
|
def gen_message_id
|
@@ -104,6 +108,48 @@ begin
|
|
104
108
|
end
|
105
109
|
|
106
110
|
|
111
|
+
### Fetch the rubygems API token if it hasn't been already.
|
112
|
+
def sign_in_to_rubygems
|
113
|
+
return if Gem.configuration.rubygems_api_key
|
114
|
+
|
115
|
+
log "Enter your RubyGems.org credentials."
|
116
|
+
|
117
|
+
email = prompt " Email: "
|
118
|
+
password = prompt_for_password( "Password: " )
|
119
|
+
|
120
|
+
response = rubygems_api_request( :get, "api/v1/api_key" ) do |request|
|
121
|
+
request.basic_auth( email, password )
|
122
|
+
end
|
123
|
+
|
124
|
+
with_response( response ) do |resp|
|
125
|
+
log "Signed in."
|
126
|
+
Gem.configuration.rubygems_api_key = resp.body
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
### Push the gem at the specified +path+ to the rubygems server at +gemhost+.
|
132
|
+
def push_gem( path, gemhost )
|
133
|
+
ENV['RUBYGEMS_HOST'] = "http://#{gemhost}"
|
134
|
+
|
135
|
+
sign_in_to_rubygems()
|
136
|
+
|
137
|
+
response = rubygems_api_request( :post, "api/v1/gems" ) do |request|
|
138
|
+
request.body = Gem.read_binary( path )
|
139
|
+
request.add_field "Content-Length", request.body.size
|
140
|
+
request.add_field "Content-Type", "application/octet-stream"
|
141
|
+
request.add_field "Authorization", Gem.configuration.rubygems_api_key
|
142
|
+
end
|
143
|
+
|
144
|
+
case response
|
145
|
+
when Net::HTTPSuccess
|
146
|
+
log( response.body )
|
147
|
+
else
|
148
|
+
fail( response.body )
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
|
107
153
|
namespace :release do
|
108
154
|
task :default => [ :prep_release, :upload, :publish, :announce ]
|
109
155
|
|
@@ -133,120 +179,147 @@ begin
|
|
133
179
|
end
|
134
180
|
CLOBBER.include( RELEASE_NOTES_FILE )
|
135
181
|
|
182
|
+
# Only define upload tasks if there's an upload host
|
183
|
+
if PROJECT_HOST.empty?
|
184
|
+
task :no_upload_host do
|
185
|
+
log "Skipping upload: no upload host."
|
186
|
+
end
|
187
|
+
task :upload => :no_upload_host
|
188
|
+
task :upload_docs => :no_upload_host
|
189
|
+
task :upload_packages => :no_upload_host
|
190
|
+
else
|
191
|
+
desc "Upload project documentation and packages to #{PROJECT_HOST}"
|
192
|
+
task :upload => [ :upload_docs, :upload_packages ]
|
193
|
+
task :project => :upload # the old name
|
194
|
+
|
195
|
+
desc "Publish the project docs to #{PROJECT_HOST}"
|
196
|
+
task :upload_docs => [ :apidocs ] do
|
197
|
+
when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
|
198
|
+
log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
|
199
|
+
run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
|
200
|
+
run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
|
201
|
+
end
|
202
|
+
end
|
136
203
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
run 'scp', '-qCr', RDOCDIR, PROJECT_SCPDOCURL
|
204
|
+
desc "Publish the project packages to #{PROJECT_HOST}"
|
205
|
+
task :upload_packages => [ :package ] do
|
206
|
+
when_writing( "Uploading packages") do
|
207
|
+
pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
|
208
|
+
log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
|
209
|
+
pkgs.each do |pkgfile|
|
210
|
+
run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
|
211
|
+
end
|
212
|
+
end
|
147
213
|
end
|
148
214
|
end
|
149
215
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
216
|
+
# Only define the announcement tasks if there are addresses to announce to
|
217
|
+
if RELEASE_ANNOUNCE_ADDRESSES.empty?
|
218
|
+
task :no_announce_addresses do
|
219
|
+
log "Skipping announcement: no announce addresses"
|
220
|
+
end
|
221
|
+
task :announce => :no_announce_addresses
|
160
222
|
|
223
|
+
else
|
224
|
+
file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
|
225
|
+
relnotes = File.read( RELEASE_NOTES_FILE )
|
226
|
+
announce_body = %{
|
161
227
|
|
162
|
-
|
163
|
-
relnotes = File.read( RELEASE_NOTES_FILE )
|
164
|
-
announce_body = %{
|
228
|
+
Version #{PKG_VERSION} of #{PKG_NAME} has been released.
|
165
229
|
|
166
|
-
|
230
|
+
#{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
|
167
231
|
|
168
|
-
|
232
|
+
== Project Page
|
169
233
|
|
170
|
-
|
234
|
+
#{GEMSPEC.homepage}
|
171
235
|
|
172
|
-
|
236
|
+
== Installation
|
173
237
|
|
174
|
-
|
238
|
+
Via gems:
|
175
239
|
|
176
|
-
|
240
|
+
$ sudo gem install #{GEMSPEC.name}
|
177
241
|
|
178
|
-
|
242
|
+
or from source:
|
179
243
|
|
180
|
-
|
244
|
+
$ wget http://deveiate.org/code/#{PKG_FILE_NAME}.tar.gz
|
245
|
+
$ tar -xzvf #{PKG_FILE_NAME}.tar.gz
|
246
|
+
$ cd #{PKG_FILE_NAME}
|
247
|
+
$ sudo rake install
|
181
248
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
$ sudo rake install
|
249
|
+
== Changes
|
250
|
+
#{relnotes}
|
251
|
+
}.gsub( /^\t+/, '' )
|
186
252
|
|
187
|
-
|
188
|
-
|
189
|
-
|
253
|
+
File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
|
254
|
+
fh.print( announce_body )
|
255
|
+
end
|
190
256
|
|
191
|
-
|
192
|
-
fh.print( announce_body )
|
257
|
+
edit task.name
|
193
258
|
end
|
259
|
+
CLOBBER.include( RELEASE_ANNOUNCE_FILE )
|
194
260
|
|
195
|
-
edit task.name
|
196
|
-
end
|
197
|
-
CLOBBER.include( RELEASE_ANNOUNCE_FILE )
|
198
261
|
|
262
|
+
desc 'Send out a release announcement'
|
263
|
+
task :announce => [RELEASE_ANNOUNCE_FILE] do
|
264
|
+
email = TMail::Mail.new
|
199
265
|
|
200
|
-
|
201
|
-
|
202
|
-
|
266
|
+
if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
|
267
|
+
trace "Sending private announce mail"
|
268
|
+
email.to = 'rubymage@gmail.com'
|
269
|
+
else
|
270
|
+
trace "Sending public announce mail"
|
271
|
+
email.to = RELEASE_ANNOUNCE_ADDRESSES
|
272
|
+
email.bcc = 'rubymage@gmail.com'
|
273
|
+
end
|
203
274
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
email.
|
210
|
-
email.
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
|
237
|
-
trace "sending message..."
|
238
|
-
smtp.send_message( email.to_s, email.from, email.to )
|
275
|
+
from = prompt_with_default( "Send announcement as:",
|
276
|
+
'Michael Granger <ged@FaerieMUD.org>' ) or fail
|
277
|
+
|
278
|
+
email.from = from
|
279
|
+
email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
|
280
|
+
email.body = File.read( RELEASE_ANNOUNCE_FILE )
|
281
|
+
email.date = Time.new
|
282
|
+
|
283
|
+
email.message_id = gen_message_id()
|
284
|
+
|
285
|
+
log "About to send the following email:"
|
286
|
+
puts '---',
|
287
|
+
email.to_s,
|
288
|
+
'---'
|
289
|
+
|
290
|
+
ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
|
291
|
+
pwent = Etc.getpwuid( Process.euid )
|
292
|
+
curuser = pwent ? pwent.name : 'unknown'
|
293
|
+
username = prompt_with_default( "SMTP user", curuser )
|
294
|
+
password = prompt_for_password()
|
295
|
+
|
296
|
+
trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
|
297
|
+
smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
|
298
|
+
smtp.set_debug_output( $stdout )
|
299
|
+
smtp.esmtp = true
|
300
|
+
|
301
|
+
trace "connecting..."
|
302
|
+
smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
|
303
|
+
trace "sending message..."
|
304
|
+
smtp.send_message( email.to_s, email.from, email.to )
|
305
|
+
end
|
306
|
+
trace "done."
|
239
307
|
end
|
240
|
-
trace "done."
|
241
308
|
end
|
242
309
|
end
|
243
310
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
311
|
+
if GEM_PUBHOST.empty?
|
312
|
+
task :no_gem_host do
|
313
|
+
log "Skipping gem push: no gem publication host."
|
314
|
+
end
|
315
|
+
task :publish => :no_gem_host
|
316
|
+
else
|
317
|
+
desc 'Publish the new gem to #{GEM_PUBHOST}'
|
318
|
+
task :publish => [:clean, :gem, :notes] do |task|
|
319
|
+
ask_for_confirmation( "Publish #{GEM_FILE_NAME} to #{GEM_PUBHOST}?", false ) do
|
320
|
+
gempath = PKGDIR + GEM_FILE_NAME
|
321
|
+
push_gem( gempath, GEM_PUBHOST )
|
322
|
+
end
|
250
323
|
end
|
251
324
|
end
|
252
325
|
end
|
@@ -262,6 +335,7 @@ rescue LoadError => err
|
|
262
335
|
end
|
263
336
|
|
264
337
|
task :release => :no_release_tasks
|
338
|
+
task "release:rerelease" => :no_release_tasks
|
265
339
|
task "release:announce" => :no_release_tasks
|
266
340
|
task "release:publish" => :no_release_tasks
|
267
341
|
task "release:notes" => :no_release_tasks
|
@@ -8,6 +8,7 @@ BEGIN {
|
|
8
8
|
libdir = basedir + 'lib'
|
9
9
|
extdir = basedir + 'ext'
|
10
10
|
|
11
|
+
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
11
12
|
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
12
13
|
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
13
14
|
}
|
@@ -8,6 +8,7 @@ BEGIN {
|
|
8
8
|
libdir = basedir + 'lib'
|
9
9
|
extdir = basedir + 'ext'
|
10
10
|
|
11
|
+
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
11
12
|
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
12
13
|
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
13
14
|
}
|
@@ -8,6 +8,7 @@ BEGIN {
|
|
8
8
|
libdir = basedir + 'lib'
|
9
9
|
extdir = basedir + 'ext'
|
10
10
|
|
11
|
+
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
11
12
|
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
12
13
|
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
13
14
|
}
|