bluecloth 2.0.6.pre120-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/ChangeLog +363 -0
  2. data/LICENSE +27 -0
  3. data/LICENSE.discount +47 -0
  4. data/README +81 -0
  5. data/Rakefile +349 -0
  6. data/Rakefile.local +43 -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 +391 -0
  12. data/ext/bluecloth.h +19 -0
  13. data/ext/config.h +55 -0
  14. data/ext/css.c +76 -0
  15. data/ext/cstring.h +75 -0
  16. data/ext/docheader.c +43 -0
  17. data/ext/extconf.rb +52 -0
  18. data/ext/generate.c +1602 -0
  19. data/ext/markdown.c +1078 -0
  20. data/ext/markdown.h +146 -0
  21. data/ext/mkdio.c +303 -0
  22. data/ext/mkdio.h +79 -0
  23. data/ext/resource.c +155 -0
  24. data/ext/version.c +28 -0
  25. data/ext/xml.c +82 -0
  26. data/ext/xmlpage.c +48 -0
  27. data/lib/1.8/bluecloth_ext.so +0 -0
  28. data/lib/1.9/bluecloth_ext.so +0 -0
  29. data/lib/bluecloth.rb +164 -0
  30. data/rake/191_compat.rb +26 -0
  31. data/rake/dependencies.rb +76 -0
  32. data/rake/helpers.rb +434 -0
  33. data/rake/hg.rb +273 -0
  34. data/rake/manual.rb +782 -0
  35. data/rake/packaging.rb +126 -0
  36. data/rake/publishing.rb +269 -0
  37. data/rake/rdoc.rb +30 -0
  38. data/rake/style.rb +62 -0
  39. data/rake/svn.rb +668 -0
  40. data/rake/testing.rb +187 -0
  41. data/rake/verifytask.rb +64 -0
  42. data/rake/win32.rb +190 -0
  43. data/spec/bluecloth/101_changes_spec.rb +141 -0
  44. data/spec/bluecloth/autolinks_spec.rb +49 -0
  45. data/spec/bluecloth/blockquotes_spec.rb +145 -0
  46. data/spec/bluecloth/code_spans_spec.rb +164 -0
  47. data/spec/bluecloth/emphasis_spec.rb +164 -0
  48. data/spec/bluecloth/entities_spec.rb +65 -0
  49. data/spec/bluecloth/hrules_spec.rb +90 -0
  50. data/spec/bluecloth/images_spec.rb +92 -0
  51. data/spec/bluecloth/inline_html_spec.rb +238 -0
  52. data/spec/bluecloth/links_spec.rb +171 -0
  53. data/spec/bluecloth/lists_spec.rb +294 -0
  54. data/spec/bluecloth/paragraphs_spec.rb +75 -0
  55. data/spec/bluecloth/titles_spec.rb +305 -0
  56. data/spec/bluecloth_spec.rb +281 -0
  57. data/spec/bugfix_spec.rb +172 -0
  58. data/spec/contributions_spec.rb +85 -0
  59. data/spec/data/antsugar.txt +34 -0
  60. data/spec/data/markdowntest/Amps and angle encoding.html +17 -0
  61. data/spec/data/markdowntest/Amps and angle encoding.text +21 -0
  62. data/spec/data/markdowntest/Auto links.html +18 -0
  63. data/spec/data/markdowntest/Auto links.text +13 -0
  64. data/spec/data/markdowntest/Backslash escapes.html +118 -0
  65. data/spec/data/markdowntest/Backslash escapes.text +120 -0
  66. data/spec/data/markdowntest/Blockquotes with code blocks.html +15 -0
  67. data/spec/data/markdowntest/Blockquotes with code blocks.text +11 -0
  68. data/spec/data/markdowntest/Code Blocks.html +18 -0
  69. data/spec/data/markdowntest/Code Blocks.text +14 -0
  70. data/spec/data/markdowntest/Code Spans.html +5 -0
  71. data/spec/data/markdowntest/Code Spans.text +5 -0
  72. data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.html +8 -0
  73. data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.text +8 -0
  74. data/spec/data/markdowntest/Horizontal rules.html +71 -0
  75. data/spec/data/markdowntest/Horizontal rules.text +67 -0
  76. data/spec/data/markdowntest/Inline HTML (Advanced).html +15 -0
  77. data/spec/data/markdowntest/Inline HTML (Advanced).text +15 -0
  78. data/spec/data/markdowntest/Inline HTML (Simple).html +72 -0
  79. data/spec/data/markdowntest/Inline HTML (Simple).text +69 -0
  80. data/spec/data/markdowntest/Inline HTML comments.html +13 -0
  81. data/spec/data/markdowntest/Inline HTML comments.text +13 -0
  82. data/spec/data/markdowntest/Links, inline style.html +11 -0
  83. data/spec/data/markdowntest/Links, inline style.text +12 -0
  84. data/spec/data/markdowntest/Links, reference style.html +52 -0
  85. data/spec/data/markdowntest/Links, reference style.text +71 -0
  86. data/spec/data/markdowntest/Links, shortcut references.html +9 -0
  87. data/spec/data/markdowntest/Links, shortcut references.text +20 -0
  88. data/spec/data/markdowntest/Literal quotes in titles.html +3 -0
  89. data/spec/data/markdowntest/Literal quotes in titles.text +7 -0
  90. data/spec/data/markdowntest/Markdown Documentation - Basics.html +314 -0
  91. data/spec/data/markdowntest/Markdown Documentation - Basics.text +306 -0
  92. data/spec/data/markdowntest/Markdown Documentation - Syntax.html +942 -0
  93. data/spec/data/markdowntest/Markdown Documentation - Syntax.text +888 -0
  94. data/spec/data/markdowntest/Nested blockquotes.html +9 -0
  95. data/spec/data/markdowntest/Nested blockquotes.text +5 -0
  96. data/spec/data/markdowntest/Ordered and unordered lists.html +148 -0
  97. data/spec/data/markdowntest/Ordered and unordered lists.text +131 -0
  98. data/spec/data/markdowntest/Strong and em together.html +7 -0
  99. data/spec/data/markdowntest/Strong and em together.text +7 -0
  100. data/spec/data/markdowntest/Tabs.html +25 -0
  101. data/spec/data/markdowntest/Tabs.text +21 -0
  102. data/spec/data/markdowntest/Tidyness.html +8 -0
  103. data/spec/data/markdowntest/Tidyness.text +5 -0
  104. data/spec/data/ml-announce.txt +17 -0
  105. data/spec/data/re-overflow.txt +67 -0
  106. data/spec/data/re-overflow2.txt +281 -0
  107. data/spec/discount_spec.rb +184 -0
  108. data/spec/lib/constants.rb +5 -0
  109. data/spec/lib/helpers.rb +137 -0
  110. data/spec/lib/matchers.rb +235 -0
  111. data/spec/markdowntest_spec.rb +79 -0
  112. metadata +205 -0
data/Rakefile ADDED
@@ -0,0 +1,349 @@
1
+ #!rake -*- ruby -*-
2
+ #
3
+ # BlueCloth rakefile
4
+ #
5
+ # Based on various other Rakefiles, especially one by Ben Bleything
6
+ #
7
+ # Copyright (c) 2007-2010 The FaerieMUD Consortium
8
+ #
9
+ # Authors:
10
+ # * Michael Granger <ged@FaerieMUD.org>
11
+ #
12
+
13
+ BEGIN {
14
+ require 'pathname'
15
+ basedir = Pathname.new( __FILE__ ).dirname
16
+
17
+ libdir = basedir + "lib"
18
+ extdir = basedir + "ext"
19
+
20
+ $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
21
+ $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
22
+ }
23
+
24
+ begin
25
+ require 'readline'
26
+ include Readline
27
+ rescue LoadError
28
+ # Fall back to a plain prompt
29
+ def readline( text )
30
+ $stderr.print( text.chomp )
31
+ return $stdin.gets
32
+ end
33
+ end
34
+
35
+ begin
36
+ require 'rubygems'
37
+ rescue LoadError
38
+ module Gem
39
+ class Specification; end
40
+ end
41
+ end
42
+
43
+ require 'rbconfig'
44
+ require 'rake'
45
+ require 'rake/testtask'
46
+ require 'rake/packagetask'
47
+ require 'rake/clean'
48
+ # require 'rake/191_compat.rb'
49
+
50
+ $dryrun = false
51
+
52
+ ### Config constants
53
+ BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
54
+ BINDIR = BASEDIR + 'bin'
55
+ LIBDIR = BASEDIR + 'lib'
56
+ EXTDIR = BASEDIR + 'ext'
57
+ DOCSDIR = BASEDIR + 'docs'
58
+ PKGDIR = BASEDIR + 'pkg'
59
+ DATADIR = BASEDIR + 'data'
60
+
61
+ MANUALDIR = DOCSDIR + 'manual'
62
+
63
+ PROJECT_NAME = 'BlueCloth'
64
+ PKG_NAME = PROJECT_NAME.downcase
65
+ PKG_SUMMARY = 'BlueCloth is a Ruby implementation of Markdown'
66
+
67
+ # Cruisecontrol stuff
68
+ CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
69
+ CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
70
+
71
+ VERSION_FILE = LIBDIR + 'bluecloth.rb'
72
+ if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
73
+ PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
74
+ elsif VERSION_FILE.exist?
75
+ PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
76
+ else
77
+ PKG_VERSION = '0.0.0'
78
+ end
79
+
80
+ PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
81
+ GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
82
+
83
+ # Universal VCS constants
84
+ DEFAULT_EDITOR = 'vi'
85
+ COMMIT_MSG_FILE = 'commit-msg.txt'
86
+ FILE_INDENT = " " * 12
87
+ LOG_INDENT = " " * 3
88
+
89
+ EXTCONF = EXTDIR + 'extconf.rb'
90
+
91
+ ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
92
+
93
+ TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README LICENSE] )
94
+ BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
95
+ LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
96
+ EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
97
+ DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
98
+
99
+ SPECDIR = BASEDIR + 'spec'
100
+ SPECLIBDIR = SPECDIR + 'lib'
101
+ SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
102
+
103
+ TESTDIR = BASEDIR + 'tests'
104
+ TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
105
+
106
+ RAKE_TASKDIR = BASEDIR + 'rake'
107
+ RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
108
+ PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
109
+ PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
110
+
111
+ RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
112
+
113
+ LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
114
+
115
+ EXTRA_PKGFILES = Rake::FileList.new
116
+ EXTRA_PKGFILES.include( "#{BASEDIR}/LICENSE.discount" )
117
+ EXTRA_PKGFILES.include( "#{BASEDIR}/spec/data/**/*.{txt,text,html}" )
118
+ EXTRA_PKGFILES.include( "#{BASEDIR}/ext/VERSION" )
119
+
120
+ RELEASE_FILES = TEXT_FILES +
121
+ SPEC_FILES +
122
+ TEST_FILES +
123
+ BIN_FILES +
124
+ LIB_FILES +
125
+ EXT_FILES +
126
+ DATA_FILES +
127
+ RAKE_TASKLIBS +
128
+ EXTRA_PKGFILES
129
+
130
+
131
+ RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
132
+
133
+ RELEASE_ANNOUNCE_ADDRESSES = [
134
+ "Ruby-Talk List <ruby-talk@ruby-lang.org>",
135
+ ]
136
+
137
+ COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
138
+ RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
139
+ RCOV_OPTS = [
140
+ '--exclude', RCOV_EXCLUDES,
141
+ '--xrefs',
142
+ '--save',
143
+ '--callsites',
144
+ #'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
145
+ ]
146
+
147
+
148
+ ### Load some task libraries that need to be loaded early
149
+ if !RAKE_TASKDIR.exist?
150
+ $stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
151
+ ans = readline( "for you? [y]" )
152
+ ans = 'y' if !ans.nil? && ans.empty?
153
+
154
+ if ans =~ /^y/i
155
+ $stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
156
+ system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
157
+ if ! $?.success?
158
+ fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
159
+ end
160
+ else
161
+ $stderr.puts "Then I'm afraid I can't continue. Best of luck."
162
+ fail "Rake tasklibs not present."
163
+ end
164
+
165
+ RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
166
+ end
167
+
168
+ require RAKE_TASKDIR + 'helpers.rb'
169
+
170
+ # Set the build ID if the mercurial executable is available
171
+ if hg = which( 'hg' )
172
+ id = IO.read('|-') or exec hg.to_s, 'id', '-n'
173
+ PKG_BUILD = 'pre' + (id.chomp[ /^[[:xdigit:]]+/ ] || '1')
174
+ else
175
+ PKG_BUILD = 'pre0'
176
+ end
177
+ SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
178
+ SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
179
+
180
+ # Documentation constants
181
+ RDOCDIR = DOCSDIR + 'api'
182
+ RDOC_OPTIONS = [
183
+ '-w', '4',
184
+ '-HN',
185
+ '-i', '.',
186
+ '-m', 'README',
187
+ '-t', PKG_NAME,
188
+ '-W', 'http://deveiate.org/projects/BlueCloth/browser/'
189
+ ]
190
+
191
+ # Release constants
192
+ SMTP_HOST = "mail.faeriemud.org"
193
+ SMTP_PORT = 465 # SMTP + SSL
194
+
195
+ # Project constants
196
+ PROJECT_HOST = 'deveiate'
197
+ PROJECT_PUBDIR = '/usr/local/www/public/code'
198
+ PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
199
+ PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
200
+ PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
201
+
202
+ # Gem dependencies: gemname => version
203
+ DEPENDENCIES = {
204
+ }
205
+
206
+ # Developer Gem dependencies: gemname => version
207
+ DEVELOPMENT_DEPENDENCIES = {
208
+ 'rake' => '>= 0.8.7',
209
+ 'rcodetools' => '>= 0.7.0.0',
210
+ 'rcov' => '>= 0.8.1.2.0',
211
+ 'rdoc' => '>= 2.4.3',
212
+ 'RedCloth' => '>= 4.0.3',
213
+ 'rspec' => '>= 1.2.6',
214
+ 'termios' => '>= 0',
215
+ 'text-format' => '>= 1.0.0',
216
+ 'tmail' => '>= 1.2.3.1',
217
+ 'diff-lcs' => '>= 1.1.2',
218
+ 'rake-compiler' => '>= 0.7.0',
219
+ }
220
+
221
+ # Non-gem requirements: packagename => version
222
+ REQUIREMENTS = {
223
+ }
224
+
225
+ # RubyGem specification
226
+ GEMSPEC = Gem::Specification.new do |gem|
227
+ gem.name = PKG_NAME.downcase
228
+ gem.version = PKG_VERSION
229
+
230
+ gem.summary = PKG_SUMMARY
231
+ gem.description = [
232
+ "BlueCloth is a Ruby implementation of [Markdown][1], a text-to-HTML conversion",
233
+ "tool for web writers. To quote from the project page: Markdown allows you to",
234
+ "write using an easy-to-read, easy-to-write plain text format, then convert it to",
235
+ "structurally valid XHTML (or HTML).",
236
+ ].join( "\n" )
237
+
238
+ gem.authors = "Michael Granger"
239
+ gem.email = ["ged@FaerieMUD.org"]
240
+ gem.homepage = 'http://deveiate.org/projects/BlueCloth/'
241
+
242
+ gem.has_rdoc = true
243
+ gem.rdoc_options = RDOC_OPTIONS
244
+ gem.extra_rdoc_files = %w[ChangeLog README LICENSE]
245
+
246
+ gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
247
+ gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
248
+ collect {|pn| File.basename(pn) }
249
+ gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
250
+
251
+ if EXTCONF.exist?
252
+ gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
253
+ end
254
+
255
+ gem.files = RELEASE_FILES
256
+ gem.test_files = SPEC_FILES
257
+
258
+ DEPENDENCIES.each do |name, version|
259
+ version = '>= 0' if version.length.zero?
260
+ gem.add_runtime_dependency( name, version )
261
+ end
262
+
263
+ REQUIREMENTS.each do |name, version|
264
+ gem.requirements << [ name, version ].compact.join(' ')
265
+ end
266
+ end
267
+
268
+
269
+ task :prerelease do
270
+ GEMSPEC.version.version += '.' + PKG_BUILD
271
+ end
272
+
273
+
274
+ $trace = Rake.application.options.trace ? true : false
275
+ $dryrun = Rake.application.options.dryrun ? true : false
276
+ $include_dev_dependencies = false
277
+
278
+ # Load any remaining task libraries
279
+ RAKE_TASKLIBS.each do |tasklib|
280
+ next if tasklib.to_s =~ %r{/helpers\.rb$}
281
+ begin
282
+ trace " loading tasklib %s" % [ tasklib ]
283
+ import tasklib
284
+ rescue ScriptError => err
285
+ fail "Task library '%s' failed to load: %s: %s" %
286
+ [ tasklib, err.class.name, err.message ]
287
+ trace "Backtrace: \n " + err.backtrace.join( "\n " )
288
+ rescue => err
289
+ log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
290
+ [ tasklib, err.class.name, err.message ]
291
+ trace "Backtrace: \n " + err.backtrace.join( "\n " )
292
+ end
293
+ end
294
+
295
+ # Load any project-specific rules defined in 'Rakefile.local' if it exists
296
+ import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
297
+
298
+
299
+ #####################################################################
300
+ ### T A S K S
301
+ #####################################################################
302
+
303
+ ### Default task
304
+ task :default => [:clean, :local, :spec, :rdoc, :package]
305
+
306
+ ### Task the local Rakefile can append to -- no-op by default
307
+ task :local
308
+
309
+ ### Task: clean
310
+ CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
311
+ CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
312
+
313
+ ### Task: changelog
314
+ file 'ChangeLog' do |task|
315
+ log "Updating #{task.name}"
316
+
317
+ changelog = make_changelog()
318
+ File.open( task.name, 'w' ) do |fh|
319
+ fh.print( changelog )
320
+ end
321
+ end
322
+
323
+
324
+ ### Task: cruise (Cruisecontrol task)
325
+ desc "Cruisecontrol build"
326
+ task :cruise => [:clean, 'spec:quiet', :package] do |task|
327
+ raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
328
+ artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
329
+ artifact_dir.mkpath
330
+
331
+ coverage = BASEDIR + 'coverage'
332
+ if coverage.exist? && coverage.directory?
333
+ $stderr.puts "Copying coverage stats..."
334
+ FileUtils.cp_r( 'coverage', artifact_dir )
335
+ end
336
+
337
+ $stderr.puts "Copying packages..."
338
+ FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
339
+ end
340
+
341
+
342
+ desc "Update the build system to the latest version"
343
+ task :update_build do
344
+ log "Updating the build system"
345
+ run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
346
+ log "Updating the Rakefile"
347
+ sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
348
+ end
349
+
data/Rakefile.local ADDED
@@ -0,0 +1,43 @@
1
+ #!rake
2
+
3
+ require 'rake/extensiontask'
4
+
5
+ # C extension constants
6
+ EXT_MAKEFILE = EXTDIR + 'Makefile'
7
+ EXT_SOURCES = FileList[ EXTDIR + '*.c' ]
8
+ EXT_SO = EXTDIR + "bluecloth_ext.#{CONFIG['DLEXT']}"
9
+
10
+ GEMSPEC.extra_rdoc_files << 'LICENSE.discount'
11
+ DOCFILES << 'LICENSE.discount'
12
+
13
+
14
+ #####################################################################
15
+ ### T A S K S
16
+ #####################################################################
17
+
18
+ # Make both the default task and the spec task depend on building the extension
19
+ task :local => :compile
20
+ task :spec => :compile
21
+ namespace :spec do
22
+ task :doc => [ :compile ]
23
+ task :quiet => [ :compile ]
24
+ task :html => [ :compile ]
25
+ task :text => [ :compile ]
26
+ end
27
+
28
+ ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
29
+
30
+ Rake::ExtensionTask.new do |ext|
31
+ ext.name = 'bluecloth_ext'
32
+ ext.gem_spec = GEMSPEC
33
+ ext.ext_dir = 'ext'
34
+ ext.lib_dir = 'lib'
35
+ ext.source_pattern = "*.{c,h}"
36
+ ext.cross_compile = true
37
+ ext.cross_platform = %w[i386-mswin32 i386-mingw32]
38
+ end
39
+
40
+ WINFAT_DIRS = Rake::FileList[ LIBDIR + '{1.8,1.9}' ]
41
+
42
+ CLEAN.include( WINFAT_DIRS )
43
+
data/bin/bluecloth ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # = bluecloth
4
+ #
5
+ # Format one or more text files with the markdown formatter.
6
+ #
7
+ # = Synopsis
8
+ #
9
+ # bluecloth [OPTIONS] [FILES]
10
+ #
11
+ #
12
+ #
13
+
14
+ BEGIN {
15
+ require 'bluecloth'
16
+ require 'optparse'
17
+ }
18
+
19
+ DocumentWrapper = %{
20
+ <html>
21
+ <head><title>%s</title></head>
22
+ <body>
23
+ %s
24
+ </body>
25
+ </html>
26
+ }
27
+
28
+ def main
29
+ fragment = false
30
+ destination = '.'
31
+
32
+ ARGV.options do |oparser|
33
+
34
+ oparser.banner = "Usage: #$0 [OPTIONS] FILES"
35
+
36
+ # Debug mode
37
+ oparser.on( "--debug", "-d", TrueClass, "Turn debugging output on" ) {
38
+ $DEBUG = true
39
+ }
40
+
41
+ # 'Fragment' mode
42
+ oparser.on( "--fragment", "-f", TrueClass,
43
+ "Output HTML fragments instead of whole documents" ) {
44
+ fragment = true
45
+ }
46
+
47
+ # Output destination
48
+ #oparser.on( "--output=DESTINATION", "-o DESTINATION", String,
49
+ # "Write output to DESTINATION instead of the current directory" ) {|arg|
50
+ # destination = arg
51
+ #}
52
+
53
+ oparser.parse!
54
+ end
55
+
56
+ # Filter mode if no arguments
57
+ ARGV.push( "-" ) if ARGV.empty?
58
+
59
+ ARGV.each {|file|
60
+ if file == '-'
61
+ contents = $stdin.read
62
+ else
63
+ contents = File::read( file )
64
+ end
65
+
66
+ bc = BlueCloth::new( contents )
67
+ $stderr.puts "Using BlueCloth version #{BlueCloth::VERSION}"
68
+
69
+ if fragment
70
+ $stdout.puts bc.to_html
71
+ else
72
+ $stdout.puts DocumentWrapper % [ file, bc.to_html ]
73
+ end
74
+ }
75
+
76
+ rescue => err
77
+ $stderr.puts "Aborting: Fatal error: %s" % err.message
78
+ exit 255
79
+ end
80
+
81
+
82
+
83
+ main
84
+