RedCloth 4.1.9 → 4.2.0

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.

Files changed (70) hide show
  1. data/CHANGELOG +55 -0
  2. data/Manifest +34 -38
  3. data/README +17 -5
  4. data/Rakefile +79 -30
  5. data/RedCloth.gemspec +5 -6
  6. data/ext/redcloth_scan/redcloth.h +38 -13
  7. data/ext/redcloth_scan/redcloth_attributes.c +349 -383
  8. data/ext/redcloth_scan/redcloth_inline.c +4769 -16591
  9. data/ext/redcloth_scan/redcloth_scan.c +21592 -9540
  10. data/lib/redcloth.rb +9 -3
  11. data/lib/redcloth/formatters/html.rb +2 -2
  12. data/lib/redcloth/formatters/latex.rb +99 -54
  13. data/lib/redcloth/formatters/latex_entities.yml +2 -2
  14. data/lib/redcloth/version.rb +9 -4
  15. data/lib/tasks/pureruby.rake +12 -0
  16. data/spec/custom_tags_spec.rb +50 -0
  17. data/spec/differs/inline.rb +48 -0
  18. data/{test/test_erb.rb → spec/erb_spec.rb} +6 -9
  19. data/spec/extension_spec.rb +26 -0
  20. data/{test → spec/fixtures}/basic.yml +90 -4
  21. data/{test → spec/fixtures}/code.yml +29 -0
  22. data/{test → spec/fixtures}/definitions.yml +0 -0
  23. data/{test → spec/fixtures}/extra_whitespace.yml +0 -0
  24. data/{test → spec/fixtures}/filter_html.yml +0 -0
  25. data/{test → spec/fixtures}/filter_pba.yml +0 -0
  26. data/{test → spec/fixtures}/html.yml +15 -0
  27. data/{test → spec/fixtures}/images.yml +16 -6
  28. data/{test → spec/fixtures}/instiki.yml +0 -0
  29. data/{test → spec/fixtures}/links.yml +7 -1
  30. data/{test → spec/fixtures}/lists.yml +162 -1
  31. data/{test → spec/fixtures}/poignant.yml +0 -0
  32. data/{test → spec/fixtures}/sanitize_html.yml +0 -0
  33. data/{test → spec/fixtures}/table.yml +121 -23
  34. data/{test → spec/fixtures}/textism.yml +44 -15
  35. data/{test → spec/fixtures}/threshold.yml +6 -14
  36. data/spec/formatters/class_filtered_html_spec.rb +7 -0
  37. data/spec/formatters/filtered_html_spec.rb +7 -0
  38. data/spec/formatters/html_no_breaks_spec.rb +9 -0
  39. data/spec/formatters/html_spec.rb +13 -0
  40. data/spec/formatters/id_filtered_html_spec.rb +7 -0
  41. data/spec/formatters/latex_spec.rb +13 -0
  42. data/spec/formatters/lite_mode_html_spec.rb +7 -0
  43. data/spec/formatters/no_span_caps_html_spec.rb +7 -0
  44. data/spec/formatters/sanitized_html_spec.rb +7 -0
  45. data/spec/formatters/style_filtered_html_spec.rb +7 -0
  46. data/spec/parser_spec.rb +95 -0
  47. data/spec/spec.opts +3 -0
  48. data/spec/spec_helper.rb +42 -0
  49. metadata +40 -49
  50. data/ext/mingw-rbconfig.rb +0 -176
  51. data/ext/redcloth_scan/redcloth_attributes.c.rl +0 -55
  52. data/ext/redcloth_scan/redcloth_attributes.java.rl +0 -95
  53. data/ext/redcloth_scan/redcloth_attributes.rl +0 -33
  54. data/ext/redcloth_scan/redcloth_common.c.rl +0 -18
  55. data/ext/redcloth_scan/redcloth_common.java.rl +0 -18
  56. data/ext/redcloth_scan/redcloth_common.rl +0 -115
  57. data/ext/redcloth_scan/redcloth_inline.c.rl +0 -193
  58. data/ext/redcloth_scan/redcloth_inline.java.rl +0 -140
  59. data/ext/redcloth_scan/redcloth_inline.rl +0 -156
  60. data/ext/redcloth_scan/redcloth_scan.c.rl +0 -228
  61. data/ext/redcloth_scan/redcloth_scan.java.rl +0 -577
  62. data/ext/redcloth_scan/redcloth_scan.rl +0 -320
  63. data/extras/ragel_profiler.rb +0 -73
  64. data/test/helper.rb +0 -108
  65. data/test/test_custom_tags.rb +0 -58
  66. data/test/test_extensions.rb +0 -31
  67. data/test/test_formatters.rb +0 -24
  68. data/test/test_parser.rb +0 -73
  69. data/test/test_restrictions.rb +0 -41
  70. data/test/validate_fixtures.rb +0 -74
data/CHANGELOG CHANGED
@@ -1,3 +1,58 @@
1
+ === Edge
2
+
3
+ * Fixed image with title, href, and text afterward not being made a link. [Jason Garber]
4
+
5
+ * Pass string encoding through in Ruby 1.9. [Jason Garber]
6
+
7
+ * Allow two-letter acronyms. [Jason Garber]
8
+
9
+ * Removed vertical alignment in lists. It doesn't make sense and it conflicts with other things. [Jason Garber]
10
+
11
+ * Allow table cells to be empty. [Jason Garber]
12
+
13
+ * Resolve conflict between table signature and blocks beginning with t. [Jason Garber]
14
+
15
+ * Enable code signature to capture trailing space when in square brackets. [Jason Garber]
16
+
17
+ * Allow emphasized phrases to include underscores. [Jason Garber]
18
+
19
+ * Include an ending question mark in a citation. [Jason Garber]
20
+
21
+ * Fix <notextile> blocks being included in following paragraph. [Jason Garber]
22
+
23
+ * Preserve leading whitespace in pre and bc blocks. [Jason Garber]
24
+
25
+ * Don't add hard break after preexisting <br />. [Jason Garber]
26
+
27
+ * Switched tests from Test::Unit to Rspec. [Jason Garber]
28
+
29
+ * Accept multiline content in table cells. [Jason Garber]
30
+
31
+ * Change to list attributes so you can give style/class to list items (taken from PyTextile). Breaks backwards compatibility.
32
+
33
+ Before, the style applied to the first list item applied to the entire list. Now, class/id/style placed
34
+ before the list applies to the list element and after the hash or asterisk applies to the list item. For
35
+ example:
36
+ <ul id="groceries">
37
+ (#groceries)# Milk <li>milk</li>
38
+ # Eggs <li>eggs</li>
39
+ #(optional) granola <li class="optional">granola</li>
40
+ </ul>
41
+
42
+ * Separated attributes out to have their own mark/store variable and regs. This way, they won't conflict with captured text or backtracked text. [Jason Garber]
43
+
44
+ * Added a RedCloth::EXTENSION_LANGUAGE constant so you can tell what version of the parser you are using. [Jason Garber]
45
+
46
+ * Added a NotCompiledError to give a friendlier message when people just unpack RedCloth into their projects. [Jason Garber]
47
+
48
+ * Added a pure-ruby version of the parser for times when you can't compile the C or Java extensions. You should avoid using it if at all possible because it is 32 times slower (and has some other problems, too)! [Jason Garber]
49
+
50
+ * Ignore spaces and tabs on blank lines between blocks. #120 [Jason Garber]
51
+
52
+ * Allow HTML tags with quoted attributes to be inside link text. To do this, I had to remove the possibility that attributes in HTML tags could have spaces around the equals sign or unquoted attributes. This change also greatly expands the complexity of the state machine, so compilation takes a long time. Sorry. [Jason Garber]
53
+
54
+ * Many improvements to the LaTeX formatter by Bil Kleb, a NASA scientist who's been working with LaTeX for 20 years. Thanks, Bil!
55
+
1
56
  === 4.1.9 / February 20, 2009
2
57
 
3
58
  * Make compatible with Ruby 1.9.
data/Manifest CHANGED
@@ -1,22 +1,8 @@
1
1
  bin/redcloth
2
2
  CHANGELOG
3
3
  COPYING
4
- ext/mingw-rbconfig.rb
5
4
  ext/redcloth_scan/extconf.rb
6
5
  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
6
  lib/case_sensitive_require/RedCloth.rb
21
7
  lib/redcloth/erb_extension.rb
22
8
  lib/redcloth/formatters/base.rb
@@ -26,31 +12,41 @@ lib/redcloth/formatters/latex_entities.yml
26
12
  lib/redcloth/textile_doc.rb
27
13
  lib/redcloth/version.rb
28
14
  lib/redcloth.rb
15
+ lib/tasks/pureruby.rake
29
16
  Manifest
30
17
  Rakefile
31
18
  README
32
19
  setup.rb
33
- test/basic.yml
34
- test/code.yml
35
- test/definitions.yml
36
- test/extra_whitespace.yml
37
- test/filter_html.yml
38
- test/filter_pba.yml
39
- test/helper.rb
40
- test/html.yml
41
- test/images.yml
42
- test/instiki.yml
43
- test/links.yml
44
- test/lists.yml
45
- test/poignant.yml
46
- test/sanitize_html.yml
47
- test/table.yml
48
- test/test_custom_tags.rb
49
- test/test_erb.rb
50
- test/test_extensions.rb
51
- test/test_formatters.rb
52
- test/test_parser.rb
53
- test/test_restrictions.rb
54
- test/textism.yml
55
- test/threshold.yml
56
- test/validate_fixtures.rb
20
+ spec/custom_tags_spec.rb
21
+ spec/differs/inline.rb
22
+ spec/erb_spec.rb
23
+ spec/extension_spec.rb
24
+ spec/fixtures/basic.yml
25
+ spec/fixtures/code.yml
26
+ spec/fixtures/definitions.yml
27
+ spec/fixtures/extra_whitespace.yml
28
+ spec/fixtures/filter_html.yml
29
+ spec/fixtures/filter_pba.yml
30
+ spec/fixtures/html.yml
31
+ spec/fixtures/images.yml
32
+ spec/fixtures/instiki.yml
33
+ spec/fixtures/links.yml
34
+ spec/fixtures/lists.yml
35
+ spec/fixtures/poignant.yml
36
+ spec/fixtures/sanitize_html.yml
37
+ spec/fixtures/table.yml
38
+ spec/fixtures/textism.yml
39
+ spec/fixtures/threshold.yml
40
+ spec/formatters/class_filtered_html_spec.rb
41
+ spec/formatters/filtered_html_spec.rb
42
+ spec/formatters/html_no_breaks_spec.rb
43
+ spec/formatters/html_spec.rb
44
+ spec/formatters/id_filtered_html_spec.rb
45
+ spec/formatters/latex_spec.rb
46
+ spec/formatters/lite_mode_html_spec.rb
47
+ spec/formatters/no_span_caps_html_spec.rb
48
+ spec/formatters/sanitized_html_spec.rb
49
+ spec/formatters/style_filtered_html_spec.rb
50
+ spec/parser_spec.rb
51
+ spec/spec.opts
52
+ spec/spec_helper.rb
data/README CHANGED
@@ -17,16 +17,28 @@ RedCloth can be installed via RubyGems:
17
17
 
18
18
  gem install RedCloth
19
19
 
20
- It will install the appropriate Ruby, JRuby, or Win32 gem. If using JRuby, version 1.1.5 or greater is required.
20
+ It will install the appropriate Ruby, JRuby, or Win32 gem. If using JRuby,
21
+ version 1.1.5 or greater is required.
21
22
 
22
23
  == Compiling
23
24
 
24
- If you just want to use RedCloth, you do NOT need to build/compile it. It is compiled from C sources automatically when you install the gem on the ruby platform. Binary gems are provided for JRuby and Win32 platforms.
25
+ If you just want to use RedCloth, you do NOT need to build/compile it. It is
26
+ compiled from C sources automatically when you install the gem on the ruby
27
+ platform. Precompiled binary gems are provided for JRuby and Win32 platforms.
25
28
 
26
- RedCloth can be compiled with <tt>rake compile</tt>. Ragel 6.3 or greater and the
27
- echoe gem are needed to build, compile, and package RedCloth. Again, Ragel and echoe are NOT needed to simply use RedCloth.
29
+ RedCloth can be compiled with <tt>rake compile</tt>. Ragel 6.3 or greater and
30
+ the echoe gem are needed to build, compile, and package RedCloth. Again, Ragel
31
+ and echoe are NOT needed to simply use RedCloth.
28
32
 
29
- You can cross-compile for JRuby with rake java compile and for Win32 with rake mingw compile.
33
+ === Supported platforms
34
+
35
+ By default, the rake compile task builds a native C Ruby extension that works
36
+ with Ruby 1.8 or 1.9. You can cross-compile for JRuby 1.3 with rake java
37
+ compile and for Win32 with rake mingw compile. A pure Ruby version can be
38
+ generated with rake pureruby compile, but the parser it produces is slow and
39
+ incompatible with Ruby 1.9. The JRuby and pure-Ruby extensions don't support
40
+ multi-byte characters. The RedCloth::EXTENSION_LANGUAGE constant indicates in
41
+ which language your copy of RedCloth is compiled.
30
42
 
31
43
  == Using RedCloth
32
44
 
data/Rakefile CHANGED
@@ -2,12 +2,13 @@ require 'lib/redcloth/version'
2
2
  require 'rubygems'
3
3
  gem 'echoe', '>= 3.0.1'
4
4
  require 'echoe'
5
+ Dir["#{File.dirname(__FILE__)}/lib/tasks/*.rake"].sort.each { |ext| load(ext) }
5
6
 
6
7
  e = Echoe.new('RedCloth', RedCloth::VERSION.to_s) do |p|
7
8
  p.summary = RedCloth::DESCRIPTION
8
9
  p.author = "Jason Garber"
9
10
  p.email = 'redcloth-upwards@rubyforge.org'
10
- 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']
11
+ 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/**/redcloth_*.rb', 'lib/redcloth_scan.rb', 'ext/redcloth_scan/Makefile']
11
12
  p.url = "http://redcloth.org"
12
13
  p.project = "redcloth"
13
14
  p.rdoc_pattern = ['README', 'COPING', 'CHANGELOG', 'lib/**/*.rb', 'doc/**/*.rdoc']
@@ -20,10 +21,14 @@ e = Echoe.new('RedCloth', RedCloth::VERSION.to_s) do |p|
20
21
  p.platform = 'x86-mswin32-60'
21
22
  elsif Platform.java?
22
23
  p.platform = 'universal-java'
24
+ elsif RUBY_PLATFORM == 'pureruby'
25
+ p.platform = 'ruby'
23
26
  end
24
27
 
25
28
  if RUBY_PLATFORM =~ /mingw|mswin|java/
26
29
  p.need_tar_gz = false
30
+ elsif RUBY_PLATFORM == 'pureruby'
31
+ p.need_gem = false
27
32
  else
28
33
  p.need_zip = true
29
34
  p.need_tar_gz = true
@@ -36,6 +41,8 @@ e = Echoe.new('RedCloth', RedCloth::VERSION.to_s) do |p|
36
41
  self.files += ['lib/redcloth_scan.so']
37
42
  when /java/
38
43
  self.files += ['lib/redcloth_scan.jar']
44
+ when 'pureruby'
45
+ self.files += ['lib/redcloth_scan.rb']
39
46
  else
40
47
  self.files += %w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"}
41
48
  end
@@ -45,8 +52,6 @@ e = Echoe.new('RedCloth', RedCloth::VERSION.to_s) do |p|
45
52
 
46
53
  end
47
54
 
48
- #### Pre-compiled extensions for alternative platforms
49
-
50
55
  def move_extensions
51
56
  Dir["ext/**/*.{bundle,so,jar}"].each { |file| mv file, "lib/" }
52
57
  end
@@ -89,16 +94,39 @@ when /java/
89
94
  move_extensions
90
95
  end
91
96
 
97
+ when /pureruby/
98
+ filename = "lib/redcloth_scan.rb"
99
+ file filename => FileList["#{ext}/redcloth_scan.rb", "#{ext}/redcloth_inline.rb", "#{ext}/redcloth_attributes.rb"] do |task|
100
+
101
+ sources = task.prerequisites.join(' ')
102
+ sh "cat #{sources} > #{filename}"
103
+ end
104
+
92
105
  else
93
106
  filename = "#{ext}/redcloth_scan.#{Config::CONFIG['DLEXT']}"
94
107
  file filename => FileList["#{ext}/redcloth_scan.c", "#{ext}/redcloth_inline.c", "#{ext}/redcloth_attributes.c"]
95
108
  end
96
109
 
97
- task :compile => [filename]
110
+ task :compile => [:remove_other_platforms, filename]
98
111
 
99
112
  def ragel(target_file, source_file)
100
- host_language = (target_file =~ /java$/) ? "J" : "C"
101
- code_style = (host_language == "C") ? " -" + (@code_style || "T0") : ""
113
+ host_language = case target_file
114
+ when /java$/
115
+ "J"
116
+ when /rb$/
117
+ "R"
118
+ else
119
+ "C"
120
+ end
121
+ preferred_code_style = case host_language
122
+ when "R"
123
+ "F1"
124
+ when "C"
125
+ "T0"
126
+ else
127
+ nil
128
+ end
129
+ code_style = preferred_code_style ? " -" + (@code_style || preferred_code_style) : ""
102
130
  ensure_ragel_version(target_file) do
103
131
  sh %{ragel #{source_file} -#{host_language}#{code_style} -o #{target_file}}
104
132
  end
@@ -129,23 +157,39 @@ file "#{ext}/RedclothAttributes.java" => ["#{ext}/redcloth_attributes.java.rl",
129
157
  ragel "#{ext}/RedclothAttributes.java", "#{ext}/redcloth_attributes.java.rl"
130
158
  end
131
159
 
160
+ # Ragel-generated pureruby files
161
+ file "#{ext}/redcloth_scan.rb" => ["#{ext}/redcloth_scan.rb.rl", "#{ext}/redcloth_scan.rl", "#{ext}/redcloth_common.rb.rl", "#{ext}/redcloth_common.rl"] do
162
+ ragel "#{ext}/redcloth_scan.rb", "#{ext}/redcloth_scan.rb.rl"
163
+ end
164
+ file "#{ext}/redcloth_inline.rb" => ["#{ext}/redcloth_inline.rb.rl", "#{ext}/redcloth_inline.rl", "#{ext}/redcloth_common.rb.rl", "#{ext}/redcloth_common.rl"] do
165
+ ragel "#{ext}/redcloth_inline.rb", "#{ext}/redcloth_inline.rb.rl"
166
+ end
167
+ file "#{ext}/redcloth_attributes.rb" => ["#{ext}/redcloth_attributes.rb.rl", "#{ext}/redcloth_attributes.rl", "#{ext}/redcloth_common.rb.rl", "#{ext}/redcloth_common.rl"] do
168
+ ragel "#{ext}/redcloth_attributes.rb", "#{ext}/redcloth_attributes.rb.rl"
169
+ end
170
+
132
171
 
133
172
  #### Optimization
134
173
 
174
+ # C/Ruby code styles
135
175
  RAGEL_CODE_GENERATION_STYLES = {
136
176
  'T0' => "Table driven FSM (default)",
137
177
  'T1' => "Faster table driven FSM",
138
178
  'F0' => "Flat table driven FSM",
139
- 'F1' => "Faster flat table-driven FSM",
179
+ 'F1' => "Faster flat table-driven FSM"
180
+ }
181
+ # C only code styles
182
+ RAGEL_CODE_GENERATION_STYLES.merge!({
140
183
  'G0' => "Goto-driven FSM",
141
184
  'G1' => "Faster goto-driven FSM",
142
185
  'G2' => "Really fast goto-driven FSM"
143
- }
186
+ }) if RUBY_PLATFORM !~ /pureruby/
144
187
 
145
188
  desc "Find the fastest code generation style for Ragel"
146
189
  task :optimize do
147
- require 'extras/ragel_profiler'
190
+ require 'test/ragel_profiler'
148
191
  results = []
192
+
149
193
  RAGEL_CODE_GENERATION_STYLES.each do |style, name|
150
194
  @code_style = style
151
195
  profiler = RagelProfiler.new(style + " " + name)
@@ -162,7 +206,7 @@ task :optimize do
162
206
  profiler.measure(:test) do
163
207
  Rake::Task['test'].invoke
164
208
  end
165
- profiler.ext_size(ext_so)
209
+ profiler.ext_size(filename)
166
210
 
167
211
  end
168
212
  puts RagelProfiler.results
@@ -171,30 +215,35 @@ end
171
215
 
172
216
  #### Custom testing tasks
173
217
 
174
- task :test => [:compile]
175
-
176
- # Run specific tests or test files
177
- #
178
- # rake test:parser
179
- # => Runs the full TestParser unit test
180
- #
181
- # rake test:parser:textism
182
- # => Runs the tests matching /textism/ in the TestParser unit test
183
- rule "" do |t|
184
- # test:file:method
185
- if /test:(.*)(:([^.]+))?$/.match(t.name)
186
- arguments = t.name.split(":")[1..-1]
187
- file_name = arguments.first
188
- test_name = arguments[1..-1]
189
-
190
- if File.exist?("test/test_#{file_name}.rb")
191
- run_file_name = "test_#{file_name}.rb"
218
+ require 'rubygems'
219
+ require 'spec/rake/spectask'
220
+ Rake::Task[:default].prerequisites.clear
221
+ Spec::Rake::SpecTask.new do |t|
222
+ t.spec_opts = ["--options #{File.dirname(__FILE__) + '/spec/spec.opts'}"]
223
+ t.spec_files = FileList['spec/**/*_spec.rb']
224
+ end
225
+
226
+ task :default => :spec
227
+ task :spec => [:ensure_diff_lcs, :compile]
228
+
229
+ task :ensure_diff_lcs do
230
+ # A little insurance against rake on JRuby not passing the error from load-diff-lcs.rb
231
+ begin
232
+ require 'diff/lcs'
233
+ rescue LoadError
234
+ begin
235
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
236
+ require 'diff/lcs'
237
+ rescue LoadError
238
+ raise "You must gem install diff-lcs to run the specs."
192
239
  end
193
-
194
- sh "ruby -Ilib:test test/#{run_file_name} -n /#{test_name}/"
195
240
  end
196
241
  end
197
242
 
243
+ task :remove_other_platforms do
244
+ Dir["lib/redcloth_scan.{bundle,so,jar,rb}"].each { |file| rm file }
245
+ end
246
+
198
247
  def ensure_ragel_version(name)
199
248
  @ragel_v ||= `ragel -v`[/(version )(\S*)/,2].split('.').map{|s| s.to_i}
200
249
  if @ragel_v[0] > 6 || (@ragel_v[0] == 6 && @ragel_v[1] >= 3)
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{RedCloth}
5
- s.version = "4.1.9"
5
+ s.version = "4.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jason Garber"]
9
- s.date = %q{2009-02-20}
9
+ s.date = %q{2009-06-10}
10
10
  s.default_executable = %q{redcloth}
11
- s.description = %q{RedCloth-4.1.9 - Textile parser for Ruby. http://redcloth.org/}
11
+ s.description = %q{RedCloth-4.2.0 - Textile parser for Ruby. http://redcloth.org/}
12
12
  s.email = %q{redcloth-upwards@rubyforge.org}
13
13
  s.executables = ["redcloth"]
14
14
  s.extensions = ["ext/redcloth_scan/extconf.rb"]
15
15
  s.extra_rdoc_files = ["CHANGELOG", "lib/case_sensitive_require/RedCloth.rb", "lib/redcloth/erb_extension.rb", "lib/redcloth/formatters/base.rb", "lib/redcloth/formatters/html.rb", "lib/redcloth/formatters/latex.rb", "lib/redcloth/textile_doc.rb", "lib/redcloth/version.rb", "lib/redcloth.rb", "README"]
16
- s.files = ["bin/redcloth", "CHANGELOG", "COPYING", "ext/mingw-rbconfig.rb", "ext/redcloth_scan/extconf.rb", "ext/redcloth_scan/redcloth.h", "ext/redcloth_scan/redcloth_attributes.c.rl", "ext/redcloth_scan/redcloth_attributes.java.rl", "ext/redcloth_scan/redcloth_attributes.rl", "ext/redcloth_scan/redcloth_common.c.rl", "ext/redcloth_scan/redcloth_common.java.rl", "ext/redcloth_scan/redcloth_common.rl", "ext/redcloth_scan/redcloth_inline.c.rl", "ext/redcloth_scan/redcloth_inline.java.rl", "ext/redcloth_scan/redcloth_inline.rl", "ext/redcloth_scan/redcloth_scan.c.rl", "ext/redcloth_scan/redcloth_scan.java.rl", "ext/redcloth_scan/redcloth_scan.rl", "extras/ragel_profiler.rb", "lib/case_sensitive_require/RedCloth.rb", "lib/redcloth/erb_extension.rb", "lib/redcloth/formatters/base.rb", "lib/redcloth/formatters/html.rb", "lib/redcloth/formatters/latex.rb", "lib/redcloth/formatters/latex_entities.yml", "lib/redcloth/textile_doc.rb", "lib/redcloth/version.rb", "lib/redcloth.rb", "Manifest", "Rakefile", "README", "setup.rb", "test/basic.yml", "test/code.yml", "test/definitions.yml", "test/extra_whitespace.yml", "test/filter_html.yml", "test/filter_pba.yml", "test/helper.rb", "test/html.yml", "test/images.yml", "test/instiki.yml", "test/links.yml", "test/lists.yml", "test/poignant.yml", "test/sanitize_html.yml", "test/table.yml", "test/test_custom_tags.rb", "test/test_erb.rb", "test/test_extensions.rb", "test/test_formatters.rb", "test/test_parser.rb", "test/test_restrictions.rb", "test/textism.yml", "test/threshold.yml", "test/validate_fixtures.rb", "RedCloth.gemspec", "ext/redcloth_scan/redcloth_attributes.c", "ext/redcloth_scan/redcloth_inline.c", "ext/redcloth_scan/redcloth_scan.c"]
16
+ s.files = ["bin/redcloth", "CHANGELOG", "COPYING", "ext/redcloth_scan/extconf.rb", "ext/redcloth_scan/redcloth.h", "lib/case_sensitive_require/RedCloth.rb", "lib/redcloth/erb_extension.rb", "lib/redcloth/formatters/base.rb", "lib/redcloth/formatters/html.rb", "lib/redcloth/formatters/latex.rb", "lib/redcloth/formatters/latex_entities.yml", "lib/redcloth/textile_doc.rb", "lib/redcloth/version.rb", "lib/redcloth.rb", "lib/tasks/pureruby.rake", "Manifest", "Rakefile", "README", "setup.rb", "spec/custom_tags_spec.rb", "spec/differs/inline.rb", "spec/erb_spec.rb", "spec/extension_spec.rb", "spec/fixtures/basic.yml", "spec/fixtures/code.yml", "spec/fixtures/definitions.yml", "spec/fixtures/extra_whitespace.yml", "spec/fixtures/filter_html.yml", "spec/fixtures/filter_pba.yml", "spec/fixtures/html.yml", "spec/fixtures/images.yml", "spec/fixtures/instiki.yml", "spec/fixtures/links.yml", "spec/fixtures/lists.yml", "spec/fixtures/poignant.yml", "spec/fixtures/sanitize_html.yml", "spec/fixtures/table.yml", "spec/fixtures/textism.yml", "spec/fixtures/threshold.yml", "spec/formatters/class_filtered_html_spec.rb", "spec/formatters/filtered_html_spec.rb", "spec/formatters/html_no_breaks_spec.rb", "spec/formatters/html_spec.rb", "spec/formatters/id_filtered_html_spec.rb", "spec/formatters/latex_spec.rb", "spec/formatters/lite_mode_html_spec.rb", "spec/formatters/no_span_caps_html_spec.rb", "spec/formatters/sanitized_html_spec.rb", "spec/formatters/style_filtered_html_spec.rb", "spec/parser_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "RedCloth.gemspec", "ext/redcloth_scan/redcloth_attributes.c", "ext/redcloth_scan/redcloth_inline.c", "ext/redcloth_scan/redcloth_scan.c"]
17
17
  s.has_rdoc = true
18
18
  s.homepage = %q{http://redcloth.org}
19
19
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "RedCloth", "--main", "README"]
@@ -21,8 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.4")
22
22
  s.rubyforge_project = %q{redcloth}
23
23
  s.rubygems_version = %q{1.3.1}
24
- s.summary = %q{RedCloth-4.1.9 - Textile parser for Ruby. http://redcloth.org/}
25
- s.test_files = ["test/test_custom_tags.rb", "test/test_erb.rb", "test/test_extensions.rb", "test/test_formatters.rb", "test/test_parser.rb", "test/test_restrictions.rb"]
24
+ s.summary = %q{RedCloth-4.2.0 - Textile parser for Ruby. http://redcloth.org/}
26
25
 
27
26
  if s.respond_to? :specification_version then
28
27
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -14,8 +14,8 @@
14
14
  // For Ruby 1.9
15
15
  #ifdef HAVE_RUBY_ENCODING_H
16
16
  #include "ruby/encoding.h"
17
- #define STR_NEW(p,n) rb_enc_str_new((p),(n),rb_utf8_encoding())
18
- #define STR_NEW2(p) rb_enc_str_new((p),strlen(p),rb_utf8_encoding())
17
+ #define STR_NEW(p,n) rb_enc_str_new((p),(n),rb_enc_from_index(ENCODING_GET(self)))
18
+ #define STR_NEW2(p) rb_enc_str_new((p),strlen(p),rb_enc_from_index(ENCODING_GET(self)))
19
19
 
20
20
  // For Ruby 1.8
21
21
  #else
@@ -39,7 +39,7 @@ VALUE redcloth_inline2(VALUE, VALUE, VALUE);
39
39
  VALUE redcloth_attribute_parser(int, VALUE, char *, char *);
40
40
  VALUE redcloth_attributes(VALUE, VALUE);
41
41
  VALUE redcloth_link_attributes(VALUE, VALUE);
42
- VALUE red_parse_title(VALUE, VALUE);
42
+ VALUE red_parse_title(VALUE, VALUE, VALUE);
43
43
  VALUE redcloth_transform(VALUE, char *, char *, VALUE);
44
44
  VALUE redcloth_transform2(VALUE, VALUE);
45
45
  void red_inc(VALUE, VALUE);
@@ -49,8 +49,11 @@ VALUE red_pass(VALUE, VALUE, VALUE, ID, VALUE);
49
49
  VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
50
50
 
51
51
  /* parser macros */
52
- #define CLEAR_REGS() regs = rb_hash_new();
52
+ #define CLEAR_REGS() regs = rb_hash_new(); attr_regs = rb_hash_new();
53
53
  #define RESET_REG() reg = NULL
54
+ #define MARK() reg = p;
55
+ #define MARK_B() bck = p;
56
+ #define MARK_ATTR() attr_reg = p;
54
57
  #define CAT(H) rb_str_cat(H, ts, te-ts)
55
58
  #define CLEAR(H) H = STR_NEW2("")
56
59
  #define RSTRIP_BANG(H) rb_funcall(H, rb_intern("rstrip!"), 0)
@@ -62,7 +65,7 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
62
65
  #define PARSE_ATTR(A) red_parse_attr(self, regs, ID2SYM(rb_intern(A)))
63
66
  #define PARSE_LINK_ATTR(A) red_parse_link_attr(self, regs, ID2SYM(rb_intern(A)))
64
67
  #define PARSE_IMAGE_ATTR(A) red_parse_image_attr(self, regs, ID2SYM(rb_intern(A)))
65
- #define PASS_CODE(H, A, T, O) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(A)), rb_intern(T)))
68
+ #define PASS_CODE(H, A, T) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(A)), rb_intern(T)))
66
69
  #define ADD_BLOCK() \
67
70
  rb_str_append(html, red_block(self, regs, block, refs)); \
68
71
  extend = Qnil; \
@@ -70,16 +73,19 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
70
73
  CLEAR_REGS()
71
74
  #define ADD_EXTENDED_BLOCK() rb_str_append(html, red_block(self, regs, block, refs)); CLEAR(block);
72
75
  #define END_EXTENDED() extend = Qnil; CLEAR_REGS();
73
- #define IS_NOT_EXTENDED() NIL_P(extend)
74
76
  #define ADD_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block); CLEAR_REGS()
75
77
  #define ADD_EXTENDED_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block);
76
78
  #define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(T)), STR_NEW2(V));
77
- #define AINC(T) red_inc(regs, ID2SYM(rb_intern(T)));
79
+ #define ATTR_SET(T, V) rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), STR_NEW2(V));
80
+ #define ATTR_INC(T) red_inc(attr_regs, ID2SYM(rb_intern(T)));
81
+ #define INC(N) N++;
78
82
  #define SET_ATTRIBUTES() \
79
83
  SET_ATTRIBUTE("class_buf", "class"); \
80
84
  SET_ATTRIBUTE("id_buf", "id"); \
81
85
  SET_ATTRIBUTE("lang_buf", "lang"); \
82
- SET_ATTRIBUTE("style_buf", "style");
86
+ SET_ATTRIBUTE("style_buf", "style"); \
87
+ rb_funcall(regs, rb_intern("merge!"), 1, attr_regs); \
88
+ attr_regs = rb_hash_new();
83
89
  #define SET_ATTRIBUTE(B, A) \
84
90
  if (rb_hash_aref(regs, ID2SYM(rb_intern(B))) != Qnil) rb_hash_aset(regs, ID2SYM(rb_intern(A)), rb_hash_aref(regs, ID2SYM(rb_intern(B))));
85
91
  #define TRANSFORM(T) \
@@ -106,6 +112,15 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
106
112
  } else { \
107
113
  rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
108
114
  }
115
+ #define STORE_ATTR(T) \
116
+ if (p > attr_reg && attr_reg >= ts) { \
117
+ VALUE str = STR_NEW(attr_reg, p-attr_reg); \
118
+ rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), str); \
119
+ /*printf("STORE_B(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \
120
+ } else { \
121
+ rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), Qnil); \
122
+ }
123
+
109
124
  #define STORE_URL(T) \
110
125
  if (p > reg && reg >= ts) { \
111
126
  char punct = 1; \
@@ -141,20 +156,24 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
141
156
  #define STORE_LINK_ALIAS() \
142
157
  rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href"))))
143
158
  #define CLEAR_LIST() list_layout = rb_ary_new()
144
- #define LIST_ITEM() \
159
+ #define SET_LIST_TYPE(T) list_type = T;
160
+ #define NEST() nest ++;
161
+ #define RESET_NEST() nest = 0;
162
+ #define LIST_LAYOUT() \
145
163
  int aint = 0; \
146
164
  VALUE aval = rb_ary_entry(list_index, nest-1); \
147
165
  if (aval != Qnil) aint = NUM2INT(aval); \
148
- if (strcmp(list_type, "ol") == 0) \
166
+ if (strcmp(list_type, "ol") == 0 && nest > 0) \
149
167
  { \
150
168
  rb_ary_store(list_index, nest-1, INT2NUM(aint + 1)); \
151
169
  } \
152
170
  if (nest > RARRAY_LEN(list_layout)) \
153
171
  { \
172
+ SET_ATTRIBUTES(); \
154
173
  sprintf(listm, "%s_open", list_type); \
155
- if (list_continue == 1) \
174
+ if (!NIL_P(rb_hash_aref(regs, ID2SYM(rb_intern("list_continue"))))) \
156
175
  { \
157
- list_continue = 0; \
176
+ rb_hash_aset(regs, ID2SYM(rb_intern("list_continue")), Qnil); \
158
177
  rb_hash_aset(regs, ID2SYM(rb_intern("start")), rb_ary_entry(list_index, nest-1)); \
159
178
  } \
160
179
  else \
@@ -177,8 +196,13 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
177
196
  ASET("first", "true"); \
178
197
  } \
179
198
  LIST_CLOSE(); \
199
+ if (nest != 0) LIST_ITEM_CLOSE(); \
200
+ CLEAR_REGS(); \
180
201
  rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY_LEN(list_layout))); \
181
- ASET("type", "li_open")
202
+ ASET("type", "li_open");
203
+ #define LIST_ITEM_CLOSE() \
204
+ if ( rb_hash_aref(regs, ID2SYM(rb_intern("first"))) == Qnil ) \
205
+ rb_str_append(html, rb_funcall(self, rb_intern("li_close"), 1, regs));
182
206
  #define LIST_CLOSE() \
183
207
  while (nest < RARRAY_LEN(list_layout)) \
184
208
  { \
@@ -188,6 +212,7 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
188
212
  { \
189
213
  StringValue(end_list); \
190
214
  sprintf(listm, "%s_close", RSTRING_PTR(end_list)); \
215
+ LIST_ITEM_CLOSE(); \
191
216
  rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \
192
217
  } \
193
218
  }