bluecloth 2.0.5 → 2.0.6.pre120

Sign up to get free protection for your applications and to get access to all the features.
data/ext/markdown.h CHANGED
@@ -37,7 +37,7 @@ typedef struct paragraph {
37
37
  char *ident; /* %id% tag for QUOTE */
38
38
  enum { WHITESPACE=0, CODE, QUOTE, MARKUP,
39
39
  HTML, STYLE, DL, UL, OL, AL, LISTITEM,
40
- HDR, HR } typ;
40
+ HDR, HR, TABLE, SOURCE } typ;
41
41
  enum { IMPLICIT=0, PARA, CENTER} align;
42
42
  int hnumber; /* <Hn> for typ == HDR */
43
43
  } Paragraph;
@@ -74,11 +74,12 @@ typedef struct mmiot {
74
74
  #define INSIDE_TAG 0x0020
75
75
  #define NO_PSEUDO_PROTO 0x0040
76
76
  #define CDATA_OUTPUT 0x0080
77
+ #define NOTABLES 0x0400
77
78
  #define TOC 0x1000
78
79
  #define MKD_1_COMPAT 0x2000
79
80
  #define AUTOLINK 0x4000
80
81
  #define SAFELINK 0x8000
81
- #define USER_FLAGS 0xF0FF
82
+ #define USER_FLAGS 0xFCFF
82
83
  #define EMBEDDED DENY_A|DENY_IMG|NO_PSEUDO_PROTO|CDATA_OUTPUT
83
84
  char *base;
84
85
  } MMIOT;
data/ext/mkdio.h CHANGED
@@ -63,6 +63,7 @@ extern char markdown_version[];
63
63
  * <em>, no <bold>, no html or [] expansion */
64
64
  #define MKD_NO_EXT 0x0040 /* don't allow pseudo-protocols */
65
65
  #define MKD_CDATA 0x0080 /* generate code for xml ![CDATA[...]] */
66
+ #define MKD_NOTABLES 0x0400 /* disallow tables */
66
67
  #define MKD_TOC 0x1000 /* do table-of-contents processing */
67
68
  #define MKD_1_COMPAT 0x2000 /* compatability with MarkdownTest_1.0 */
68
69
  #define MKD_AUTOLINK 0x4000 /* make http://foo.com link even without <>s */
data/lib/bluecloth.rb CHANGED
@@ -18,7 +18,7 @@
18
18
  #
19
19
  # == Version
20
20
  #
21
- # $Id: bluecloth.rb 132 2009-07-16 00:18:30Z deveiant $
21
+ # $Id$
22
22
  #
23
23
  # == License
24
24
  #
@@ -29,13 +29,7 @@
29
29
  class BlueCloth
30
30
 
31
31
  # Release Version
32
- VERSION = '2.0.5'
33
-
34
- # SVN Revision
35
- SVNREV = %q$Rev: 132 $
36
-
37
- # SVN Id tag
38
- SVNID = %q$Id: bluecloth.rb 132 2009-07-16 00:18:30Z deveiant $
32
+ VERSION = '2.0.6'
39
33
 
40
34
  # The defaults for all supported options.
41
35
  DEFAULT_OPTIONS = {
@@ -153,7 +147,16 @@ class BlueCloth
153
147
 
154
148
  end # class BlueCloth
155
149
 
156
- require 'bluecloth_ext'
150
+ # Load the correct version if it's a Windows binary gem
151
+ if RUBY_PLATFORM =~/(mswin|mingw)/i
152
+ major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
153
+ raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
154
+ require "#{major_minor}/nokogiri"
155
+ else
156
+ require 'bluecloth_ext'
157
+ end
158
+
159
+
157
160
 
158
161
  # Set the top-level 'Markdown' constant if it isn't already set
159
162
  ::Markdown = ::BlueCloth unless defined?( ::Markdown )
data/rake/dependencies.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Dependency-checking and Installation Rake Tasks
3
- # $Id: dependencies.rb 43 2008-09-05 18:19:16Z deveiant $
3
+
4
4
  #
5
5
 
6
6
  require 'rubygems/dependency_installer'
data/rake/helpers.rb CHANGED
@@ -68,13 +68,19 @@ def trace( *msg )
68
68
  end
69
69
 
70
70
 
71
+ ### Return the specified args as a string, quoting any that have a space.
72
+ def quotelist( *args )
73
+ return args.flatten.collect {|part| part =~ /\s/ ? part.inspect : part}
74
+ end
75
+
76
+
71
77
  ### Run the specified command +cmd+ with system(), failing if the execution
72
78
  ### fails.
73
79
  def run( *cmd )
74
80
  cmd.flatten!
75
81
 
76
82
  if cmd.length > 1
77
- trace( cmd.collect {|part| part =~ /\s/ ? part.inspect : part} )
83
+ trace( quotelist(*cmd) )
78
84
  else
79
85
  trace( cmd )
80
86
  end
@@ -90,6 +96,15 @@ def run( *cmd )
90
96
  end
91
97
 
92
98
 
99
+ ### Run the given +cmd+ with the specified +args+ without interpolation by the shell and
100
+ ### return anything written to its STDOUT.
101
+ def read_command_output( cmd, *args )
102
+ trace "Reading output from: %s" % [ cmd, quotelist(cmd, *args) ]
103
+ output = IO.read( '|-' ) or exec cmd, *args
104
+ return output
105
+ end
106
+
107
+
93
108
  ### Run a subordinate Rake process with the same options and the specified +targets+.
94
109
  def rake( *targets )
95
110
  opts = ARGV.select {|arg| arg[0,1] == '-' }
@@ -387,7 +402,7 @@ end
387
402
  def edit( filename )
388
403
  editor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR
389
404
  system editor, filename
390
- unless $?.success?
405
+ unless $?.success? || editor =~ /vim/i
391
406
  fail "Editor exited uncleanly."
392
407
  end
393
408
  end
@@ -410,3 +425,10 @@ def in_subdirectory( subdir )
410
425
  end
411
426
 
412
427
 
428
+ ### Make an easily-comparable version vector out of +ver+ and return it.
429
+ def vvec( ver )
430
+ return ver.split('.').collect {|char| char.to_i }.pack('N*')
431
+ end
432
+
433
+
434
+
data/rake/hg.rb ADDED
@@ -0,0 +1,273 @@
1
+ #
2
+ # Mercurial Rake Tasks
3
+
4
+ require 'enumerator'
5
+
6
+ #
7
+ # Authors:
8
+ # * Michael Granger <ged@FaerieMUD.org>
9
+ #
10
+
11
+ unless defined?( HG_DOTDIR )
12
+
13
+ # Mercurial constants
14
+ HG_DOTDIR = BASEDIR + '.hg'
15
+ HG_STORE = HG_DOTDIR + 'store'
16
+
17
+ IGNORE_FILE = BASEDIR + '.hgignore'
18
+
19
+
20
+ ###
21
+ ### Helpers
22
+ ###
23
+
24
+ module MercurialHelpers
25
+
26
+ ###############
27
+ module_function
28
+ ###############
29
+
30
+ ### Generate a commit log from a diff and return it as a String.
31
+ def make_commit_log
32
+ diff = read_command_output( 'hg', 'diff' )
33
+ fail "No differences." if diff.empty?
34
+
35
+ return diff
36
+ end
37
+
38
+ ### Generate a commit log and invoke the user's editor on it.
39
+ def edit_commit_log
40
+ diff = make_commit_log()
41
+
42
+ File.open( COMMIT_MSG_FILE, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
43
+ fh.print( diff )
44
+ end
45
+
46
+ edit( COMMIT_MSG_FILE )
47
+ end
48
+
49
+ ### Generate a changelog.
50
+ def make_changelog
51
+ log = read_command_output( 'hg', 'log', '--style', 'compact' )
52
+ return log
53
+ end
54
+
55
+ ### Get the 'tip' info and return it as a Hash
56
+ def get_tip_info
57
+ data = read_command_output( 'hg', 'tip' )
58
+ return YAML.load( data )
59
+ end
60
+
61
+ ### Return the ID for the current rev
62
+ def get_current_rev
63
+ id = read_command_output( 'hg', '-q', 'identify' )
64
+ return id.chomp
65
+ end
66
+
67
+ ### Read the list of existing tags and return them as an Array
68
+ def get_tags
69
+ taglist = read_command_output( 'hg', 'tags' )
70
+ return taglist.split( /\n/ )
71
+ end
72
+
73
+
74
+ ### Read any remote repo paths known by the current repo and return them as a hash.
75
+ def get_repo_paths
76
+ paths = {}
77
+ pathspec = read_command_output( 'hg', 'paths' )
78
+ pathspec.split.each_slice( 3 ) do |name, _, url|
79
+ paths[ name ] = url
80
+ end
81
+ return paths
82
+ end
83
+
84
+ ### Return the list of files which are of status 'unknown'
85
+ def get_unknown_files
86
+ list = read_command_output( 'hg', 'status', '-un', '--no-color' )
87
+ list = list.split( /\n/ )
88
+
89
+ trace "New files: %p" % [ list ]
90
+ return list
91
+ end
92
+
93
+ ### Returns a human-scannable file list by joining and truncating the list if it's too long.
94
+ def humanize_file_list( list, indent=FILE_INDENT )
95
+ listtext = list[0..5].join( "\n#{indent}" )
96
+ if list.length > 5
97
+ listtext << " (and %d other/s)" % [ list.length - 5 ]
98
+ end
99
+
100
+ return listtext
101
+ end
102
+
103
+
104
+ ### Add the list of +pathnames+ to the .hgignore list.
105
+ def hg_ignore_files( *pathnames )
106
+ patterns = pathnames.flatten.collect do |path|
107
+ '^' + Regexp.escape(path) + '$'
108
+ end
109
+ trace "Ignoring %d files." % [ pathnames.length ]
110
+
111
+ IGNORE_FILE.open( File::CREAT|File::WRONLY|File::APPEND, 0644 ) do |fh|
112
+ fh.puts( patterns )
113
+ end
114
+ end
115
+
116
+
117
+ ### Delete the files in the given +filelist+ after confirming with the user.
118
+ def delete_extra_files( filelist )
119
+ description = humanize_file_list( filelist, ' ' )
120
+ log "Files to delete:\n ", description
121
+ ask_for_confirmation( "Really delete them?", false ) do
122
+ filelist.each do |f|
123
+ rm_rf( f, :verbose => true )
124
+ end
125
+ end
126
+ end
127
+
128
+ end # module MercurialHelpers
129
+
130
+
131
+ ### Rakefile support
132
+ def get_vcs_rev( dir='.' )
133
+ return MercurialHelpers.get_current_rev
134
+ end
135
+ def make_changelog
136
+ return MercurialHelpers.make_changelog
137
+ end
138
+
139
+
140
+ ###
141
+ ### Tasks
142
+ ###
143
+
144
+ desc "Mercurial tasks"
145
+ namespace :hg do
146
+ include MercurialHelpers
147
+
148
+ desc "Prepare for a new release"
149
+ task :prep_release do
150
+ tags = get_tags()
151
+ rev = get_current_rev()
152
+
153
+ # Look for a tag for the current release version, and if it exists abort
154
+ if tags.include?( PKG_VERSION )
155
+ error "Version #{PKG_VERSION} already has a tag. Did you mean " +
156
+ "to increment the version in #{VERSION_FILE}?"
157
+ fail
158
+ end
159
+
160
+ # Sign the current rev
161
+ log "Signing rev #{rev}"
162
+ run 'hg', 'sign'
163
+
164
+ # Tag the current rev
165
+ log "Tagging rev #{rev} as #{PKG_VERSION}"
166
+ run 'hg', 'tag', PKG_VERSION
167
+
168
+ # Offer to push
169
+ Rake::Task['hg:push'].invoke
170
+ end
171
+
172
+ desc "Check for new files and offer to add/ignore/delete them."
173
+ task :newfiles do
174
+ log "Checking for new files..."
175
+
176
+ entries = get_unknown_files()
177
+
178
+ unless entries.empty?
179
+ files_to_add = []
180
+ files_to_ignore = []
181
+ files_to_delete = []
182
+
183
+ entries.each do |entry|
184
+ action = prompt_with_default( " #{entry}: (a)dd, (i)gnore, (s)kip (d)elete", 's' )
185
+ case action
186
+ when 'a'
187
+ files_to_add << entry
188
+ when 'i'
189
+ files_to_ignore << entry
190
+ when 'd'
191
+ files_to_delete << entry
192
+ end
193
+ end
194
+
195
+ unless files_to_add.empty?
196
+ run 'hg', 'add', *files_to_add
197
+ end
198
+
199
+ unless files_to_ignore.empty?
200
+ hg_ignore_files( *files_to_ignore )
201
+ end
202
+
203
+ unless files_to_delete.empty?
204
+ delete_extra_files( files_to_delete )
205
+ end
206
+ end
207
+ end
208
+ task :add => :newfiles
209
+
210
+
211
+ desc "Pull and update from the default repo"
212
+ task :pull do
213
+ paths = get_repo_paths()
214
+ if origin_url = paths['default']
215
+ ask_for_confirmation( "Pull and update from '#{origin_url}'?", false ) do
216
+ run 'hg', 'pull', '-u'
217
+ end
218
+ else
219
+ trace "Skipping pull: No 'default' path."
220
+ end
221
+ end
222
+
223
+ desc "Check the current code in if tests pass"
224
+ task :checkin => ['hg:pull', 'hg:newfiles', 'test', COMMIT_MSG_FILE] do
225
+ targets = get_target_args()
226
+ $stderr.puts '---', File.read( COMMIT_MSG_FILE ), '---'
227
+ ask_for_confirmation( "Continue with checkin?" ) do
228
+ run 'hg', 'ci', '-l', COMMIT_MSG_FILE, targets
229
+ rm_f COMMIT_MSG_FILE
230
+ end
231
+ Rake::Task['hg:push'].invoke
232
+ end
233
+ task :commit => :checkin
234
+ task :ci => :checkin
235
+
236
+ CLEAN.include( COMMIT_MSG_FILE )
237
+
238
+ desc "Push to the default origin repo (if there is one)"
239
+ task :push do
240
+ paths = get_repo_paths()
241
+ if origin_url = paths['default']
242
+ ask_for_confirmation( "Push to '#{origin_url}'?", false ) do
243
+ run 'hg', 'push'
244
+ end
245
+ else
246
+ trace "Skipping push: No 'default' path."
247
+ end
248
+ end
249
+
250
+ end
251
+
252
+ if HG_DOTDIR.exist?
253
+ trace "Defining mercurial VCS tasks"
254
+
255
+ desc "Check in all the changes in your current working copy"
256
+ task :ci => 'hg:ci'
257
+ desc "Check in all the changes in your current working copy"
258
+ task :checkin => 'hg:ci'
259
+
260
+ desc "Tag and sign revision before a release"
261
+ task :prep_release => 'hg:prep_release'
262
+
263
+ file COMMIT_MSG_FILE do
264
+ edit_commit_log()
265
+ end
266
+
267
+ else
268
+ trace "Not defining mercurial tasks: no #{HG_DOTDIR}"
269
+ end
270
+
271
+ end
272
+
273
+
data/rake/manual.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Manual-generation Rake tasks and classes
3
- # $Id: manual.rb 110 2009-07-06 23:34:04Z deveiant $
3
+
4
4
  #
5
5
  # Authors:
6
6
  # * Michael Granger <ged@FaerieMUD.org>
@@ -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
@@ -674,7 +674,7 @@ module Manual
674
674
 
675
675
  ### Set up a rule for copying files from the resources directory to the output dir.
676
676
  def setup_resource_copy_tasks( resourcedir, outputdir )
677
- resources = FileList[ resourcedir + '**/*.{js,css,png,gif,jpg,html}' ]
677
+ resources = FileList[ resourcedir + '**/*.{js,css,png,gif,jpg,html,svg,svgz,swf}' ]
678
678
  resources.exclude( /\.svn/ )
679
679
  target_pathmap = "%%{%s,%s}p" % [ resourcedir, outputdir ]
680
680
  targets = resources.pathmap( target_pathmap )
data/rake/packaging.rb CHANGED
@@ -1,11 +1,11 @@
1
- #
2
- # Packaging Rake Tasks
3
- # $Id: packaging.rb 102 2009-05-23 21:40:00Z deveiant $
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
- require 'rake/packagetask'
8
- require 'rake/gempackagetask'
6
+ require 'pathname'
7
+ require 'rubygems/package_task'
8
+
9
9
 
10
10
  include Config
11
11
 
@@ -22,34 +22,23 @@ task :package => [:gem]
22
22
 
23
23
 
24
24
  ### Task: gem
25
- gempath = PKGDIR + GEM_FILE_NAME
26
-
27
- desc "Build a RubyGem package (#{GEM_FILE_NAME})"
28
- task :gem => gempath.to_s
29
- file gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
30
- when_writing( "Creating GEM" ) do
31
- Gem::Builder.new( GEMSPEC ).build
32
- verbose( true ) do
33
- mv GEM_FILE_NAME, gempath
34
- end
35
- end
36
- end
25
+ # gempath = PKGDIR + GEM_FILE_NAME
26
+ #
27
+ # desc "Build a RubyGem package (#{GEM_FILE_NAME})"
28
+ # task :gem => gempath.to_s
29
+ # file gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
30
+ # when_writing( "Creating GEM" ) do
31
+ # Gem::Builder.new( GEMSPEC ).build
32
+ # verbose( true ) do
33
+ # mv GEM_FILE_NAME, gempath
34
+ # end
35
+ # end
36
+ # end
37
+ #
37
38
 
38
- svnrev = get_svn_rev()
39
- prerelease_gem_file_name = "#{PKG_FILE_NAME}.#{svnrev}.gem"
40
- prerelease_gempath = PKGDIR + prerelease_gem_file_name
41
-
42
- desc "Build a pre-release RubyGem package"
43
- task :prerelease_gem => prerelease_gempath.to_s
44
- file prerelease_gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
45
- when_writing( "Creating prerelease GEM" ) do
46
- gemspec = GEMSPEC.clone
47
- gemspec.version = Gem::Version.create( "%s.%d" % [GEMSPEC.version, svnrev] )
48
- Gem::Builder.new( gemspec ).build
49
- verbose( true ) do
50
- mv prerelease_gem_file_name, prerelease_gempath
51
- end
52
- end
39
+ Gem::PackageTask.new( GEMSPEC ) do |pkg|
40
+ pkg.need_zip = true
41
+ pkg.need_tar = true
53
42
  end
54
43
 
55
44
 
@@ -60,7 +49,7 @@ task :install => "spec:quiet" do
60
49
  sitelib = Pathname.new( CONFIG['sitelibdir'] )
61
50
  sitearch = Pathname.new( CONFIG['sitearchdir'] )
62
51
  Dir.chdir( LIBDIR ) do
63
- LIB_FILES.each do |libfile|
52
+ LIB_FILES.collect {|path| Pathname(path) }.each do |libfile|
64
53
  relpath = libfile.relative_path_from( LIBDIR )
65
54
  target = sitelib + relpath
66
55
  FileUtils.mkpath target.dirname,
@@ -101,7 +90,7 @@ task :uninstall do
101
90
  sitearch = Pathname.new( CONFIG['sitearchdir'] )
102
91
 
103
92
  Dir.chdir( LIBDIR ) do
104
- LIB_FILES.each do |libfile|
93
+ LIB_FILES.collect {|path| Pathname(path) }.each do |libfile|
105
94
  relpath = libfile.relative_path_from( LIBDIR )
106
95
  target = sitelib + relpath
107
96
  FileUtils.rm_f target, :verbose => true, :noop => $dryrun
@@ -131,3 +120,12 @@ end
131
120
 
132
121
 
133
122
 
123
+ desc "Add development depdendencies to the gemspec -- this is meant to be chained " +
124
+ "together with :gem"
125
+ task :include_dev_dependencies do
126
+ DEVELOPMENT_DEPENDENCIES.each do |name, version|
127
+ version = '>= 0' if version.length.zero?
128
+ GEMSPEC.add_development_dependency( name, version )
129
+ end
130
+ end
131
+