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