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/rake/testing.rb ADDED
@@ -0,0 +1,187 @@
1
+ #
2
+ # Rake tasklib for testing tasks
3
+
4
+ #
5
+ # Authors:
6
+ # * Michael Granger <ged@FaerieMUD.org>
7
+ #
8
+
9
+ unless defined?( COVERAGE_MINIMUM )
10
+ if ENV['COVVERAGE_MINIMUM']
11
+ COVERAGE_MINIMUM = Float( ENV['COVERAGE_MINIMUM'] )
12
+ else
13
+ COVERAGE_MINIMUM = 85.0
14
+ end
15
+ end
16
+ SPEC_FILES = [] unless defined?( SPEC_FILES )
17
+ TEST_FILES = [] unless defined?( TEST_FILES )
18
+
19
+ COMMON_SPEC_OPTS = ['-Du'] unless defined?( COMMON_SPEC_OPTS )
20
+
21
+ COVERAGE_TARGETDIR = BASEDIR + 'coverage' unless defined?( COVERAGE_TARGETDIR )
22
+ RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib' unless
23
+ defined?( RCOV_EXCLUDES )
24
+
25
+
26
+ desc "Run all defined tests"
27
+ task :test do
28
+ unless SPEC_FILES.empty?
29
+ log "Running specs"
30
+ Rake::Task['spec:quiet'].invoke
31
+ end
32
+
33
+ unless TEST_FILES.empty?
34
+ log "Running unit tests"
35
+ Rake::Task[:unittests].invoke
36
+ end
37
+ end
38
+
39
+
40
+ ### RSpec specifications
41
+ begin
42
+ gem 'rspec', '>= 1.1.3'
43
+
44
+ require 'spec'
45
+ require 'spec/rake/spectask'
46
+
47
+ ### Task: spec
48
+ desc "Run specs"
49
+ task :spec => 'spec:doc'
50
+
51
+ namespace :spec do
52
+ desc "Run rspec every time there's a change to one of the files"
53
+ task :autotest do
54
+ require 'autotest/rspec'
55
+
56
+ autotester = Autotest::Rspec.new
57
+ autotester.run
58
+ end
59
+
60
+ desc "Generate regular color 'doc' spec output"
61
+ Spec::Rake::SpecTask.new( :doc ) do |task|
62
+ task.spec_files = SPEC_FILES
63
+ task.spec_opts = COMMON_SPEC_OPTS + ['-f', 's', '-c']
64
+ end
65
+
66
+ desc "Generate spec output with profiling"
67
+ Spec::Rake::SpecTask.new( :profile ) do |task|
68
+ task.spec_files = SPEC_FILES
69
+ task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'o']
70
+ end
71
+
72
+ desc "Generate quiet non-colored plain-text output"
73
+ Spec::Rake::SpecTask.new( :quiet ) do |task|
74
+ task.spec_files = SPEC_FILES
75
+ task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'p']
76
+ end
77
+
78
+ desc "Generate HTML output"
79
+ Spec::Rake::SpecTask.new( :html ) do |task|
80
+ task.spec_files = SPEC_FILES
81
+ task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'h']
82
+ end
83
+
84
+ end
85
+ rescue LoadError => err
86
+ task :no_rspec do
87
+ $stderr.puts "Specification tasks not defined: %s" % [ err.message ]
88
+ end
89
+
90
+ task :spec => :no_rspec
91
+ namespace :spec do
92
+ task :autotest => :no_rspec
93
+ task :doc => :no_rspec
94
+ task :profile => :no_rspec
95
+ task :quiet => :no_rspec
96
+ task :html => :no_rspec
97
+ end
98
+ end
99
+
100
+
101
+ ### Test::Unit tests
102
+ begin
103
+ require 'rake/testtask'
104
+
105
+ Rake::TestTask.new( :unittests ) do |task|
106
+ task.libs += [LIBDIR]
107
+ task.test_files = TEST_FILES
108
+ task.verbose = true
109
+ end
110
+
111
+ rescue LoadError => err
112
+ task :no_test do
113
+ $stderr.puts "Test tasks not defined: %s" % [ err.message ]
114
+ end
115
+
116
+ task :unittests => :no_rspec
117
+ end
118
+
119
+
120
+ ### RCov (via RSpec) tasks
121
+ begin
122
+ gem 'rcov'
123
+ gem 'rspec', '>= 1.1.3'
124
+
125
+ require 'spec'
126
+ require 'rcov'
127
+
128
+ ### Task: coverage (via RCov)
129
+ desc "Build test coverage reports"
130
+ unless SPEC_FILES.empty?
131
+ Spec::Rake::SpecTask.new( :coverage ) do |task|
132
+ task.spec_files = SPEC_FILES
133
+ task.libs += [LIBDIR]
134
+ task.spec_opts = ['-f', 'p', '-b']
135
+ task.rcov_opts = RCOV_OPTS
136
+ task.rcov = true
137
+ end
138
+ end
139
+
140
+
141
+ ### Task: rcov
142
+ task :rcov => :coverage
143
+
144
+ ### Other coverage tasks
145
+ namespace :coverage do
146
+ desc "Generate a detailed text coverage report"
147
+ Spec::Rake::SpecTask.new( :text ) do |task|
148
+ task.spec_files = SPEC_FILES
149
+ task.rcov_opts = RCOV_OPTS + ['--text-report']
150
+ task.rcov = true
151
+ end
152
+
153
+ desc "Show differences in coverage from last run"
154
+ Spec::Rake::SpecTask.new( :diff ) do |task|
155
+ task.spec_files = SPEC_FILES
156
+ task.spec_opts = ['-f', 'p', '-b']
157
+ task.rcov_opts = RCOV_OPTS - ['--save'] + ['--text-coverage-diff']
158
+ task.rcov = true
159
+ end
160
+
161
+ desc "Run RCov in 'spec-only' mode to check coverage from specs"
162
+ Spec::Rake::SpecTask.new( :speconly ) do |task|
163
+ task.spec_files = SPEC_FILES
164
+ task.rcov_opts = ['--exclude', RCOV_EXCLUDES, '--text-report', '--save']
165
+ task.rcov = true
166
+ end
167
+ end
168
+
169
+ CLOBBER.include( COVERAGE_TARGETDIR )
170
+
171
+ rescue LoadError => err
172
+ task :no_rcov do
173
+ $stderr.puts "Coverage tasks not defined: RSpec+RCov tasklib not available: %s" %
174
+ [ err.message ]
175
+ end
176
+
177
+ task :coverage => :no_rcov
178
+ task :clobber_coverage
179
+ task :rcov => :no_rcov
180
+ namespace :coverage do
181
+ task :text => :no_rcov
182
+ task :diff => :no_rcov
183
+ end
184
+ task :verify => :no_rcov
185
+ end
186
+
187
+
@@ -0,0 +1,64 @@
1
+ #####################################################################
2
+ ### S U B V E R S I O N T A S K S A N D H E L P E R S
3
+ #####################################################################
4
+
5
+ require 'rake/tasklib'
6
+
7
+ #
8
+ # Work around the inexplicable behaviour of the original RDoc::VerifyTask, which
9
+ # errors if your coverage isn't *exactly* the threshold.
10
+ #
11
+
12
+ # A task that can verify that the RCov coverage doesn't
13
+ # drop below a certain threshold. It should be run after
14
+ # running Spec::Rake::SpecTask.
15
+ class VerifyTask < Rake::TaskLib
16
+
17
+ COVERAGE_PERCENTAGE_PATTERN =
18
+ %r{<tt class='coverage_code'>(\d+\.\d+)%</tt>}
19
+
20
+ # Name of the task. Defaults to :verify_rcov
21
+ attr_accessor :name
22
+
23
+ # Path to the index.html file generated by RCov, which
24
+ # is the file containing the total coverage.
25
+ # Defaults to 'coverage/index.html'
26
+ attr_accessor :index_html
27
+
28
+ # Whether or not to output details. Defaults to true.
29
+ attr_accessor :verbose
30
+
31
+ # The threshold value (in percent) for coverage. If the
32
+ # actual coverage is not equal to this value, the task will raise an
33
+ # exception.
34
+ attr_accessor :threshold
35
+
36
+ def initialize( name=:verify )
37
+ @name = name
38
+ @index_html = 'coverage/index.html'
39
+ @verbose = true
40
+ yield self if block_given?
41
+ raise "Threshold must be set" if @threshold.nil?
42
+ define
43
+ end
44
+
45
+ def define
46
+ desc "Verify that rcov coverage is at least #{threshold}%"
47
+
48
+ task @name do
49
+ total_coverage = nil
50
+ if match = File.read( index_html ).match( COVERAGE_PERCENTAGE_PATTERN )
51
+ total_coverage = Float( match[1] )
52
+ else
53
+ raise "Couldn't find the coverage percentage in #{index_html}"
54
+ end
55
+
56
+ puts "Coverage: #{total_coverage}% (threshold: #{threshold}%)" if verbose
57
+ if total_coverage < threshold
58
+ raise "Coverage must be at least #{threshold}% but was #{total_coverage}%"
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ # vim: set nosta noet ts=4 sw=4:
data/rake/win32.rb ADDED
@@ -0,0 +1,190 @@
1
+ #
2
+ # Win32-specific tasks (cross-compiling, etc.)
3
+ #
4
+ # Thanks to some people that understand this stuff better than me for
5
+ # posting helpful blog posts. This stuff is an amalgam of stuff they did:
6
+ #
7
+ # * Mauricio Fernandez
8
+ # http://eigenclass.org/hiki/cross+compiling+rcovrt
9
+ #
10
+ # * Jeremy Hinegardner
11
+ # http://www.copiousfreetime.org/articles/2008/10/12/building-gems-for-windows.html
12
+ #
13
+ # * Aaron Patterson
14
+ # http://tenderlovemaking.com/2008/11/21/cross-compiling-ruby-gems-for-win32/
15
+
16
+ require 'rubygems'
17
+ require 'rake'
18
+ require 'pathname'
19
+ require 'rubygems/platform'
20
+ require 'rbconfig'
21
+ require 'uri'
22
+ require 'net/ftp'
23
+
24
+ HOMEDIR = Pathname( '~' ).expand_path
25
+ RUBYVERSION = '1.8.6-p287'
26
+ RUBYVERSION_MAJORMINOR = RUBYVERSION[/^\d+\.\d+/]
27
+
28
+ RUBY_DL_BASE = "ftp://ftp.ruby-lang.org/pub/ruby/#{RUBYVERSION_MAJORMINOR}/"
29
+ RUBY_DL_URI = URI( RUBY_DL_BASE + "ruby-#{RUBYVERSION}.tar.gz" )
30
+
31
+ XCOMPILER_DIR = HOMEDIR + '.ruby_mingw32'
32
+
33
+ XCOMPILER_DL = XCOMPILER_DIR + "ruby-#{RUBYVERSION}.tar.gz"
34
+ XCOMPILER_SRC = XCOMPILER_DIR + "ruby-#{RUBYVERSION}"
35
+
36
+ XCOMPILER_BIN = XCOMPILER_DIR + 'bin'
37
+ XCOMPILER_LIB = XCOMPILER_DIR + 'lib'
38
+ XCOMPILER_RUBY = XCOMPILER_BIN + 'ruby.exe'
39
+
40
+ XCOMPILER_LOAD_PATH = XCOMPILER_LIB + "ruby/#{RUBYVERSION_MAJORMINOR}/i386-mingw32"
41
+
42
+ TAR_OPTS = { :compression => :gzip }
43
+
44
+ WIN32_GEMSPEC = GEMSPEC.dup
45
+ WIN32_GEMSPEC.files += FileList[ EXTDIR + '**.{dll,so}' ]
46
+ WIN32_GEMSPEC.platform = Gem::Platform.new( 'i386-mingw32' )
47
+ WIN32_GEMSPEC.extensions = []
48
+
49
+
50
+ CONFIGURE_CMD = %W[
51
+ env
52
+ ac_cv_func_getpgrp_void=no
53
+ ac_cv_func_setpgrp_void=yes
54
+ rb_cv_negative_time_t=no
55
+ ac_cv_func_memcmp_working=yes
56
+ rb_cv_binary_elf=no
57
+ ./configure
58
+ --host=i386-mingw32
59
+ --target=i386-mingw32
60
+ --build=#{Config::CONFIG['build']}
61
+ --prefix=#{XCOMPILER_DIR}
62
+ ]
63
+
64
+ ### Archive::Tar::Reader#extract (as of 0.9.0) is broken w.r.t.
65
+ ### permissions, so we have to do this ourselves.
66
+ def untar( tarfile, targetdir )
67
+ targetdir = Pathname( targetdir )
68
+ raise "No such directory: #{targetdir}" unless targetdir.directory?
69
+
70
+ reader = Archive::Tar::Reader.new( tarfile.to_s, TAR_OPTS )
71
+
72
+ mkdir_p( targetdir )
73
+ reader.each( true ) do |header, body|
74
+ path = targetdir + header[:path]
75
+ # trace "Header is: %p" % [ header ]
76
+
77
+ case header[:type]
78
+ when :file
79
+ trace " #{path}"
80
+ path.open( File::WRONLY|File::EXCL|File::CREAT|File::TRUNC, header[:mode] ) do |fio|
81
+ bytesize = header[:size]
82
+ fio.write( body[0,bytesize] )
83
+ end
84
+
85
+ when :directory
86
+ trace " #{path}"
87
+ path.mkpath
88
+
89
+ when :link
90
+ linktarget = targetdir + header[:dest]
91
+ trace " #{path} => #{linktarget}"
92
+ path.make_link( linktarget.to_s )
93
+
94
+ when :symlink
95
+ linktarget = targetdir + header[:dest]
96
+ trace " #{path} -> #{linktarget}"
97
+ path.make_symlink( linktarget )
98
+ end
99
+ end
100
+
101
+ end
102
+
103
+
104
+ begin
105
+ require 'archive/tar'
106
+
107
+ namespace :win32 do
108
+ directory XCOMPILER_DIR.to_s
109
+
110
+ file XCOMPILER_DL => XCOMPILER_DIR do
111
+ # openuri can't handle this -- passive ftp required?
112
+ # run 'wget', '-O', XCOMPILER_DL, RUBY_DL_URI
113
+ log "Downloading ruby distro from %s" % [ RUBY_DL_URI ]
114
+ ftp = Net::FTP.new( RUBY_DL_URI.host )
115
+ ftp.login
116
+ ftp.getbinaryfile( RUBY_DL_URI.path, XCOMPILER_DL, 4096 )
117
+ ftp.close
118
+ end
119
+
120
+ directory XCOMPILER_SRC.to_s
121
+ task XCOMPILER_SRC => [ XCOMPILER_DIR, XCOMPILER_DL ] do
122
+ if XCOMPILER_SRC.exist?
123
+ trace "Rake fails. #{XCOMPILER_SRC} already exists."
124
+ else
125
+ untar( XCOMPILER_DL, XCOMPILER_DIR )
126
+ end
127
+ end
128
+
129
+ file XCOMPILER_RUBY => XCOMPILER_SRC do
130
+ Dir.chdir( XCOMPILER_SRC ) do
131
+ unless File.exist?( 'Makefile.in.orig' )
132
+ File.open( 'Makefile.in.new', IO::CREAT|IO::WRONLY|IO::EXCL ) do |ofh|
133
+ IO.readlines( 'Makefile.in' ).each do |line|
134
+ next if line.include?( 0.chr )
135
+ trace " copying line: %p" % [ line ]
136
+ line.sub!( /ALT_SEPARATOR = ".*?"/, "ALT_SEPARATOR = 92.chr" )
137
+ ofh.write( line )
138
+ end
139
+ end
140
+
141
+ mv 'Makefile.in', 'Makefile.in.orig'
142
+ mv 'Makefile.in.new', 'Makefile.in'
143
+ end
144
+
145
+ run *CONFIGURE_CMD
146
+ run 'make', 'ruby'
147
+ run 'make', 'rubyw.exe'
148
+ run 'make', 'install'
149
+ end
150
+ end
151
+
152
+ file XCOMPILER_LOAD_PATH => XCOMPILER_RUBY
153
+
154
+ desc "Cross-compile the library for Win32 systems, installing a cross-" +
155
+ "compiled Ruby if necessary"
156
+ task :build => [ EXTDIR, XCOMPILER_LOAD_PATH.to_s ] do
157
+ in_subdirectory( EXTDIR ) do
158
+ ruby "-I#{XCOMPILER_LOAD_PATH}", 'extconf.rb'
159
+ sh 'make'
160
+ end
161
+ end
162
+
163
+ desc "Build a binary gem for win32 systems"
164
+ task :gem => ['win32:build', PKGDIR.to_s] + WIN32_GEMSPEC.files do
165
+ when_writing( "Creating win32 GEM" ) do
166
+ pkgname = WIN32_GEMSPEC.file_name
167
+ builder = Gem::Builder.new( WIN32_GEMSPEC )
168
+ builder.build
169
+ mv pkgname, PKGDIR + pkgname, :verbose => $trace
170
+ end
171
+ end
172
+ end
173
+
174
+ rescue LoadError => err
175
+ trace "Couldn't load the win32 tasks: %s: %s" % [ err.class.name, err.message ]
176
+
177
+ task :no_win32_build do
178
+ abort "No win32 build: %s: %s" % [ err.class.name, err.message ]
179
+ end
180
+
181
+ namespace :win32 do
182
+ desc "Build a binary Gem for Win32 systems, installing a cross " +
183
+ "compiled Ruby if necessary"
184
+ task :gem => :no_win32_build
185
+ task :build => :no_win32_build
186
+ end
187
+
188
+ end
189
+
190
+
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent
7
+
8
+ libdir = basedir + 'lib'
9
+ extdir = basedir + 'ext'
10
+
11
+ $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
12
+ $LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
13
+ }
14
+
15
+ require 'spec'
16
+ require 'bluecloth'
17
+
18
+ require 'spec/lib/helpers'
19
+ require 'spec/lib/constants'
20
+ require 'spec/lib/matchers'
21
+
22
+
23
+ #####################################################################
24
+ ### C O N T E X T S
25
+ #####################################################################
26
+
27
+ describe BlueCloth, "1.0.1 changes" do
28
+ include BlueCloth::TestConstants,
29
+ BlueCloth::Matchers
30
+
31
+ it "doesn't touch escapes in code blocks" do
32
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
33
+ Markdown allows you to use backslash escapes to generate literal
34
+ characters which would otherwise have special meaning in Markdown's
35
+ formatting syntax. For example, if you wanted to surround a word with
36
+ literal asterisks (instead of an HTML `<em>` tag), you can backslashes
37
+ before the asterisks, like this:
38
+
39
+ \\*literal asterisks\\*
40
+
41
+ ---
42
+ <p>Markdown allows you to use backslash escapes to generate literal
43
+ characters which would otherwise have special meaning in Markdown's
44
+ formatting syntax. For example, if you wanted to surround a word with
45
+ literal asterisks (instead of an HTML <code>&lt;em&gt;</code> tag), you can backslashes
46
+ before the asterisks, like this:</p>
47
+
48
+ <pre><code>\\*literal asterisks\\*
49
+ </code></pre>
50
+ ---
51
+ end
52
+
53
+ it "shouldn't touched escapes in code spans" do
54
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
55
+ You can escape the splat operator by backslashing it like this: `/foo\\*/`.
56
+ ---
57
+ <p>You can escape the splat operator by backslashing it like this: <code>/foo\\*/</code>.</p>
58
+ ---
59
+ end
60
+
61
+
62
+ it "converts reference-style links at or deeper than tab width to code blocks" do
63
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
64
+ An [example][ex] reference-style link.
65
+
66
+ [ex]: http://www.bluefi.com/
67
+ ---
68
+ <p>An [example][ex] reference-style link.</p>
69
+
70
+ <pre><code>[ex]: http://www.bluefi.com/
71
+ </code></pre>
72
+ ---
73
+ end
74
+
75
+ it "fixes inline links using < and > URL delimiters, which weren't working" do
76
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
77
+ like [this](<http://example.com/>)
78
+ ---
79
+ <p>like <a href="http://example.com/">this</a></p>
80
+ ---
81
+ end
82
+
83
+ it "keeps HTML comment blocks as-is" do
84
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
85
+ <!-- This is a comment -->
86
+ ---
87
+ <!-- This is a comment -->
88
+ ---
89
+ end
90
+
91
+ it "doesn't auto-link inside code spans" do
92
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
93
+ like this: `<http://example.com/>`
94
+ ---
95
+ <p>like this: <code>&lt;http://example.com/&gt;</code></p>
96
+ ---
97
+ end
98
+
99
+
100
+ it "no longer creates a list when lines in the middle of hard-wrapped paragraphs look " +
101
+ "like the start of a list item" do
102
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
103
+ I recommend upgrading to version
104
+ 8. Oops, now this line is treated
105
+ as a sub-list.
106
+ ---
107
+ <p>I recommend upgrading to version
108
+ 8. Oops, now this line is treated
109
+ as a sub-list.</p>
110
+ ---
111
+ end
112
+
113
+
114
+ it "correctly marks up header + list + code" do
115
+ the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
116
+ ## This is a header.
117
+
118
+ 1. This is the first list item.
119
+ 2. This is the second list item.
120
+
121
+ Here's some example code:
122
+
123
+ return shell_exec("echo $input | $markdown_script");
124
+ ---
125
+ <h2>This is a header.</h2>
126
+
127
+ <ol>
128
+ <li>This is the first list item.</li>
129
+ <li>This is the second list item.</li>
130
+ </ol>
131
+
132
+ <p>Here's some example code:</p>
133
+
134
+ <pre><code>return shell_exec("echo $input | $markdown_script");
135
+ </code></pre>
136
+ ---
137
+ end
138
+
139
+ end
140
+
141
+