RedCloth 4.0.4-x86-mswin32-60 → 4.1.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of RedCloth might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,4 +1,17 @@
1
- *4.0.4 (October 1, 2008)*
1
+ === 4.1.0 / October 31, 2008
2
+
3
+ * JRuby support! [olabini]
4
+ To run the tests with JRuby, you only need to: jruby -S rake
5
+ To compile the jruby version of the gem: jruby -S rake compile
6
+
7
+ * Added textilize ERB utility method. [edraut]
8
+ Use it in an ERB template like this: <%=t my_textile_string %> or
9
+ <%=r %{Some *textile* if you please!} %>
10
+
11
+ * Fix extended blockcode stripping whitespace following blank line. #78
12
+
13
+
14
+ === 4.0.4 / October 1, 2008
2
15
 
3
16
  * Added some very basic support for images in LaTeX. [virtualfunction]
4
17
 
@@ -23,14 +36,14 @@
23
36
  * Fixed empty block HTML disappearing. #64
24
37
 
25
38
 
26
- *4.0.3 (August 18, 2008)*
39
+ === 4.0.3 / August 18, 2008
27
40
 
28
41
  * Fix NoMethodError: private method gsub!' called for nil:NilClass when two dimensions followed by a space. #38
29
42
 
30
43
  * Fixed unititialized constant RedCloth::TextileDoc with Rails 2.1. Came from a workaround for Rails bug #320 that was applied even when not necessary. #42
31
44
 
32
45
 
33
- *4.0.2 (August 15, 2008)*
46
+ === 4.0.2 / August 15, 2008
34
47
 
35
48
  * Fixed link references/aliases not being recognized when they include hyphens. #36
36
49
 
@@ -49,7 +62,7 @@
49
62
  * Fixed HTML block ending tags terminating blocks prematurely. #22
50
63
 
51
64
 
52
- *4.0.1 (July 24, 2008)*
65
+ === 4.0.1 / July 24, 2008
53
66
 
54
67
  * Fixed lines starting with dashes being recognized as a definition list when there were no definitions.
55
68
 
@@ -59,7 +72,7 @@
59
72
  * Fixed links including prior quoted phrases. #17
60
73
 
61
74
 
62
- *4.0.0 (July 21, 2008)*
75
+ === 4.0.0 / July 21, 2008
63
76
 
64
77
  * New SuperRedCloth (RedCloth 4.0) is a total rewrite using Ragel for the parsing.
65
78
 
@@ -0,0 +1,57 @@
1
+ bin/redcloth
2
+ CHANGELOG
3
+ COPYING
4
+ ext/mingw-rbconfig.rb
5
+ ext/redcloth_scan/extconf.rb
6
+ ext/redcloth_scan/redcloth.h
7
+ ext/redcloth_scan/redcloth_attributes.c.rl
8
+ ext/redcloth_scan/redcloth_attributes.java.rl
9
+ ext/redcloth_scan/redcloth_attributes.rl
10
+ ext/redcloth_scan/redcloth_common.c.rl
11
+ ext/redcloth_scan/redcloth_common.java.rl
12
+ ext/redcloth_scan/redcloth_common.rl
13
+ ext/redcloth_scan/redcloth_inline.c.rl
14
+ ext/redcloth_scan/redcloth_inline.java.rl
15
+ ext/redcloth_scan/redcloth_inline.rl
16
+ ext/redcloth_scan/redcloth_scan.c.rl
17
+ ext/redcloth_scan/redcloth_scan.java.rl
18
+ ext/redcloth_scan/redcloth_scan.rl
19
+ extras/ragel_profiler.rb
20
+ lib/case_sensitive_require/RedCloth.rb
21
+ lib/redcloth/erb_extension.rb
22
+ lib/redcloth/formatters/base.rb
23
+ lib/redcloth/formatters/html.rb
24
+ lib/redcloth/formatters/latex.rb
25
+ lib/redcloth/formatters/latex_entities.yml
26
+ lib/redcloth/textile_doc.rb
27
+ lib/redcloth/version.rb
28
+ lib/redcloth.rb
29
+ Manifest
30
+ Rakefile
31
+ README
32
+ RedCloth.gemspec
33
+ setup.rb
34
+ test/basic.yml
35
+ test/code.yml
36
+ test/definitions.yml
37
+ test/extra_whitespace.yml
38
+ test/filter_html.yml
39
+ test/filter_pba.yml
40
+ test/helper.rb
41
+ test/html.yml
42
+ test/images.yml
43
+ test/instiki.yml
44
+ test/links.yml
45
+ test/lists.yml
46
+ test/poignant.yml
47
+ test/sanitize_html.yml
48
+ test/table.yml
49
+ test/test_custom_tags.rb
50
+ test/test_erb.rb
51
+ test/test_extensions.rb
52
+ test/test_formatters.rb
53
+ test/test_parser.rb
54
+ test/test_restrictions.rb
55
+ test/textism.yml
56
+ test/threshold.yml
57
+ test/validate_fixtures.rb
data/Rakefile CHANGED
@@ -1,207 +1,138 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/gempackagetask'
4
- require 'rake/rdoctask'
5
- require 'rake/testtask'
6
- require 'fileutils'
7
- include FileUtils
8
1
  require 'lib/redcloth/version'
9
2
 
10
- NAME = RedCloth::NAME
11
- SUMMARY = RedCloth::DESCRIPTION
12
- VERS = RedCloth::VERSION::STRING
13
- CLEAN.include ['ext/redcloth_scan/*.{bundle,so,obj,pdb,lib,def,exp,c,o,xml}', 'ext/redcloth_scan/Makefile', '**/.*.sw?', '*.gem', '.config']
14
- CLOBBER.include ['lib/*.{bundle,so,obj,pdb,lib,def,exp}']
15
-
16
- desc "Does a full compile, test run"
17
- task :default => [:compile, :test]
18
-
19
- desc "Compiles all extensions"
20
- task :compile => [:redcloth_scan] do
21
- if Dir.glob(File.join("lib","redcloth_scan.*")).length == 0
22
- STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
23
- STDERR.puts "Gem actually failed to build. Your system is"
24
- STDERR.puts "NOT configured properly to build redcloth."
25
- STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
26
- exit(1)
3
+ begin
4
+ require 'rubygems'
5
+ gem 'echoe', '>=2.7.11'
6
+ require 'echoe'
7
+ rescue LoadError
8
+ abort "You'll need to have `echoe' installed to use RedCloth's Rakefile"
9
+ end
10
+
11
+ e = Echoe.new('RedCloth', RedCloth::VERSION.to_s) do |p|
12
+ p.summary = RedCloth::DESCRIPTION
13
+ p.author = "Jason Garber"
14
+ p.email = 'redcloth-upwards@rubyforge.org'
15
+ p.clean_pattern += ['ext/redcloth_scan/**/*.{bundle,so,obj,pdb,lib,def,exp,c,o,xml,class,jar,java}', 'lib/*.{bundle,so,o,obj,pdb,lib,def,exp,jar}', 'ext/redcloth_scan/Makefile']
16
+ p.url = "http://redcloth.org"
17
+ p.project = "redcloth"
18
+ p.rdoc_pattern = ['README', 'COPING', 'CHANGELOG', 'lib/**/*.rb', 'doc/**/*.rdoc']
19
+ p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
20
+ p.ruby_version = '>=1.8.4'
21
+ p.extension_pattern = nil
22
+
23
+ if Platform.gcc?
24
+ p.platform = 'x86-mswin32-60'
25
+ elsif Platform.java?
26
+ p.platform = 'universal-java'
27
+ end
28
+
29
+ if RUBY_PLATFORM =~ /mingw|mswin|java/
30
+ p.need_tar_gz = false
31
+ else
32
+ p.need_zip = true
33
+ p.need_tar_gz = true
34
+ p.extension_pattern = ["ext/**/extconf.rb"]
27
35
  end
28
- end
29
-
30
- desc "Packages up RedCloth."
31
- task :package => [:clean, :compile]
32
-
33
- desc "Releases packages for all RedCloth packages and platforms."
34
- task :release => [:package, :rubygems_win32]
35
-
36
- desc "Run all the tests"
37
- Rake::TestTask.new do |t|
38
- t.libs << "test"
39
- t.test_files = FileList['test/test_*.rb']
40
- t.verbose = true
41
- end
42
36
 
43
- # Run specific tests or test files
44
- #
45
- # rake test:parser
46
- # => Runs the full TestParser unit test
47
- #
48
- # rake test:parser:textism
49
- # => Runs the tests matching /textism/ in the TestParser unit test
50
- rule "" do |t|
51
- # test:file:method
52
- if /test:(.*)(:([^.]+))?$/.match(t.name)
53
- arguments = t.name.split(":")[1..-1]
54
- file_name = arguments.first
55
- test_name = arguments[1..-1]
56
-
57
- if File.exist?("test/test_#{file_name}.rb")
58
- run_file_name = "test_#{file_name}.rb"
37
+ p.eval = proc do
38
+ case RUBY_PLATFORM
39
+ when /mingw/
40
+ self.files += ['lib/redcloth_scan.so']
41
+ when /java/
42
+ self.files += ['lib/redcloth_scan.jar']
43
+ else
44
+ self.files += %w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"}
59
45
  end
60
-
61
- sh "ruby -Ilib:test test/#{run_file_name} -n /#{test_name}/"
62
46
  end
63
- end
64
47
 
65
- Rake::RDocTask.new do |rdoc|
66
- rdoc.rdoc_dir = 'doc/rdoc'
67
- # rdoc.options += RDOC_OPTS
68
- # rdoc.template = "extras/flipbook_rdoc.rb"
69
- rdoc.main = "README"
70
- rdoc.title = "RedCloth Documentation"
71
- rdoc.rdoc_files.add ['README', 'CHANGELOG', 'COPYING', 'lib/**/*.rb', 'ext/**/*.c']
72
48
  end
73
49
 
74
- PKG_FILES = %w(CHANGELOG COPYING README Rakefile) +
75
- Dir.glob("{bin,doc,test,lib,extras}/**/*") +
76
- Dir.glob("ext/**/*.{h,c,rb,rl}") +
77
- %w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"}
78
-
79
- spec =
80
- Gem::Specification.new do |s|
81
- s.name = NAME
82
- s.version = VERS
83
- s.platform = Gem::Platform::RUBY
84
- s.has_rdoc = true
85
- s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
86
- s.summary = SUMMARY
87
- s.description = s.summary
88
- s.author = "Jason Garber"
89
- s.email = 'redcloth-upwards@rubyforge.org'
90
- s.homepage = 'http://redcloth.org/'
91
- s.rubyforge_project = 'redcloth'
92
-
93
- s.files = PKG_FILES
94
-
95
- s.require_paths << "lib/case_sensitive_require"
96
- #s.autorequire = "redcloth" # no no no this is tHe 3v1l
97
- s.extensions = FileList["ext/**/extconf.rb"].to_a
98
- s.executables = ["redcloth"]
99
- end
50
+ #### Pre-compiled extensions for alternative platforms
100
51
 
101
- Rake::GemPackageTask.new(spec) do |p|
102
- p.need_tar = true
103
- p.gem_spec = spec
52
+ def move_extensions
53
+ Dir["ext/**/*.{bundle,so,jar}"].each { |file| mv file, "lib/" }
104
54
  end
105
55
 
106
- extension = "redcloth_scan"
107
- ext = "ext/redcloth_scan"
108
- ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
109
- ext_files = FileList[
110
- "#{ext}/redcloth_scan.c",
111
- "#{ext}/redcloth_inline.c",
112
- "#{ext}/redcloth_attributes.c",
113
- "#{ext}/extconf.rb",
114
- "#{ext}/Makefile",
115
- "lib"
116
- ]
117
-
118
- file ext_so => ext_files do
119
- Dir.chdir(ext) do
120
- sh(RUBY_PLATFORM =~ /win32/ ? 'nmake' : 'make')
56
+ def java_classpath_arg
57
+ # A myriad of ways to discover the JRuby classpath
58
+ classpath = begin
59
+ require 'java'
60
+ # Already running in a JRuby JVM
61
+ Java::java.lang.System.getProperty('java.class.path')
62
+ rescue LoadError
63
+ ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
121
64
  end
122
- cp ext_so, "lib"
65
+ classpath ? "-cp #{classpath}" : ""
123
66
  end
124
67
 
125
- task "lib" do
126
- directory "lib"
127
- end
68
+ ext = "ext/redcloth_scan"
128
69
 
129
- ["#{ext}/redcloth_scan.c","#{ext}/redcloth_inline.c","#{ext}/redcloth_attributes.c"].each do |name|
130
- @code_style ||= "T0"
131
- source = name.sub(/\.c$/, '.rl')
132
- file name => [source, "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
133
- @ragel_v ||= `ragel -v`[/(version )(\S*)/,2].split('.').map{|s| s.to_i}
134
- if @ragel_v[0] > 6 || (@ragel_v[0] == 6 && @ragel_v[1] >= 3)
135
- sh %{ragel #{source} -#{@code_style} -o #{name}}
136
- else
137
- STDERR.puts "Ragel 6.3 or greater is required to generate #{name}."
138
- exit(1)
70
+ case RUBY_PLATFORM
71
+ when /mingw/
72
+
73
+ filename = "lib/redcloth_scan.so"
74
+ file filename => FileList["#{ext}/redcloth_scan.c", "#{ext}/redcloth_inline.c", "#{ext}/redcloth_attributes.c"] do
75
+ cp "ext/mingw-rbconfig.rb", "#{ext}/rbconfig.rb"
76
+ Dir.chdir("ext/redcloth_scan") do
77
+ ruby "-I. extconf.rb"
78
+ system(PLATFORM =~ /mswin/ ? 'nmake' : 'make')
139
79
  end
80
+ move_extensions
81
+ rm "#{ext}/rbconfig.rb"
140
82
  end
141
- end
142
-
143
- desc "Builds just the #{extension} extension"
144
- task extension.to_sym => ["#{ext}/Makefile", ext_so ]
145
83
 
146
- file "#{ext}/Makefile" => ["#{ext}/extconf.rb", "#{ext}/redcloth_scan.c","#{ext}/redcloth_inline.c","#{ext}/redcloth_attributes.c"] do
147
- Dir.chdir(ext) do ruby "extconf.rb" end
148
- end
84
+ when /java/
149
85
 
150
- Win32Spec = Gem::Specification.new do |s|
151
- s.name = NAME
152
- s.version = VERS
153
- s.platform = 'x86-mswin32-60'
154
- s.has_rdoc = false
155
- s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
156
- s.summary = SUMMARY
157
- s.description = s.summary
158
- s.author = "Jason Garber"
159
- s.email = 'redcloth-upwards@rubyforge.org'
160
- s.homepage = 'http://redcloth.org/'
161
- s.rubyforge_project = 'redcloth'
162
-
163
- s.files = PKG_FILES + ["lib/redcloth_scan.so"]
164
-
165
- s.require_path = "lib"
166
- #s.autorequire = "redcloth" # no no no this is tHe 3v1l
167
- s.extensions = []
168
- s.bindir = "bin"
169
- end
86
+ filename = "lib/redcloth_scan.jar"
87
+ file filename => FileList["#{ext}/RedclothScanService.java", "#{ext}/RedclothInline.java", "#{ext}/RedclothAttributes.java"] do
88
+ sources = FileList["#{ext}/**/*.java"].join(' ')
89
+ sh "javac -target 1.5 -source 1.5 -d #{ext} #{java_classpath_arg} #{sources}"
90
+ sh "jar cf lib/redcloth_scan.jar -C #{ext} ."
91
+ move_extensions
92
+ end
170
93
 
171
- WIN32_PKG_DIR = "pkg/#{NAME}-#{VERS}-mswin32"
172
-
173
- file WIN32_PKG_DIR => [:package] do
174
- cp_r "pkg/#{NAME}-#{VERS}", "#{WIN32_PKG_DIR}"
94
+ else
95
+ filename = "#{ext}/redcloth_scan.#{Config::CONFIG['DLEXT']}"
96
+ file filename => FileList["#{ext}/redcloth_scan.c", "#{ext}/redcloth_inline.c", "#{ext}/redcloth_attributes.c"]
175
97
  end
176
98
 
177
- desc "Cross-compile the redcloth_scan extension for win32"
178
- file "redcloth_scan_win32" => [WIN32_PKG_DIR] do
179
- cp "extras/mingw-rbconfig.rb", "#{WIN32_PKG_DIR}/ext/redcloth_scan/rbconfig.rb"
180
- sh "cd #{WIN32_PKG_DIR}/ext/redcloth_scan/ && ruby -I. extconf.rb && make"
181
- mv "#{WIN32_PKG_DIR}/ext/redcloth_scan/redcloth_scan.so", "#{WIN32_PKG_DIR}/lib"
182
- end
99
+ task :compile => [filename]
183
100
 
184
- desc "Build the binary RubyGems package for win32"
185
- task :rubygems_win32 => ["redcloth_scan_win32"] do
186
- Dir.chdir("#{WIN32_PKG_DIR}") do
187
- Gem::Builder.new(Win32Spec).build
188
- verbose(true) {
189
- cp Dir["*.gem"].first, "../"
190
- }
101
+ def ragel(target_file, source_file)
102
+ host_language = (target_file =~ /java$/) ? "J" : "C"
103
+ code_style = (host_language == "C") ? " -" + (@code_style || "T0") : ""
104
+ ensure_ragel_version(target_file) do
105
+ sh %{ragel #{source_file} -#{host_language}#{code_style} -o #{target_file}}
191
106
  end
192
107
  end
193
108
 
194
- CLEAN.include WIN32_PKG_DIR
109
+ # Make sure the .c files exist if you try the Makefile, otherwise Ragel will have to generate them.
110
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb", "#{ext}/redcloth_scan.c","#{ext}/redcloth_inline.c","#{ext}/redcloth_attributes.c","#{ext}/redcloth_scan.o","#{ext}/redcloth_inline.o","#{ext}/redcloth_attributes.o"]
195
111
 
196
- desc "Build and install the RedCloth gem on your system"
197
- task :install => [:package] do
198
- sh %{sudo gem install pkg/#{NAME}-#{VERS}}
112
+ # Ragel-generated C files
113
+ file "#{ext}/redcloth_scan.c" => ["#{ext}/redcloth_scan.c.rl", "#{ext}/redcloth_scan.rl", "#{ext}/redcloth_common.c.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
114
+ ragel "#{ext}/redcloth_scan.c", "#{ext}/redcloth_scan.c.rl"
115
+ end
116
+ file "#{ext}/redcloth_inline.c" => ["#{ext}/redcloth_inline.c.rl", "#{ext}/redcloth_inline.rl", "#{ext}/redcloth_common.c.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
117
+ ragel "#{ext}/redcloth_inline.c", "#{ext}/redcloth_inline.c.rl"
118
+ end
119
+ file "#{ext}/redcloth_attributes.c" => ["#{ext}/redcloth_attributes.c.rl", "#{ext}/redcloth_attributes.rl", "#{ext}/redcloth_common.c.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
120
+ ragel "#{ext}/redcloth_attributes.c", "#{ext}/redcloth_attributes.c.rl"
199
121
  end
200
122
 
201
- desc "Uninstall the RedCloth gem from your system"
202
- task :uninstall => [:clean] do
203
- sh %{sudo gem uninstall #{NAME}}
123
+ # Ragel-generated Java files
124
+ file "#{ext}/RedclothScanService.java" => ["#{ext}/redcloth_scan.java.rl", "#{ext}/redcloth_scan.rl", "#{ext}/redcloth_common.java.rl", "#{ext}/redcloth_common.rl"] do
125
+ ragel "#{ext}/RedclothScanService.java", "#{ext}/redcloth_scan.java.rl"
204
126
  end
127
+ file "#{ext}/RedclothInline.java" => ["#{ext}/redcloth_inline.java.rl", "#{ext}/redcloth_inline.rl", "#{ext}/redcloth_common.java.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth_scan.java.rl"] do
128
+ ragel "#{ext}/RedclothInline.java", "#{ext}/redcloth_inline.java.rl"
129
+ end
130
+ file "#{ext}/RedclothAttributes.java" => ["#{ext}/redcloth_attributes.java.rl", "#{ext}/redcloth_attributes.rl", "#{ext}/redcloth_common.java.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth_scan.java.rl"] do
131
+ ragel "#{ext}/RedclothAttributes.java", "#{ext}/redcloth_attributes.java.rl"
132
+ end
133
+
134
+
135
+ #### Optimization
205
136
 
206
137
  RAGEL_CODE_GENERATION_STYLES = {
207
138
  'T0' => "Table driven FSM (default)",
@@ -238,3 +169,40 @@ task :optimize do
238
169
  end
239
170
  puts RagelProfiler.results
240
171
  end
172
+
173
+
174
+ #### Custom testing tasks
175
+
176
+ task :test => [:compile]
177
+
178
+ # Run specific tests or test files
179
+ #
180
+ # rake test:parser
181
+ # => Runs the full TestParser unit test
182
+ #
183
+ # rake test:parser:textism
184
+ # => Runs the tests matching /textism/ in the TestParser unit test
185
+ rule "" do |t|
186
+ # test:file:method
187
+ if /test:(.*)(:([^.]+))?$/.match(t.name)
188
+ arguments = t.name.split(":")[1..-1]
189
+ file_name = arguments.first
190
+ test_name = arguments[1..-1]
191
+
192
+ if File.exist?("test/test_#{file_name}.rb")
193
+ run_file_name = "test_#{file_name}.rb"
194
+ end
195
+
196
+ sh "ruby -Ilib:test test/#{run_file_name} -n /#{test_name}/"
197
+ end
198
+ end
199
+
200
+ def ensure_ragel_version(name)
201
+ @ragel_v ||= `ragel -v`[/(version )(\S*)/,2].split('.').map{|s| s.to_i}
202
+ if @ragel_v[0] > 6 || (@ragel_v[0] == 6 && @ragel_v[1] >= 3)
203
+ yield
204
+ else
205
+ STDERR.puts "Ragel 6.3 or greater is required to generate #{name}."
206
+ exit(1)
207
+ end
208
+ end