Commit 3e85d883d2351971157c23cc137d0cab3d85d72f

Authored by Karpikau Andrei
1 parent 4bb53393

solution for use p element

... ... @@ -96,13 +96,14 @@ module Kanjai
96 96
97 97
98 98 end
99   -
100 99 (0..1).each do |index|
101 100 layer.scan(/(<element name="([\w\W]+?)"><\/element>)/).each do |item|
102 101 content = item[0]
103 102 name = item[1]
104 103 code = name.parameterize
105 104
  105 + p content
  106 +
106 107 template_part = page_template.template_parts.find_by_code(code)
107 108
108 109 if template_part
... ...
... ... @@ -42,7 +42,6 @@ module Kanjai
42 42 def get_html_by_json_client(page_data)
43 43 json_data = page_data.template_content
44 44 html = ''
45   -
46 45 #row_template = File.open("#{Rails.root}/app/view/kanjai/pages/templates/row.html.erb").read
47 46 #cell_template = File.open("#{Rails.root}/app/view/kanjai/pages/templates/cell.html.erb").read
48 47
... ...
... ... @@ -3,7 +3,6 @@ module Kanjai
3 3 def self.subpart_generate(page_template, type, elements, hash_value = nil, page_content_id = nil)
4 4 @doc = Nokogiri::HTML::DocumentFragment.parse ""
5 5
6   -
7 6 @original_hash_value = hash_value
8 7 @original_hash_value ||= {}
9 8
... ... @@ -234,6 +233,10 @@ module Kanjai
234 233 subparts.select(attributes) do |next_subparts|
235 234 self.content_generator(item[:children], next_subparts, hash_value)
236 235 end
  236 + elsif item[:name] == 'p'
  237 + if item[:children].count > 0
  238 + subparts.p(attributes, self.replace_text_marker(item[:children][0][:source], hash_value))
  239 + end
237 240 else
238 241 subparts.send(item[:name], attributes) do |next_subparts|
239 242 self.content_generator(item[:children], next_subparts, hash_value)
... ...
... ... @@ -25,9 +25,7 @@ module Kanjai
25 25
26 26 def find_subparts
27 27 result = []
28   - p '!!!!!!!'
29 28 @html_source.scan(/<!--###START element[\w\W]+?-->/).each do |item|
30   - p '!!!!!!!!!!!!!!'
31 29
32 30 name, type, code = item.scan(/<!--###START\s+element\(name="([^"]+)",\s+type="([\w\s]+)"\)\s+###/)[0]
33 31
... ...
1 1 module Kanjai
2   - VERSION = "0.0.172"
  2 + VERSION = "0.0.173"
3 3 end
... ...