wunderbar 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,11 +41,17 @@ class HtmlMarkup < Wunderbar::BuilderBase
41
41
  source = @x.target!.slice!(0..-1)
42
42
  indent = col = 0
43
43
  breakable = true
44
+ pre = false
44
45
  while not source.empty?
45
46
  token = source.shift
46
47
  indent = token[/^ */].length if col == 0
47
- breakable = false if token.start_with? '<'
48
- while token.length + col > @_width and breakable
48
+
49
+ if token.start_with? '<'
50
+ breakable = false
51
+ pre = true if token == '<pre'
52
+ end
53
+
54
+ while token.length + col > @_width and breakable and not pre
49
55
  break if token[0...-1].include? "\n"
50
56
  split = token.rindex(' ', [@_width-col,0].max) || token.index(' ')
51
57
  break unless split
@@ -54,7 +60,12 @@ class HtmlMarkup < Wunderbar::BuilderBase
54
60
  col = indent
55
61
  token = token[split+1..-1]
56
62
  end
57
- breakable = true if token.end_with? '>'
63
+
64
+ if token.end_with? '>'
65
+ breakable = true
66
+ pre = false if token == '</pre>'
67
+ end
68
+
58
69
  @x.target! << token
59
70
  col += token.length
60
71
  col = 0 if token.end_with? "\n"
@@ -2,13 +2,26 @@ require 'active_support/core_ext'
2
2
 
3
3
  module Wunderbar
4
4
  module Rails
5
+ class HelperProxy < HtmlMarkup
6
+ def method_missing(symbol, *args, &block)
7
+ if @_scope.respond_to? symbol
8
+ if @_scope.method(symbol).owner.parents.include? ActionView::Helpers
9
+ return _import! @_scope.__send__(symbol, *args, &block)
10
+ end
11
+ elsif @_scope.helpers.instance_methods.include? symbol
12
+ return _import! @_scope.__send__(symbol, *args, &block)
13
+ end
14
+ super
15
+ end
16
+ end
17
+
5
18
  class HtmlHandler
6
19
  cattr_accessor :default_format
7
20
  self.default_format = Mime::HTML
8
21
 
9
22
  def self.call(template)
10
23
  pre = %{
11
- x = HtmlMarkup.new(self);
24
+ x = Wunderbar::Rails::HelperProxy.new(self);
12
25
  instance_variables.each do |var|
13
26
  x.instance_variable_set var, instance_variable_get(var)
14
27
  end
@@ -2,7 +2,7 @@ module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 11
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/wunderbar.gemspec CHANGED
@@ -1,23 +1,19 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{wunderbar}
5
- s.version = "0.11.0"
4
+ s.name = "wunderbar"
5
+ s.version = "0.11.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{Sam Ruby}]
9
- s.date = %q{2012-04-23}
10
- s.description = %q{ Wunderbar makes it easy to produce valid HTML5, wellformed XHTML, Unicode
11
- (utf-8), consistently indented, readable applications. This includes
12
- output that conforms to the Polyglot specification and the emerging
13
- results from the XML Error Recovery Community Group.
14
- }
15
- s.email = %q{rubys@intertwingly.net}
16
- s.files = [%q{wunderbar.gemspec}, %q{README.md}, %q{COPYING}, %q{lib/wunderbar.rb}, %q{lib/wunderbar}, %q{lib/wunderbar/version.rb}, %q{lib/wunderbar/installation.rb}, %q{lib/wunderbar/cssproxy.rb}, %q{lib/wunderbar/rack.rb}, %q{lib/wunderbar/logger.rb}, %q{lib/wunderbar/builder.rb}, %q{lib/wunderbar/sinatra.rb}, %q{lib/wunderbar/rails.rb}, %q{lib/wunderbar/server.rb}, %q{lib/wunderbar/html-methods.rb}, %q{lib/wunderbar/job-control.rb}, %q{lib/wunderbar/environment.rb}, %q{lib/wunderbar/cgi-methods.rb}]
17
- s.homepage = %q{http://github.com/rubys/wunderbar}
18
- s.require_paths = [%q{lib}]
19
- s.rubygems_version = %q{1.8.5}
20
- s.summary = %q{HTML Generator and CGI application support}
8
+ s.authors = ["Sam Ruby"]
9
+ s.date = "2012-04-24"
10
+ s.description = " Wunderbar makes it easy to produce valid HTML5, wellformed XHTML, Unicode\n (utf-8), consistently indented, readable applications. This includes\n output that conforms to the Polyglot specification and the emerging\n results from the XML Error Recovery Community Group.\n"
11
+ s.email = "rubys@intertwingly.net"
12
+ s.files = ["wunderbar.gemspec", "README.md", "COPYING", "lib/wunderbar.rb", "lib/wunderbar", "lib/wunderbar/installation.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/server.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/rack.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/sinatra.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/rails.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/version.rb"]
13
+ s.homepage = "http://github.com/rubys/wunderbar"
14
+ s.require_paths = ["lib"]
15
+ s.rubygems_version = "1.8.21"
16
+ s.summary = "HTML Generator and CGI application support"
21
17
 
22
18
  if s.respond_to? :specification_version then
23
19
  s.specification_version = 3
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wunderbar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 0
10
- version: 0.11.0
9
+ - 1
10
+ version: 0.11.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sam Ruby
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-23 00:00:00 Z
18
+ date: 2012-04-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder
@@ -59,19 +59,19 @@ files:
59
59
  - README.md
60
60
  - COPYING
61
61
  - lib/wunderbar.rb
62
- - lib/wunderbar/version.rb
63
62
  - lib/wunderbar/installation.rb
64
- - lib/wunderbar/cssproxy.rb
65
- - lib/wunderbar/rack.rb
63
+ - lib/wunderbar/html-methods.rb
64
+ - lib/wunderbar/job-control.rb
65
+ - lib/wunderbar/server.rb
66
66
  - lib/wunderbar/logger.rb
67
+ - lib/wunderbar/rack.rb
67
68
  - lib/wunderbar/builder.rb
68
69
  - lib/wunderbar/sinatra.rb
69
- - lib/wunderbar/rails.rb
70
- - lib/wunderbar/server.rb
71
- - lib/wunderbar/html-methods.rb
72
- - lib/wunderbar/job-control.rb
73
70
  - lib/wunderbar/environment.rb
71
+ - lib/wunderbar/rails.rb
74
72
  - lib/wunderbar/cgi-methods.rb
73
+ - lib/wunderbar/cssproxy.rb
74
+ - lib/wunderbar/version.rb
75
75
  homepage: http://github.com/rubys/wunderbar
76
76
  licenses: []
77
77
 
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements: []
102
102
 
103
103
  rubyforge_project:
104
- rubygems_version: 1.8.5
104
+ rubygems_version: 1.8.21
105
105
  signing_key:
106
106
  specification_version: 3
107
107
  summary: HTML Generator and CGI application support