wunderbar 0.10.6 → 0.10.7

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.
@@ -239,18 +239,40 @@ class HtmlMarkup < Wunderbar::BuilderBase
239
239
  else
240
240
  @x.indented_text! text.strip
241
241
  end
242
- else
243
- if self.class.flatten? child.children
242
+ elsif self.class.flatten? child.children
243
+ block_element = Proc.new do |node|
244
+ node.element? and HTML5_BLOCK.include?(node.name)
245
+ end
246
+
247
+ if child.children.any?(&block_element)
248
+ # indent children, but disable indentation on consecutive
249
+ # sequences of non-block-elements. Put another way: break
250
+ # out block elements to a new line.
251
+ @x.tag!(child.name, child.attributes) do
252
+ children = child.children.to_a
253
+ while not children.empty?
254
+ stop = children.index(&block_element)
255
+ if stop == 0
256
+ _import! [children.shift]
257
+ else
258
+ @x.disable_indentation! do
259
+ _import! children.shift(stop || children.length)
260
+ end
261
+ end
262
+ end
263
+ end
264
+ else
265
+ # disable indentation on the entire element
244
266
  @x.disable_indentation! do
245
267
  @x.tag!(child.name, child.attributes) {_import! child.children}
246
268
  end
247
- elsif child.children.empty?
248
- @x.tag!(child.name, child.attributes)
249
- elsif child.children.all? {|gchild| gchild.text?}
250
- @x.tag!(child.name, child.text.strip, child.attributes)
251
- else
252
- @x.tag!(child.name, child.attributes) {_import! child.children}
253
269
  end
270
+ elsif child.children.empty?
271
+ @x.tag!(child.name, child.attributes)
272
+ elsif child.children.all? {|gchild| gchild.text?}
273
+ @x.tag!(child.name, child.text.strip, child.attributes)
274
+ else
275
+ @x.tag!(child.name, child.attributes) {_import! child.children}
254
276
  end
255
277
  end
256
278
  end
@@ -2,7 +2,7 @@ module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 10
5
- TINY = 6
5
+ TINY = 7
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.10.6"
5
+ s.version = "0.10.7"
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 = "2012-04-16"
9
+ s.date = "2012-04-17"
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/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/cgi-methods.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/version.rb"]
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: 59
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 6
10
- version: 0.10.6
9
+ - 7
10
+ version: 0.10.7
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-16 00:00:00 Z
18
+ date: 2012-04-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder