tina4ruby 3.9.2 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tina4/template.rb +10 -1
- data/lib/tina4/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b43c80adf7c00f71f0c14d64b4660f612b0124008b6a4821f431bae1d25c88d8
|
|
4
|
+
data.tar.gz: ca4230e2b17265849c05e5118c095f7359a7728036e299dc2813a56c53f85c47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8200644fd078c8c4cb635610bef5392daddda3f86d1d7366973d16ffbd9457eb9e710db6cba8430384ff6b052b55dbbff0129c3ca31f878e067aab608e053ed0
|
|
7
|
+
data.tar.gz: 900b1b9f2fa791c1ebfcd5f0e492d73ade490c7c48126d3b2b1ff71f5d6a41ae8991552d69ae2ae3b4bdbff884a6aebfd3f37d01b6fa2bb163d2779dea53a19d
|
data/lib/tina4/template.rb
CHANGED
|
@@ -142,6 +142,14 @@ module Tina4
|
|
|
142
142
|
@parent_template = nil
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
+
# Reset context and blocks for reuse (avoids creating new instances in loops)
|
|
146
|
+
def reset_context(context)
|
|
147
|
+
@context = context
|
|
148
|
+
@blocks = {}
|
|
149
|
+
@parent_template = nil
|
|
150
|
+
self
|
|
151
|
+
end
|
|
152
|
+
|
|
145
153
|
def render(content)
|
|
146
154
|
content = process_extends(content)
|
|
147
155
|
content = process_blocks(content)
|
|
@@ -226,6 +234,7 @@ module Tina4
|
|
|
226
234
|
when Integer then (0...collection).to_a
|
|
227
235
|
else []
|
|
228
236
|
end
|
|
237
|
+
sub_engine = TwigEngine.new({}, @base_dir)
|
|
229
238
|
items.each_with_index do |item, index|
|
|
230
239
|
loop_context = @context.dup
|
|
231
240
|
loop_context["loop"] = {
|
|
@@ -241,7 +250,7 @@ module Tina4
|
|
|
241
250
|
else
|
|
242
251
|
loop_context[key_or_val] = item
|
|
243
252
|
end
|
|
244
|
-
sub_engine
|
|
253
|
+
sub_engine.reset_context(loop_context)
|
|
245
254
|
output << sub_engine.render(body)
|
|
246
255
|
end
|
|
247
256
|
output
|
data/lib/tina4/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tina4ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tina4 Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|