relaton-render 0.5.6 → 0.5.8

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
  SHA256:
3
- metadata.gz: ca7bf47fcca9f20390105c3bd1168e9bfa9fa6e16289fc8155be3de4b1b9e5fb
4
- data.tar.gz: 6e2e6e8882405c484067bf2bf760af8a1aa84a2639583e2ea5e3ec4fe92d5683
3
+ metadata.gz: 57ebdb614711c3fdca1166a3017396ce04245c92cfb793940efdc9da6d3d4c6d
4
+ data.tar.gz: e548c4fb11f390c585eaa95c4d7ccc77111d9166ecdf4fad795fa2c4181990e0
5
5
  SHA512:
6
- metadata.gz: de6bd46639d0419f4c271fe451768e10be23d044f8d0957c2659412461052ff6a8ca34de7b8e23fa73fcc569ef8bb72da90f4fdb8d7aec9d40f9489dad2cf5a9
7
- data.tar.gz: 27d0c9a160d2d784272a71d15d335f1e882ffac41d25c81af084e8fe624356dfd4a4098041ad6ac43977d7eb5a25398efb65c68ce51fca7dd37bfd5e5a7482cd
6
+ metadata.gz: f8e53bff23c39d72ecb3d9167f92c9d6570d09148fdb5907fccbc018e974302e591101fe2e491014a6a4fbafff00960ae84de3a477ad6568416c02ab2274d15d
7
+ data.tar.gz: 6c699eaec0669e07ebb7ac9e1e43a2c31e7b303158d900117abe580fee599a8fde92409c861eca3e4c8b85c750bbab1141087d753dc9ac02be6fa7704871f58a
@@ -3,6 +3,7 @@ module Relaton
3
3
  class Parse
4
4
  def content(node)
5
5
  node.nil? and return node
6
+ node.content.is_a?(Array) and return node.content.map { |x| content(x) }
6
7
  node.content.strip
7
8
  end
8
9
 
@@ -49,6 +49,11 @@ module Relaton
49
49
  end
50
50
 
51
51
  def template_process(template)
52
+ template.is_a?(String) or return template
53
+ ::Liquid::Template.parse(add_field_delim_to_template(template))
54
+ end
55
+
56
+ def add_field_delim_to_template(template)
52
57
  t = template.split(/(\{\{|\}\})/).each_slice(4).map do |a|
53
58
  unless !a[2] || punct_field?(a[2]&.strip)
54
59
  a[1] = "#{FIELD_DELIM}{{"
@@ -56,9 +61,8 @@ module Relaton
56
61
  end
57
62
  a.join
58
63
  end.join.gsub(/\t/, " ")
59
- t1 = t.gsub(/\}\}#{FIELD_DELIM}\|/o, "}}#{FIELD_DELIM}\t")
64
+ t.gsub(/\}\}#{FIELD_DELIM}\|/o, "}}#{FIELD_DELIM}\t")
60
65
  .gsub(/\|#{FIELD_DELIM}\{\{/o, "\t#{FIELD_DELIM}{{")
61
- ::Liquid::Template.parse(t1)
62
66
  end
63
67
 
64
68
  def render(hash)
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "0.5.6".freeze
3
+ VERSION = "0.5.8".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-render
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-10 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler