roda-component 0.1.65 → 0.1.66

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0c512ecac4ecf7a3b0274e5c52becace09c1e69
4
- data.tar.gz: d7171c6866fffed0dea124e208765b83cd3dd4e8
3
+ metadata.gz: 23c5468778c982bcaa2ccfce82c5172a4e74e1f8
4
+ data.tar.gz: 82aa7a44b790a0861f9ab6a71181219465ee5693
5
5
  SHA512:
6
- metadata.gz: e3929aae6ee8227aa3bcdf06048cf179fccbd1a0c8c77e2babbd7ac7f5ae9d90f2c60a76ba73696b7a8db4835032780a809c72672072d66107a3720276c031e3
7
- data.tar.gz: 70889b0ca0c6bf642535d3af62a77e3f359ce40f8c7d96ad858eb4a6fc95f86d436063772a380224f76ea27f506a186e75a33d1bf6eebf5996e433cef44521fd
6
+ metadata.gz: 6e824c8d84f59329bc3223f3aaa939ea6d53d9d33b5afbc2f2986a9ac8b6e3af41d195a16fb7e4c28beab7986097bef992cdbf4dd156a48530801692680f4347
7
+ data.tar.gz: 5d19cb6664d78019e88c471d6ebb2cc68e86d762464908dcb0ab97d603572b15e70807b02242625853b1a148af7a1faca9a227dff3d3e23b9ac0d9728a61b72d
@@ -31,16 +31,18 @@ unless RUBY_ENGINE == 'opal'
31
31
  module Nokogiri
32
32
  module XML
33
33
  class NodeSet
34
- # alias_method :original_to_xhtml, :to_xhtml
35
- # def to_xhtml *args
36
- # original_to_xhtml(*args).gsub("
", "\r")
37
- # end
34
+ # fix: this is really shity
35
+ alias_method :original_to_html, :to_html
36
+ def to_html *args
37
+ original_to_html(*args).gsub(/%7B(|;)/, "{").gsub(/%7D(|;)/, "}")
38
+ end
38
39
  end
39
40
  class Node
40
- # alias_method :original_to_xhtml, :to_xhtml
41
- # def to_xhtml *args
42
- # original_to_xhtml(*args).gsub("
", "\r")
43
- # end
41
+ # fix: this is really shity
42
+ alias_method :original_to_html, :to_html
43
+ def to_html *args
44
+ original_to_html(*args).gsub(/%7B(|;)/, "{").gsub(/%7D(|;)/, "}")
45
+ end
44
46
 
45
47
  private
46
48
 
@@ -271,7 +273,7 @@ class Roda
271
273
  cache[:html] = yield
272
274
  end
273
275
 
274
- cache[:html] = cache[:html].gsub("\r\n", "\n")
276
+ cache[:html] = cache[:html]
275
277
  cache[:dom] = DOM.new(cache[:html])
276
278
  end
277
279
  end
@@ -341,7 +343,7 @@ class Roda
341
343
  def tmpl name, dom = false, remove = true
342
344
  if dom
343
345
  cache[:tmpl][name] = { dom: remove ? dom.remove : dom }
344
- cache[:tmpl][name][:html] = cache[:tmpl][name][:dom].to_xhtml
346
+ cache[:tmpl][name][:html] = cache[:tmpl][name][:dom].to_html
345
347
  cache[:tmpl][name]
346
348
  elsif t = cache[:tmpl][name]
347
349
  DOM.new t[:html]
@@ -389,7 +391,7 @@ class Roda
389
391
  def dom
390
392
  if server?
391
393
  # TODO: duplicate cache[:dom] so we don't need to parse all the html again
392
- @_dom ||= DOM.new(cache[:dom].dom.to_xhtml)
394
+ @_dom ||= DOM.new(cache[:dom].dom.to_html)
393
395
  else
394
396
  @_dom ||= DOM.new(Element)
395
397
  end
@@ -123,7 +123,7 @@ class Roda
123
123
  response = Component::Instance.new(component(comp), scope).instance_exec options, &block
124
124
 
125
125
  if response.is_a? Roda::Component::DOM
126
- content = response.to_xhtml
126
+ content = response.to_html
127
127
  else
128
128
  content = response
129
129
  end
@@ -224,7 +224,7 @@ class Roda
224
224
  if client?
225
225
  field_error_dom = DOM.new(`#{tmpl.dom}[0].outerHTML`)
226
226
  else
227
- field_error_dom = DOM.new(tmpl.dom.to_xhtml)
227
+ field_error_dom = DOM.new(tmpl.dom.to_html)
228
228
  end
229
229
  else
230
230
  field_error_dom = DOM.new('<span class="field-error"><span>')
@@ -1,5 +1,5 @@
1
1
  class Roda
2
2
  class Component
3
- VERSION = "0.1.65"
3
+ VERSION = "0.1.66"
4
4
  end
5
5
  end
@@ -64,7 +64,7 @@ class Roda
64
64
  end
65
65
 
66
66
  def loaded_component_js
67
- request.env['loaded_component_js'] ||= []
67
+ request ? (request.env['loaded_component_js'] ||= []) : (@_loaded_component_js ||= [])
68
68
  end
69
69
 
70
70
  def load_component name, options = {}
@@ -183,7 +183,7 @@ class Roda
183
183
  load_component_js comp, action, options
184
184
 
185
185
  if js && comp_response.is_a?(Roda::Component::DOM)
186
- comp_response = comp_response.to_xhtml
186
+ comp_response = comp_response.to_html
187
187
  end
188
188
 
189
189
  if comp_response.is_a?(String) && js
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.65
4
+ version: 0.1.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj