bluecloth 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +23 -0
 - data/ext/Csio.c +2 -2
 - data/ext/VERSION +1 -1
 - data/ext/bluecloth.c +7 -1
 - data/ext/cstring.h +3 -3
 - data/ext/generate.c +362 -217
 - data/ext/markdown.c +7 -6
 - data/ext/markdown.h +5 -1
 - data/ext/mkdio.c +1 -1
 - data/ext/mkdio.h +2 -0
 - data/ext/resource.c +13 -5
 - data/lib/bluecloth.rb +10 -4
 - data/rake/helpers.rb +16 -16
 - data/rake/svn.rb +5 -4
 - data/spec/bluecloth/links_spec.rb +3 -3
 - data/spec/bluecloth_spec.rb +34 -0
 - data/spec/discount_spec.rb +67 -0
 - data/spec/lib/matchers.rb +29 -29
 - metadata +6 -8
 
    
        data/spec/lib/matchers.rb
    CHANGED
    
    | 
         @@ -13,7 +13,7 @@ module BlueCloth::Matchers 
     | 
|
| 
       13 
13 
     | 
    
         
             
            	### Matcher for comparing output of a BlueCloth-generated HTML fragment against a known-good
         
     | 
| 
       14 
14 
     | 
    
         
             
            	### string.
         
     | 
| 
       15 
15 
     | 
    
         
             
            	class TransformMatcher
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       17 
17 
     | 
    
         
             
            		### Create a new matcher for the given +html+
         
     | 
| 
       18 
18 
     | 
    
         
             
            		def initialize( html )
         
     | 
| 
       19 
19 
     | 
    
         
             
            			@html = html
         
     | 
| 
         @@ -25,10 +25,10 @@ module BlueCloth::Matchers 
     | 
|
| 
       25 
25 
     | 
    
         
             
            				indent.gsub!( /\A\n/m, '' )
         
     | 
| 
       26 
26 
     | 
    
         
             
            				@html.gsub!( /^#{indent}/m, '' )
         
     | 
| 
       27 
27 
     | 
    
         
             
            			end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       29 
29 
     | 
    
         
             
            			return self
         
     | 
| 
       30 
30 
     | 
    
         
             
            		end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            		### Returns true if the HTML generated by the given +bluecloth+ object matches the 
         
     | 
| 
       34 
34 
     | 
    
         
             
            		### expected HTML, comparing only the salient document structures.
         
     | 
| 
         @@ -37,7 +37,7 @@ module BlueCloth::Matchers 
     | 
|
| 
       37 
37 
     | 
    
         
             
            			@output_html = bluecloth.to_html.gsub( /\n\n\n/, "\n\n" )
         
     | 
| 
       38 
38 
     | 
    
         
             
            			return @output_html.strip == @html.strip
         
     | 
| 
       39 
39 
     | 
    
         
             
            		end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       41 
41 
     | 
    
         
             
            		### Build a failure message for the matching case.
         
     | 
| 
       42 
42 
     | 
    
         
             
            		def failure_message
         
     | 
| 
       43 
43 
     | 
    
         
             
            			if self.should_output_html?
         
     | 
| 
         @@ -57,14 +57,14 @@ module BlueCloth::Matchers 
     | 
|
| 
       57 
57 
     | 
    
         
             
            					"  %p\n\nDiffs:\n\n%s") % [ @output_html, @html, patch ]
         
     | 
| 
       58 
58 
     | 
    
         
             
            			end
         
     | 
| 
       59 
59 
     | 
    
         
             
            		end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
       61 
61 
     | 
    
         
             
            		### Build a failure message for the non-matching case.
         
     | 
| 
       62 
62 
     | 
    
         
             
            		def negative_failure_message
         
     | 
| 
       63 
63 
     | 
    
         
             
            			return "Expected the generated html:\n\n  %p\n\nnot to be the same as:\n\n  %p\n\n" %
         
     | 
| 
       64 
64 
     | 
    
         
             
            				[ @output_html, @html ]
         
     | 
| 
       65 
65 
     | 
    
         
             
            		end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
       68 
68 
     | 
    
         
             
            		### Returns true if it appears HTML output should be used instead of plain-text. This
         
     | 
| 
       69 
69 
     | 
    
         
             
            		### will be true if running from TextMate or if the HTML_LOGGING environment variable
         
     | 
| 
       70 
70 
     | 
    
         
             
            		### is set.
         
     | 
| 
         @@ -73,8 +73,8 @@ module BlueCloth::Matchers 
     | 
|
| 
       73 
73 
     | 
    
         
             
            			# return ENV['HTML_LOGGING'] ||
         
     | 
| 
       74 
74 
     | 
    
         
             
            			# 	(ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\.rb/)
         
     | 
| 
       75 
75 
     | 
    
         
             
            		end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
       78 
78 
     | 
    
         
             
            		### Compute a patch between the given +expected+ output and the +actual+ output
         
     | 
| 
       79 
79 
     | 
    
         
             
            		### and return it as a string.
         
     | 
| 
       80 
80 
     | 
    
         
             
            		def make_patch( expected, actual )
         
     | 
| 
         @@ -99,7 +99,7 @@ module BlueCloth::Matchers 
     | 
|
| 
       99 
99 
     | 
    
         
             
            				end.join("\n")
         
     | 
| 
       100 
100 
     | 
    
         
             
            			end.join("\n---\n")
         
     | 
| 
       101 
101 
     | 
    
         
             
            		end
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
       103 
103 
     | 
    
         
             
            		### Compute a patch similar to #make_patch, but output HTML instead of plain text.
         
     | 
| 
       104 
104 
     | 
    
         
             
            		def make_html_patch( expected, actual )
         
     | 
| 
       105 
105 
     | 
    
         
             
            			diffs = Diff::LCS.sdiff( expected.split("\n"), actual.split("\n"),
         
     | 
| 
         @@ -126,9 +126,9 @@ module BlueCloth::Matchers 
     | 
|
| 
       126 
126 
     | 
    
         
             
            			end.join( "</tbody><tbody>" )
         
     | 
| 
       127 
127 
     | 
    
         
             
            			patch << %{</tbody></table>\n}
         
     | 
| 
       128 
128 
     | 
    
         
             
            		end
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
       130 
130 
     | 
    
         
             
            	end
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
       132 
132 
     | 
    
         
             
            	### Variant of the regular TransformMatcher that normalizes the two strings using the 'tidy'
         
     | 
| 
       133 
133 
     | 
    
         
             
            	### library before comparing.
         
     | 
| 
       134 
134 
     | 
    
         
             
            	class TidyTransformMatcher < TransformMatcher
         
     | 
| 
         @@ -144,17 +144,17 @@ module BlueCloth::Matchers 
     | 
|
| 
       144 
144 
     | 
    
         
             
            				Tidy.path = "libtidy.#{soext}"
         
     | 
| 
       145 
145 
     | 
    
         
             
            				@tidy = Tidy.new( TIDY_OPTIONS )
         
     | 
| 
       146 
146 
     | 
    
         
             
            			end
         
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
       148 
148 
     | 
    
         
             
            			return @tidy
         
     | 
| 
       149 
149 
     | 
    
         
             
            		end
         
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
       151 
151 
     | 
    
         | 
| 
       152 
152 
     | 
    
         
             
            		### Set the matcher's expected output to a tidied version of the input +html+.
         
     | 
| 
       153 
153 
     | 
    
         
             
            		def initialize( html )
         
     | 
| 
       154 
154 
     | 
    
         
             
            			@html = self.class.tidy_object.clean( html )
         
     | 
| 
       155 
155 
     | 
    
         
             
            		end
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
       158 
158 
     | 
    
         
             
            		### Returns true if the HTML generated by the given +bluecloth+ object matches the 
         
     | 
| 
       159 
159 
     | 
    
         
             
            		### expected HTML after normalizing them both with 'tidy'.
         
     | 
| 
       160 
160 
     | 
    
         
             
            		def matches?( bluecloth )
         
     | 
| 
         @@ -162,17 +162,17 @@ module BlueCloth::Matchers 
     | 
|
| 
       162 
162 
     | 
    
         
             
            			@output_html = self.class.tidy_object.clean( bluecloth.to_html )
         
     | 
| 
       163 
163 
     | 
    
         
             
            			return @output_html == @html
         
     | 
| 
       164 
164 
     | 
    
         
             
            		end
         
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
       166 
166 
     | 
    
         
             
            	end
         
     | 
| 
       167 
167 
     | 
    
         | 
| 
       168 
168 
     | 
    
         | 
| 
       169 
169 
     | 
    
         
             
            	class TransformRegexpMatcher
         
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
       171 
171 
     | 
    
         
             
            		### Create a new matcher for the given +regexp+
         
     | 
| 
       172 
172 
     | 
    
         
             
            		def initialize( regexp )
         
     | 
| 
       173 
173 
     | 
    
         
             
            			@regexp = regexp
         
     | 
| 
       174 
174 
     | 
    
         
             
            		end
         
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
       176 
176 
     | 
    
         
             
            		### Returns true if the regexp associated with this matcher matches the output generated
         
     | 
| 
       177 
177 
     | 
    
         
             
            		### by the specified +bluecloth+ object.
         
     | 
| 
       178 
178 
     | 
    
         
             
            		def matches?( bluecloth )
         
     | 
| 
         @@ -180,21 +180,21 @@ module BlueCloth::Matchers 
     | 
|
| 
       180 
180 
     | 
    
         
             
            			@output_html = bluecloth.to_html
         
     | 
| 
       181 
181 
     | 
    
         
             
            			return @output_html =~ @regexp
         
     | 
| 
       182 
182 
     | 
    
         
             
            		end
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
      
 183 
     | 
    
         
            +
             
     | 
| 
       184 
184 
     | 
    
         
             
            		### Build a failure message for the matching case.
         
     | 
| 
       185 
185 
     | 
    
         
             
            		def failure_message
         
     | 
| 
       186 
186 
     | 
    
         
             
            			return "Expected the generated html:\n\n   %pto match the regexp:\n\n%p\n\n" %
         
     | 
| 
       187 
187 
     | 
    
         
             
            				[ @output_html, @regexp ]
         
     | 
| 
       188 
188 
     | 
    
         
             
            		end
         
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
       191 
191 
     | 
    
         
             
            		### Build a failure message for the negative matching case.
         
     | 
| 
       192 
192 
     | 
    
         
             
            		def negative_failure_message
         
     | 
| 
       193 
193 
     | 
    
         
             
            			return "Expected the generated html:\n\n   %pnot to match the regexp:\n\n%p\n\n" %
         
     | 
| 
       194 
194 
     | 
    
         
             
            				[ @output_html, @regexp ]
         
     | 
| 
       195 
195 
     | 
    
         
             
            		end
         
     | 
| 
       196 
196 
     | 
    
         
             
            	end
         
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
       198 
198 
     | 
    
         | 
| 
       199 
199 
     | 
    
         
             
            	### Create a new BlueCloth object out of the given +string+ and +options+ and
         
     | 
| 
       200 
200 
     | 
    
         
             
            	### return it.
         
     | 
| 
         @@ -202,7 +202,7 @@ module BlueCloth::Matchers 
     | 
|
| 
       202 
202 
     | 
    
         
             
            		return BlueCloth.new( string, *options )
         
     | 
| 
       203 
203 
     | 
    
         
             
            	end
         
     | 
| 
       204 
204 
     | 
    
         | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
       206 
206 
     | 
    
         
             
            	### Strip indentation from the given +string+, create a new BlueCloth object 
         
     | 
| 
       207 
207 
     | 
    
         
             
            	### out of the result and any +options+, and return it.
         
     | 
| 
       208 
208 
     | 
    
         
             
            	def the_indented_markdown( string, *options )
         
     | 
| 
         @@ -211,25 +211,25 @@ module BlueCloth::Matchers 
     | 
|
| 
       211 
211 
     | 
    
         
             
            			$stderr.puts "Source indent is: %p" % [ indent ] if $DEBUG
         
     | 
| 
       212 
212 
     | 
    
         
             
            			string.gsub!( /^#{indent}/m, '' )
         
     | 
| 
       213 
213 
     | 
    
         
             
            		end
         
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
       215 
215 
     | 
    
         
             
            		return BlueCloth.new( string, *options )
         
     | 
| 
       216 
216 
     | 
    
         
             
            	end
         
     | 
| 
       217 
217 
     | 
    
         | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
      
 218 
     | 
    
         
            +
             
     | 
| 
       219 
219 
     | 
    
         
             
            	### Generate a matcher that expects to equal the given +html+.
         
     | 
| 
       220 
220 
     | 
    
         
             
            	def be_transformed_into( html )
         
     | 
| 
       221 
221 
     | 
    
         
             
            		return BlueCloth::Matchers::TransformMatcher.new( html )
         
     | 
| 
       222 
222 
     | 
    
         
             
            	end
         
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
       224 
224 
     | 
    
         
             
            	### Generate a matcher that expects to match a normalized version of the specified +html+.
         
     | 
| 
       225 
225 
     | 
    
         
             
            	def be_transformed_into_normalized_html( html )
         
     | 
| 
       226 
226 
     | 
    
         
             
            		return BlueCloth::Matchers::TidyTransformMatcher.new( html )
         
     | 
| 
       227 
227 
     | 
    
         
             
            	end
         
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
       229 
229 
     | 
    
         
             
            	### Generate a matcher that expects to match the given +regexp+.
         
     | 
| 
       230 
230 
     | 
    
         
             
            	def be_transformed_into_html_matching( regexp )
         
     | 
| 
       231 
231 
     | 
    
         
             
            		return BlueCloth::Matchers::TransformMatcher.new( regexp )
         
     | 
| 
       232 
232 
     | 
    
         
             
            	end
         
     | 
| 
       233 
     | 
    
         
            -
             
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
       234 
234 
     | 
    
         
             
            end # module BlueCloth::Matchers
         
     | 
| 
       235 
235 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bluecloth
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Michael Granger
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2009-06- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2009-06-29 00:00:00 -07:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -132,11 +132,7 @@ dependencies: 
     | 
|
| 
       132 
132 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       133 
133 
     | 
    
         
             
                    version: 0.7.0.0
         
     | 
| 
       134 
134 
     | 
    
         
             
                version: 
         
     | 
| 
       135 
     | 
    
         
            -
            description:  
     | 
| 
       136 
     | 
    
         
            -
              BlueCloth is a Ruby implementation of [Markdown][1], a text-to-HTML conversion
         
     | 
| 
       137 
     | 
    
         
            -
              tool for web writers. To quote from the project page: Markdown allows you to
         
     | 
| 
       138 
     | 
    
         
            -
              write using an easy-to-read, easy-to-write plain text format, then convert it to
         
     | 
| 
       139 
     | 
    
         
            -
              structurally valid XHTML (or HTML).
         
     | 
| 
      
 135 
     | 
    
         
            +
            description: "BlueCloth is a Ruby implementation of [Markdown][1], a text-to-HTML conversion tool for web writers. To quote from the project page: Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)."
         
     | 
| 
       140 
136 
     | 
    
         
             
            email: ged@FaerieMUD.org
         
     | 
| 
       141 
137 
     | 
    
         
             
            executables: 
         
     | 
| 
       142 
138 
     | 
    
         
             
            - bluecloth
         
     | 
| 
         @@ -168,6 +164,7 @@ files: 
     | 
|
| 
       168 
164 
     | 
    
         
             
            - spec/bluecloth_spec.rb
         
     | 
| 
       169 
165 
     | 
    
         
             
            - spec/bugfix_spec.rb
         
     | 
| 
       170 
166 
     | 
    
         
             
            - spec/contributions_spec.rb
         
     | 
| 
      
 167 
     | 
    
         
            +
            - spec/discount_spec.rb
         
     | 
| 
       171 
168 
     | 
    
         
             
            - spec/markdowntest_spec.rb
         
     | 
| 
       172 
169 
     | 
    
         
             
            - spec/lib/constants.rb
         
     | 
| 
       173 
170 
     | 
    
         
             
            - spec/lib/helpers.rb
         
     | 
| 
         @@ -288,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       288 
285 
     | 
    
         
             
            requirements: []
         
     | 
| 
       289 
286 
     | 
    
         | 
| 
       290 
287 
     | 
    
         
             
            rubyforge_project: bluecloth
         
     | 
| 
       291 
     | 
    
         
            -
            rubygems_version: 1.3. 
     | 
| 
      
 288 
     | 
    
         
            +
            rubygems_version: 1.3.1
         
     | 
| 
       292 
289 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       293 
290 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       294 
291 
     | 
    
         
             
            summary: BlueCloth is a Ruby implementation of Markdown
         
     | 
| 
         @@ -309,6 +306,7 @@ test_files: 
     | 
|
| 
       309 
306 
     | 
    
         
             
            - spec/bluecloth_spec.rb
         
     | 
| 
       310 
307 
     | 
    
         
             
            - spec/bugfix_spec.rb
         
     | 
| 
       311 
308 
     | 
    
         
             
            - spec/contributions_spec.rb
         
     | 
| 
      
 309 
     | 
    
         
            +
            - spec/discount_spec.rb
         
     | 
| 
       312 
310 
     | 
    
         
             
            - spec/markdowntest_spec.rb
         
     | 
| 
       313 
311 
     | 
    
         
             
            - spec/lib/constants.rb
         
     | 
| 
       314 
312 
     | 
    
         
             
            - spec/lib/helpers.rb
         
     |