relaton-render 0.5.6 → 0.5.7

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: f0f0cf15017a8c117f7a8fde7567564f61138760cfeb89b506e5c2848ff6899d
4
+ data.tar.gz: 2d5bdd64aeb924e67b2c4f823e60033a1a51018542deb4596f32533038919e00
5
5
  SHA512:
6
- metadata.gz: de6bd46639d0419f4c271fe451768e10be23d044f8d0957c2659412461052ff6a8ca34de7b8e23fa73fcc569ef8bb72da90f4fdb8d7aec9d40f9489dad2cf5a9
7
- data.tar.gz: 27d0c9a160d2d784272a71d15d335f1e882ffac41d25c81af084e8fe624356dfd4a4098041ad6ac43977d7eb5a25398efb65c68ce51fca7dd37bfd5e5a7482cd
6
+ metadata.gz: 2f05f38566cf4f94bad2152db2cb2c71c0d2f2a63939c7bac0039fbaa0e21314aba6288640ec9a7c1248b6548342ba21ccff47e0b360902055ed1f026f52eabc
7
+ data.tar.gz: e787ce6357bfd515b9d7a975027f798ec027fa2845a6495ea53c0c2032abb8e90f7881736bf1f0c947cf30e0b82e5aeb259ba9f9f20877823828cc6c3d987277
@@ -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.7".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.7
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-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler