ahc 0.2.6 → 0.2.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.
Files changed (2) hide show
  1. data/lib/ahcx_template_handler.rb +2 -13
  2. metadata +1 -1
@@ -3,10 +3,6 @@ require 'htmlcompressor'
3
3
 
4
4
  class AhcxTemplateHandler
5
5
 
6
- ESCAPED_SYMBOLS = {
7
- '&' => '(|escapeahx|and|)'
8
- }
9
-
10
6
  def self.call(template)
11
7
  erb = ActionView::Template.registered_template_handler(:erb)
12
8
  source = erb.call(template)
@@ -21,9 +17,8 @@ class AhcxTemplateHandler
21
17
  end
22
18
  node.children.each do |child_node|
23
19
  child_node_tag, child_node_attr = child_node.name.split(':')
24
- raw = child_node.attributes['raw']
25
- if raw || (child_node.children.length == 1 && child_node.children.first.name == 'text')
26
- params[child_node_attr] = child_node.children.to_html(:encoding => 'utf-8')
20
+ if child_node.children.length == 1 && child_node.children.first.name == 'text'
21
+ params[child_node_attr] = child_node.children.text
27
22
  else
28
23
  attr_value = ''
29
24
  child_node.children.each do |inside_node|
@@ -33,17 +28,11 @@ class AhcxTemplateHandler
33
28
  end
34
29
  end
35
30
  html = Ahc.render(tag, params)
36
- ESCAPED_SYMBOLS.each do |sym, escaped_sym|
37
- html.gsub!(escaped_sym, sym)
38
- end
39
31
  html
40
32
  end
41
33
 
42
34
  def self.render(xml)
43
35
  ahcx_source = "<document>#{xml}</document>"
44
- ESCAPED_SYMBOLS.each do |sym, escaped_sym|
45
- ahcx_source.gsub!(sym, escaped_sym)
46
- end
47
36
  ahcx = Nokogiri::XML.parse(ahcx_source)
48
37
  content = ''
49
38
  ahcx.children.first.children.each do |node|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: