wunderbar 0.22.4 → 0.23.0

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/README.md CHANGED
@@ -157,6 +157,13 @@ Complete lists/rows can be defined using arrays:
157
157
  _tr %w(apple orange pear)
158
158
  end
159
159
 
160
+ Arbitrary iteration can be done over Enumerables:
161
+
162
+ _dl.colors red: '#F00', green: '#0F0', blue: '#00F' do |color, hex|
163
+ _dt color.to_s
164
+ _dd hex
165
+ end
166
+
160
167
  Basic interface
161
168
  ---
162
169
 
@@ -246,11 +246,17 @@ module Wunderbar
246
246
  @spaced = false
247
247
  end
248
248
 
249
- node.text = args.first if String === args.first
249
+ node.text = args.shift if String === args.first
250
250
  @node.add_child node
251
251
  @node = node
252
252
  if block
253
- block.call(self)
253
+ if args.first and args.first.respond_to? :each and block.arity != 0
254
+ args.shift.each do |arg|
255
+ block.call(arg)
256
+ end
257
+ else
258
+ block.call(self)
259
+ end
254
260
  @node.children << nil if @node.children.empty?
255
261
  end
256
262
 
@@ -383,7 +389,9 @@ module Wunderbar
383
389
 
384
390
  def encode(&block)
385
391
  set_variables_from_params
386
- self.instance_eval(&block)
392
+ before = @_target.string
393
+ result = self.instance_eval(&block)
394
+ _ result if before.empty? and result and @_target.string == before
387
395
  @_target.string
388
396
  end
389
397
 
@@ -444,7 +452,9 @@ module Wunderbar
444
452
 
445
453
  def encode(&block)
446
454
  set_variables_from_params
447
- self.instance_eval(&block)
455
+ before = @_target.dup
456
+ result = self.instance_eval(&block)
457
+ _! result if before.empty? and result and @_target == before
448
458
  @_target
449
459
  end
450
460
 
@@ -30,7 +30,8 @@ module Wunderbar
30
30
  attrs[:class] = id_or_class
31
31
  end
32
32
 
33
- if args.last.respond_to? :to_hash
33
+ iterable = block and block.arity != 0
34
+ if args.last.respond_to? :to_hash and not iterable
34
35
  hash = args.pop.to_hash
35
36
  if attrs[:class] and hash[:class]
36
37
  hash[:class] = "#{attrs[:class]} #{hash[:class]}"
@@ -296,6 +296,7 @@ module Wunderbar
296
296
  end
297
297
 
298
298
  def _ul(*args, &block)
299
+ return super if block
299
300
  iterable = args.first.respond_to? :each
300
301
  if iterable and (args.length > 1 or not args.first.respond_to? :to_hash)
301
302
  list = args.shift.dup
@@ -306,6 +307,7 @@ module Wunderbar
306
307
  end
307
308
 
308
309
  def _ol(*args, &block)
310
+ return super if block
309
311
  iterable = args.first.respond_to? :each
310
312
  if iterable and (args.length > 1 or not args.first.respond_to? :to_hash)
311
313
  list = args.shift
@@ -316,6 +318,7 @@ module Wunderbar
316
318
  end
317
319
 
318
320
  def _tr(*args, &block)
321
+ return super if block
319
322
  iterable = args.first.respond_to? :each
320
323
  if iterable and (args.length > 1 or not args.first.respond_to? :to_hash)
321
324
  list = args.shift
@@ -148,7 +148,7 @@ module Wunderbar
148
148
  end
149
149
  end
150
150
 
151
- class CommentNode
151
+ class CommentNode < Node
152
152
  def initialize(text)
153
153
  @text = text
154
154
  end
@@ -159,7 +159,7 @@ module Wunderbar
159
159
  end
160
160
  end
161
161
 
162
- class DocTypeNode
162
+ class DocTypeNode < Node
163
163
  def initialize(*args)
164
164
  @declare = args.shift
165
165
  @name = args.shift
@@ -29,6 +29,7 @@ module Wunderbar
29
29
  else
30
30
  node.binding = binding
31
31
  end
32
+ node
32
33
  else
33
34
  super
34
35
  end
@@ -1,8 +1,8 @@
1
1
  module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 22
5
- TINY = 4
4
+ MINOR = 23
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/wunderbar.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "wunderbar"
5
- s.version = "0.22.4"
5
+ s.version = "0.23.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Ruby"]
9
- s.date = "2015-01-23"
9
+ s.date = "2015-02-02"
10
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
11
  s.email = "rubys@intertwingly.net"
12
12
  s.files = ["wunderbar.gemspec", "README.md", "COPYING", "lib/wunderbar.rb", "lib/wunderbar", "lib/wunderbar/script.rb", "lib/wunderbar/jquery.rb", "lib/wunderbar/underscore.rb", "lib/wunderbar/polymer.rb", "lib/wunderbar/jquery", "lib/wunderbar/jquery/filter.rb", "lib/wunderbar/jquery/stupidtable.rb", "lib/wunderbar/vendor", "lib/wunderbar/vendor/polymer-v0.0.20131003.min.js", "lib/wunderbar/vendor/stupidtable.min.js", "lib/wunderbar/vendor/bootstrap.min.js", "lib/wunderbar/vendor/Markdown.Converter.js", "lib/wunderbar/vendor/angular.min.js", "lib/wunderbar/vendor/bootstrap-theme.min.css", "lib/wunderbar/vendor/jquery-1.11.0.min.js", "lib/wunderbar/vendor/angular-resource.min.js", "lib/wunderbar/vendor/bootstrap.min.css", "lib/wunderbar/vendor/underscore-min.js", "lib/wunderbar/vendor/angular-route.min.js", "lib/wunderbar/websocket.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/pagedown.rb", "lib/wunderbar/version.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/server.rb", "lib/wunderbar/angularjs.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/asset.rb", "lib/wunderbar/backtick.rb", "lib/wunderbar/opal", "lib/wunderbar/opal/browser.rb", "lib/wunderbar/opal/jquery.rb", "lib/wunderbar/coffeescript.rb", "lib/wunderbar/markdown.rb", "lib/wunderbar/opal.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/bootstrap.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/sinatra.rb", "lib/wunderbar/rails.rb", "lib/wunderbar/angularjs", "lib/wunderbar/angularjs/resource.rb", "lib/wunderbar/angularjs/route.rb", "lib/wunderbar/rack.rb", "lib/wunderbar/coderay.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/bootstrap", "lib/wunderbar/bootstrap/theme.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/node.rb"]
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.22.4
4
+ version: 0.23.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-23 00:00:00.000000000 Z
12
+ date: 2015-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json