wunderbar 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2M4ZjRjOWU4YmY0NjlmYzU2MzA3ZmFhYzczNWEzNmU0MmY2MmY4YQ==
4
+ Y2JmMTZlN2Y1ZDRlNzcxNGVkNTc5NGRkZGNkMDY2ZTA1NGU2ZGU1OA==
5
5
  data.tar.gz: !binary |-
6
- YzQyNzI2MWNmMzJjYTFiZDE5MWFkYWYxOWY2ODI3NGFlZjc0MTYwZg==
6
+ MWE5MjgwOWJjZjNjZDQxMmEzNmZiNzhmZjFhY2E1OGMxM2VmMDkwOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YjFkYzZmOWRlZGE0ZTIxYzM1ZDgxNjFhZWRkOTEwMTBjNTNlYzNhYjQ5ZjQ0
10
- NGI0NGIyMmQzODUxODUwNjY2NjExYjM0NjE5NTc2MWQ4NTY3MDY5YTViYmVh
11
- NjFkYTVkMGQwM2MzODJlNjgxYjQwODU3ZDkwYjU0Nzc1ZDYzNDM=
9
+ MWRkNTFmYWI4ZjNhNDE0YjUzYjhiMGMxZWZiMzM4YWM2ODEyNjAwYzM0OTBl
10
+ MGFkMzg1Zjc2YTg5MGFiOTZlMTcyNGM5NTVmYjYwZmZiODYzMzJjMzRlOTI5
11
+ NDUwOGI4MWE3N2E4MDNmOGQ5YjJjYTY3Mjc1NDJjNGY1NmYyMzE=
12
12
  data.tar.gz: !binary |-
13
- NTBjZWZhY2U5M2VhZDQ0ODM2N2Y1ZGVjZDUyMzQ0ZTgyYWJmYzI5ZTNiZjI2
14
- ODI1MTRjMDVmMTI3MWNmYmQ2ZTQ3MjRmMzRhNDUzOTIyZTJlMzFhNGIzZWQ1
15
- Y2UyMDg5OTI0ZTFmY2E3M2I4ZTdhMDMzYWRjYWU1ODMwYTFiNjE=
13
+ NjUzMGFlYzIxOGFjYWI5OTA4MzBlZGEwYjNmOGNiOTc1NTA1ZDhjM2JlNjYx
14
+ OTA4MmJkYzIzNjI1ODUxMDU0MDcyNGNlZWRhMDY1ZDY5OTQ5YmE1YmQwNGU4
15
+ YzdlMWY5NjZlY2E4N2YzODhkNDliNjUyMmVlYzVjZmQ2NmRlNWI=
@@ -87,25 +87,26 @@ module Wunderbar
87
87
  @@stylesheets << self.new(options)
88
88
  end
89
89
 
90
- def self.declarations
91
- Proc.new do
92
- @@scripts.each do |script|
93
- if script.path
94
- _script src: "#{Asset.path}/#{script.path}"
95
- elsif script.contents
96
- _script script.contents
97
- end
90
+ def self.declarations(parent, base)
91
+ path = base.to_s.sub(/^\//,'').split('/').map {'../'}.join + Asset.path
92
+ nodes = []
93
+ @@scripts.each do |script|
94
+ if script.path
95
+ nodes << Node.new(:script, src: "#{path}/#{script.path}")
96
+ elsif script.contents
97
+ nodes << ScriptNode.new(:script, script.contents)
98
98
  end
99
+ end
99
100
 
100
- @@stylesheets.each do |stylesheet|
101
- if stylesheet.path
102
- _link rel: "stylesheet", href: "#{Asset.path}/#{stylesheet.path}",
103
- type: "text/css"
104
- elsif stylesheet.contents
105
- _style stylesheet.contents
106
- end
101
+ @@stylesheets.each do |stylesheet|
102
+ if stylesheet.path
103
+ nodes << Node.new(:link, rel: "stylesheet", type: "text/css",
104
+ href: "#{path}/#{stylesheet.path}")
105
+ elsif stylesheet.contents
106
+ nodes << StyleNode.new(:style, stylesheet.contents)
107
107
  end
108
108
  end
109
+ nodes.each {|node| node.parent = parent}
109
110
  end
110
111
  end
111
112
  end
@@ -50,11 +50,11 @@ module Wunderbar
50
50
  end
51
51
  proxy
52
52
  elsif SpacedNode === @node
53
- @builder.__send__ "_#{@node.name}_", *args, &block
53
+ @builder.__send__ "_#{@node.name.to_s.gsub('-', '_')}_", *args, &block
54
54
  elsif CompactNode === @node and @node.name != :pre
55
- @builder.__send__ "_#{@node.name}!", *args, &block
55
+ @builder.__send__ "_#{@node.name.to_s.gsub('-', '_')}!", *args, &block
56
56
  else
57
- @builder.__send__ "_#{@node.name}", *args, &block
57
+ @builder.__send__ "_#{@node.name.to_s.gsub('-', '_')}", *args, &block
58
58
  end
59
59
  end
60
60
  end
@@ -110,6 +110,15 @@ module Wunderbar
110
110
  head.add_child Node.new('title', h1.text) if h1 and h1.text
111
111
  end
112
112
 
113
+ base = head.children.index {|child| child.name == 'base'}
114
+ if base
115
+ head.children.insert 1, head.children.delete_at(base) if base > 1
116
+ base_href = head.children[1].attrs[:href]
117
+ head.children.insert 2, *Asset.declarations(head, base_href)
118
+ else
119
+ head.children.insert 1, *Asset.declarations(head, nil)
120
+ end
121
+
113
122
  title = head.children.index {|child| child.name == 'title'}
114
123
  if title and title > 1
115
124
  head.children.insert 1, head.children.delete_at(title)
@@ -234,7 +243,6 @@ module Wunderbar
234
243
  def _head(*args, &block)
235
244
  tag!('head', *args) do
236
245
  tag! :meta, :charset => 'utf-8'
237
- instance_eval &Wunderbar::Asset.declarations
238
246
  block.call if block
239
247
  end
240
248
  end
@@ -63,7 +63,7 @@ module Wunderbar
63
63
  "column: #{location.column}\n#{exception}\n"
64
64
  rescue ::Exception => exception
65
65
  headers['status'] = "500 Internal Server Error"
66
- output = "// Internal Server Error\n#{exception}\n"
66
+ output = "// Internal Server Error: #{exception}\n"
67
67
  exception.backtrace.each do |frame|
68
68
  next if CALLERS_TO_IGNORE.any? {|re| frame =~ re}
69
69
  output += " #{frame}\n"
@@ -86,15 +86,16 @@ module Wunderbar
86
86
  rescue Parser::SyntaxError => exception
87
87
  scope.response.status = 500
88
88
  location = exception.diagnostic.location
89
- "// Syntax Error: line #{location.line}, column: #{location.column}" +
89
+ "Syntax Error: line #{location.line}, column: #{location.column}" +
90
90
  "\n#{exception}\n"
91
91
  rescue Exception => exception
92
92
  scope.response.status = 500
93
- output = "// Internal Server Error\n#{exception}\n"
93
+ output = "Internal Server Error: #{exception}\n"
94
94
  exception.backtrace.each do |frame|
95
95
  next if CALLERS_TO_IGNORE.any? {|re| frame =~ re}
96
96
  output += " #{frame}\n"
97
97
  end
98
+ output
98
99
  end
99
100
  end
100
101
  end
@@ -2,7 +2,7 @@ module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 20
5
- TINY = 0
5
+ TINY = 1
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.20.0"
5
+ s.version = "0.20.1"
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 = "2014-01-07"
9
+ s.date = "2014-01-18"
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/logger.rb", "lib/wunderbar/coderay.rb", "lib/wunderbar/rails.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/coffeescript.rb", "lib/wunderbar/vendor", "lib/wunderbar/vendor/polymer-v0.0.20131003.min.js", "lib/wunderbar/vendor/bootstrap.min.js", "lib/wunderbar/vendor/angular-resource.min.js", "lib/wunderbar/vendor/jquery-1.10.2.min.js", "lib/wunderbar/vendor/Markdown.Converter.js", "lib/wunderbar/vendor/bootstrap-theme.min.css", "lib/wunderbar/vendor/angular-route.min.js", "lib/wunderbar/vendor/angular.min.js", "lib/wunderbar/vendor/stupidtable.min.js", "lib/wunderbar/vendor/bootstrap.min.css", "lib/wunderbar/markdown.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/pagedown.rb", "lib/wunderbar/server.rb", "lib/wunderbar/polymer.rb", "lib/wunderbar/version.rb", "lib/wunderbar/node.rb", "lib/wunderbar/asset.rb", "lib/wunderbar/script.rb", "lib/wunderbar/websocket.rb", "lib/wunderbar/bootstrap.rb", "lib/wunderbar/jquery", "lib/wunderbar/jquery/stupidtable.rb", "lib/wunderbar/angularjs", "lib/wunderbar/angularjs/route.rb", "lib/wunderbar/angularjs/resource.rb", "lib/wunderbar/opal", "lib/wunderbar/opal/browser.rb", "lib/wunderbar/opal/jquery.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/angularjs.rb", "lib/wunderbar/jquery.rb", "lib/wunderbar/bootstrap", "lib/wunderbar/bootstrap/theme.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/sinatra.rb", "lib/wunderbar/rack.rb", "lib/wunderbar/opal.rb", "lib/wunderbar/installation.rb"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wunderbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-07 00:00:00.000000000 Z
11
+ date: 2014-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json