wunderbar 0.8.11 → 0.8.12

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.
@@ -69,7 +69,7 @@ end
69
69
 
70
70
  # Conditionally provide output, based on ETAG
71
71
  def $cgi.out?(headers, &block)
72
- content = block.call.join
72
+ content = block.call
73
73
  require 'digest/md5'
74
74
  etag = Digest::MD5.hexdigest(content)
75
75
 
@@ -0,0 +1,67 @@
1
+ module Wunderbar
2
+ # Class "lifted" from Markaby to store element options. Methods called
3
+ # against the CssProxy object are added as element classes or IDs.
4
+ #
5
+ # Modified to accept args for empty, non-void elements, and to capture and
6
+ # restore indentation state.
7
+ #
8
+ # See the README for examples.
9
+ class CssProxy
10
+ def initialize(builder, stream, sym, args)
11
+ @builder = builder
12
+ @indent = builder.indentation_state!
13
+ @stream = stream
14
+ @sym = sym
15
+ @args = args
16
+ @attrs = {}
17
+
18
+ @original_stream_length = @stream.length
19
+
20
+ @builder.tag! sym, *args
21
+ end
22
+
23
+ def respond_to?(sym, include_private = false)
24
+ include_private || !private_methods.map { |m| m.to_sym }.include?(sym.to_sym) ? true : false
25
+ end
26
+
27
+ private
28
+
29
+ # Adds attributes to an element. Bang methods set the :id attribute.
30
+ # Other methods add to the :class attribute.
31
+ def method_missing(id_or_class, *args, &block)
32
+ if id_or_class.to_s =~ /(.*)!$/
33
+ @attrs[:id] = $1
34
+ else
35
+ id = id_or_class
36
+ @attrs[:class] = @attrs[:class] ? "#{@attrs[:class]} #{id}".strip : id
37
+ end
38
+
39
+ unless args.empty?
40
+ if args.last.respond_to? :to_hash
41
+ @attrs.merge! args.pop.to_hash
42
+ end
43
+ end
44
+
45
+ args.push(@attrs)
46
+ args = @args + args unless block or String === args.first
47
+
48
+ while @stream.length > @original_stream_length
49
+ @stream.pop
50
+ end
51
+
52
+ begin
53
+ indent = @builder.indentation_state! @indent
54
+
55
+ if block
56
+ @builder.tag! @sym, *args, &block
57
+ else
58
+ @builder.tag! @sym, *args
59
+ end
60
+ ensure
61
+ @builder.indentation_state! indent
62
+ end
63
+
64
+ self
65
+ end
66
+ end
67
+ end
@@ -16,6 +16,7 @@ class HtmlMarkup
16
16
  end
17
17
  instance_exec(@x, &block)
18
18
  end
19
+ target!
19
20
  end
20
21
 
21
22
  def method_missing(name, *args, &block)
@@ -2,7 +2,7 @@ module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 8
5
- TINY = 11
5
+ TINY = 12
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/wunderbar.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "wunderbar"
5
- s.version = "0.8.11"
5
+ s.version = "0.8.12"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Ruby"]
9
9
  s.date = "2012-03-23"
10
10
  s.description = " Provides a number of globals, helper methods, and monkey patches which\n simplify the generation of HTML and the development of CGI scripts.\n"
11
11
  s.email = "rubys@intertwingly.net"
12
- s.extra_rdoc_files = ["COPYING", "README.md", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/version.rb"]
13
- s.files = ["COPYING", "README.md", "Rakefile", "demo/envdump.rb", "demo/helloworld.rb", "demo/wiki.html", "demo/wiki.rb", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/version.rb", "test/test_builder.rb", "test/test_html_markup.rb", "test/test_logger.rb", "tools/web2script.rb", "wunderbar.gemspec", "Manifest"]
12
+ s.extra_rdoc_files = ["COPYING", "README.md", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/version.rb"]
13
+ s.files = ["COPYING", "README.md", "Rakefile", "demo/envdump.rb", "demo/helloworld.rb", "demo/wiki.html", "demo/wiki.rb", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/version.rb", "test/test_builder.rb", "test/test_html_markup.rb", "test/test_logger.rb", "tools/web2script.rb", "wunderbar.gemspec", "Manifest"]
14
14
  s.homepage = "http://github.com/rubys/wunderbar"
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Wunderbar", "--main", "README.md"]
16
16
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wunderbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.11
4
+ version: 0.8.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
16
- requirement: &10419980 !ruby/object:Gem::Requirement
16
+ requirement: &20890340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10419980
24
+ version_requirements: *20890340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &10418220 !ruby/object:Gem::Requirement
27
+ requirement: &20889580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *10418220
35
+ version_requirements: *20889580
36
36
  description: ! " Provides a number of globals, helper methods, and monkey patches
37
37
  which\n simplify the generation of HTML and the development of CGI scripts.\n"
38
38
  email: rubys@intertwingly.net
@@ -44,6 +44,7 @@ extra_rdoc_files:
44
44
  - lib/wunderbar.rb
45
45
  - lib/wunderbar/builder.rb
46
46
  - lib/wunderbar/cgi-methods.rb
47
+ - lib/wunderbar/cssproxy.rb
47
48
  - lib/wunderbar/environment.rb
48
49
  - lib/wunderbar/html-methods.rb
49
50
  - lib/wunderbar/installation.rb
@@ -61,6 +62,7 @@ files:
61
62
  - lib/wunderbar.rb
62
63
  - lib/wunderbar/builder.rb
63
64
  - lib/wunderbar/cgi-methods.rb
65
+ - lib/wunderbar/cssproxy.rb
64
66
  - lib/wunderbar/environment.rb
65
67
  - lib/wunderbar/html-methods.rb
66
68
  - lib/wunderbar/installation.rb