curlybars 1.16.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f619e784013f3883b1d83de6eb87571735acb5b6faa6d69a06d39cd6cb9e08e1
4
- data.tar.gz: d92f0c219304362b6dc2fcd7da9a86514845c85e29baaf2e42d1bff3350c2b79
3
+ metadata.gz: a8897a8516ee71758de87ec45acd0dcf0f177ef5e69470dcbc4e81004f57fb26
4
+ data.tar.gz: 5948e415e943ff80c52fa5a756259bdda63b8943c10b77eda9bae650e384fe14
5
5
  SHA512:
6
- metadata.gz: 7387d7660aae860841e279c0e4fcfb46e331baa464e446e7068c0769e8f234fba368ce0d9fcef065dbc7aa39054ddb0dc9877039033868b5b3e6f617719b9d99
7
- data.tar.gz: 47c78cce53d8b3176b5cfeb2efca2bb3937f3eb0f530b6424595c977576169c15d36c9aab496c2c0fead59c4144a8ba3551ade4a5faecf96d355ac4a40a12e84
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
- errors.concat(Array(path.validate(branches, check_type: :partial)))
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Curlybars
4
- VERSION = '1.16.1.pre'
4
+ VERSION = '1.16.1.pre.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curlybars
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.1.pre
4
+ version: 1.16.1.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Libo Cannici