slideshow 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 0.8.5 / 2010-06-25
2
+
3
+ * Added workaround for RedCloth 4 (Java-only) multi-byte character bug
4
+
1
5
  === 0.8.4 / 2010-06-24
2
6
 
3
7
  * Added support for proxy via HTTP_PROXY env for fetching templates from the internet
@@ -24,7 +24,7 @@ require 'slideshow/gen'
24
24
 
25
25
  module Slideshow
26
26
 
27
- VERSION = '0.8.4'
27
+ VERSION = '0.8.5'
28
28
 
29
29
  def Slideshow.main
30
30
 
@@ -67,6 +67,15 @@ class Gen
67
67
 
68
68
  # todo: move to filter (for easier reuse)
69
69
  def textile_to_html( content )
70
+
71
+ # JRuby workaround for RedCloth 4 multi-byte character bug
72
+ # see http://jgarber.lighthouseapp.com/projects/13054/tickets/149-redcloth-4-doesnt-support-multi-bytes-content
73
+ # basically convert non-ascii chars (>127) to html entities
74
+
75
+ if RedCloth::EXTENSION_LANGUAGE == "Java"
76
+ content = content.chars.map{ |x| x.size > 1 ? "&##{x.unpack("U*")};" : x }.join
77
+ end
78
+
70
79
  # turn off hard line breaks
71
80
  # turn off span caps (see http://rubybook.ca/2008/08/16/redcloth)
72
81
  red = RedCloth.new( content, [:no_span_caps] )
@@ -269,12 +278,8 @@ class Gen
269
278
  proxy = OpenStruct.new # all fields return nil (e.g. proxy.host, etc.)
270
279
  end
271
280
 
272
- # same as old code w/o proxy: response = Net::HTTP.get_response( uri )
273
-
274
- response = Net::HTTP::Proxy(proxy.host,proxy.port,proxy.user,proxy.password).start( uri.host, uri.port ) do |http|
275
- return http.request_get(uri.request_uri)
276
- end
277
-
281
+ http = Net::HTTP::Proxy( proxy.host, proxy.port, proxy.user, proxy.password )
282
+ response = http.get_response( uri )
278
283
 
279
284
  unless response.code == '200' # note: responsoe.code is a string
280
285
  msg = "#{response.code} #{response.message}"
@@ -286,15 +291,15 @@ class Gen
286
291
 
287
292
  # check for content type; use 'wb' for images
288
293
  if response.content_type =~ /image/
289
- logger.debug ' switching to binary'
290
- flags = 'wb'
294
+ logger.debug ' switching to binary'
295
+ flags = 'wb'
291
296
  else
292
297
  flags = 'w'
293
298
  end
294
299
 
295
300
  File.open( dest, flags ) do |f|
296
- f.write( response.body )
297
- end
301
+ f.write( response.body )
302
+ end
298
303
  end
299
304
 
300
305
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 4
10
- version: 0.8.4
9
+ - 5
10
+ version: 0.8.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-24 00:00:00 +02:00
18
+ date: 2010-06-25 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency