opulent 1.4.6 → 1.4.7
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/opulent/parser.rb +4 -0
- data/lib/opulent/parser/define.rb +1 -3
- data/lib/opulent/parser/node.rb +4 -2
- data/lib/opulent/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c8acd296b42eefdc3b2e9fb0a558e6a30a236b1
|
4
|
+
data.tar.gz: 23878031df261bc6e3379318ebac323b9293654b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33463ff92a452d7c9d8bdc399c6cb3ea26b0bd51b981b187def57d6b66970449a157e40463f83642d596336030ac04fba6cf21effb6a0d69bd61f1ac200f0290
|
7
|
+
data.tar.gz: 756bd4620c6cb515357926ac658cfe666eccdb8423a2a739c190c3ae38defbcb6637ed22b928b9037cb35fc233046cf22f5408f4d0a4950459339c7740b57c97
|
data/lib/opulent/parser.rb
CHANGED
@@ -35,6 +35,10 @@ module Opulent
|
|
35
35
|
# be used with the last parent path found
|
36
36
|
@file = [[file, -1]]
|
37
37
|
|
38
|
+
# Create a definition stack to disallow recursive calls. When inside a
|
39
|
+
# definition and a named node is called, we render it as a plain node
|
40
|
+
@definition_stack = []
|
41
|
+
|
38
42
|
# Initialize definitions for the parser
|
39
43
|
@definitions = definitions
|
40
44
|
end
|
@@ -24,9 +24,7 @@ module Opulent
|
|
24
24
|
# Set definition as root node and let the parser know that we're inside
|
25
25
|
# a definition. This is used because inside definitions we do not process
|
26
26
|
# nodes (we do not check if they are have a definition or not).
|
27
|
-
|
28
|
-
root(definition, indent)
|
29
|
-
@inside_definition = nil
|
27
|
+
root definition, indent
|
30
28
|
|
31
29
|
# Add to parent
|
32
30
|
@definitions[name] = definition
|
data/lib/opulent/parser/node.rb
CHANGED
@@ -80,8 +80,10 @@ module Opulent
|
|
80
80
|
|
81
81
|
# Create a clone of the definition model. Cloning the options is also
|
82
82
|
# necessary because it's a shallow copy
|
83
|
-
if @
|
83
|
+
if @definitions.keys.include?(node_name)
|
84
|
+
@definition_stack << node_name
|
84
85
|
parent[@children] << process_definition(node_name, current_node)
|
86
|
+
@definition_stack.pop
|
85
87
|
else
|
86
88
|
parent[@children] << current_node
|
87
89
|
end
|
@@ -111,7 +113,7 @@ module Opulent
|
|
111
113
|
def process_definition_child(node)
|
112
114
|
node[@children].map! do |child|
|
113
115
|
if child[@type] == :node
|
114
|
-
if @definitions.keys.include?
|
116
|
+
if !@definition_stack.include?(node[@value]) && @definitions.keys.include?(child[@value])
|
115
117
|
process_definition child[@value], child
|
116
118
|
else
|
117
119
|
process_definition_child child if child[@children]
|
data/lib/opulent/version.rb
CHANGED