ahc 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ahcx_template_handler.rb +11 -8
- metadata +1 -1
@@ -5,13 +5,7 @@ class AhcxTemplateHandler
|
|
5
5
|
def self.call(template)
|
6
6
|
erb = ActionView::Template.registered_template_handler(:erb)
|
7
7
|
source = erb.call(template)
|
8
|
-
|
9
|
-
ahcx = Nokogiri.parse(ahcx_source)
|
10
|
-
content = ''
|
11
|
-
ahcx.children.first.children.each do |node|
|
12
|
-
content += node_content(node)
|
13
|
-
end
|
14
|
-
content.inspect
|
8
|
+
source + ";AhcxTemplateHandler.render(@output_buffer.to_s)"
|
15
9
|
end
|
16
10
|
|
17
11
|
def self.node_content(node)
|
@@ -36,5 +30,14 @@ class AhcxTemplateHandler
|
|
36
30
|
Ahc.render(tag, params)
|
37
31
|
end
|
38
32
|
|
39
|
-
|
33
|
+
def self.render(xml)
|
34
|
+
ahcx_source = "<document>#{xml}</document>"
|
35
|
+
ahcx = Nokogiri.parse(ahcx_source)
|
36
|
+
content = ''
|
37
|
+
ahcx.children.first.children.each do |node|
|
38
|
+
content += node_content(node)
|
39
|
+
end
|
40
|
+
content
|
41
|
+
end
|
40
42
|
|
43
|
+
end
|