curlybars 1.16.0.pre → 1.16.1.pre.2
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/curlybars/node/partial.rb +34 -1
- data/lib/curlybars/version.rb +1 -1
- data/lib/curlybars.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8897a8516ee71758de87ec45acd0dcf0f177ef5e69470dcbc4e81004f57fb26
|
|
4
|
+
data.tar.gz: 5948e415e943ff80c52fa5a756259bdda63b8943c10b77eda9bae650e384fe14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41f73fbddd332bb54078bd45f74dd9eb93192d8707d943d9f72af8ca29da186ad85935bd5b113ddbe74b1f3084a15431c5a13b1145b57cfd1c2b3215624733b2
|
|
7
|
+
data.tar.gz: 3cee5f68d7ad53d3b948395e381f83465da70d7ec74a1cdc7bba37f8598ad212264698e8e675aff6925fb573710ab90cae58fb6e5d608570814c80c61b673fff
|
|
@@ -34,6 +34,15 @@ module Curlybars
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
if partial_source
|
|
37
|
+
if position.file_name == :"partials/#{path.path}"
|
|
38
|
+
errors << Curlybars::Error::Validate.new(
|
|
39
|
+
'self_referencing_partial',
|
|
40
|
+
"'#{path.path}' cannot reference itself",
|
|
41
|
+
position
|
|
42
|
+
)
|
|
43
|
+
return errors
|
|
44
|
+
end
|
|
45
|
+
|
|
37
46
|
options_tree = options.each_with_object({}) do |option, tree|
|
|
38
47
|
expr = option.expression
|
|
39
48
|
tree[option.key.to_sym] = if expr.respond_to?(:resolve)
|
|
@@ -53,10 +62,34 @@ module Curlybars
|
|
|
53
62
|
validation_context: context.increment_depth,
|
|
54
63
|
run_processors: false
|
|
55
64
|
)
|
|
65
|
+
inclusion_chain_entry = Curlybars::Position.new(
|
|
66
|
+
position.file_name,
|
|
67
|
+
position.line_number,
|
|
68
|
+
position.line_offset,
|
|
69
|
+
position.length
|
|
70
|
+
)
|
|
71
|
+
partial_errors.each do |e|
|
|
72
|
+
e.metadata[:inclusion_chain] = (e.metadata[:inclusion_chain] || []).push(inclusion_chain_entry)
|
|
73
|
+
end
|
|
56
74
|
errors.concat(partial_errors)
|
|
75
|
+
else
|
|
76
|
+
errors << Curlybars::Error::Validate.new(
|
|
77
|
+
'partial_nesting_limit_reached',
|
|
78
|
+
"'#{path.path}' exceeds the partial nesting limit of #{Curlybars.configuration.partial_nesting_limit}",
|
|
79
|
+
position
|
|
80
|
+
)
|
|
57
81
|
end
|
|
58
82
|
else
|
|
59
|
-
|
|
83
|
+
path_errors = Array(path.validate(branches, check_type: :partial))
|
|
84
|
+
if path_errors.any? && context&.partial_resolver
|
|
85
|
+
errors << Curlybars::Error::Validate.new(
|
|
86
|
+
'partial_not_found',
|
|
87
|
+
"'#{path.path}' partial could not be found",
|
|
88
|
+
position
|
|
89
|
+
)
|
|
90
|
+
else
|
|
91
|
+
errors.concat(path_errors)
|
|
92
|
+
end
|
|
60
93
|
end
|
|
61
94
|
|
|
62
95
|
errors
|
data/lib/curlybars/version.rb
CHANGED
data/lib/curlybars.rb
CHANGED
|
@@ -26,7 +26,7 @@ module Curlybars
|
|
|
26
26
|
#
|
|
27
27
|
# Returns a String containing the Ruby code.
|
|
28
28
|
def compile(source, identifier = nil)
|
|
29
|
-
cache_key = ["Curlybars.compile", identifier, Digest::SHA256.hexdigest(source)]
|
|
29
|
+
cache_key = ["Curlybars.compile", Curlybars::VERSION, identifier, Digest::SHA256.hexdigest(source)]
|
|
30
30
|
|
|
31
31
|
cache.fetch(cache_key) do
|
|
32
32
|
ast(transformed_source(source), identifier, run_processors: true).compile
|