opulent 1.4.1 → 1.4.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/benchmark/cases/node/node.haml +2 -2
- data/lib/opulent/compiler/buffer.rb +3 -3
- data/lib/opulent/compiler/define.rb +1 -55
- data/lib/opulent/utils.rb +1 -1
- 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: 7fbb64044a74d50242806f7da9884dc7fce9301c
|
4
|
+
data.tar.gz: 719f2346be0329264c72385421254681a30e4ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c9b17d6a8384411a954c1adef1129626475fc6a94e3b2eb65d3ed1caa0c57c5aaaeb5f4aba84d23bff867e47a1d690224d1eddfcdf768a6978f0d1f40e73499
|
7
|
+
data.tar.gz: 6906b5acebccf9a436527ba4644e4bfd5660be16f31dca80020a58438c11e5d6afe083a0ec95281b8269520df77e66a70189690a5f390d96524e01fe9df0bb47
|
@@ -63,7 +63,7 @@ module Opulent
|
|
63
63
|
#
|
64
64
|
def buffer_attributes_to_hash(attributes)
|
65
65
|
"{" + attributes.inject([]) do |extend_map, (key, attribute)|
|
66
|
-
extend_map << ("#{key}
|
66
|
+
extend_map << (":\"#{key}\" => " + if key == :class
|
67
67
|
'[' + attribute.map do |exp|
|
68
68
|
exp[@value]
|
69
69
|
end.join(", ") + ']'
|
@@ -181,8 +181,8 @@ module Opulent
|
|
181
181
|
# When we have an extension for our attributes, check current key.
|
182
182
|
# If it exists, check it's type and generate everything dynamically
|
183
183
|
if extension
|
184
|
-
buffer_eval "if #{extension}.has_key?
|
185
|
-
variable = buffer_set_variable :local, "#{extension}.delete(
|
184
|
+
buffer_eval "if #{extension}.has_key? :\"#{key}\""
|
185
|
+
variable = buffer_set_variable :local, "#{extension}.delete(:\"#{key}\")"
|
186
186
|
buffer_data_attribute_type_check[key, variable, attribute[@options][:escaped]]
|
187
187
|
buffer_eval "else"
|
188
188
|
end
|
@@ -18,7 +18,7 @@ module Opulent
|
|
18
18
|
|
19
19
|
# Create the definition
|
20
20
|
buffer_eval "instance_eval do"
|
21
|
-
buffer_eval "def #{key}(attributes = {}, &block)"
|
21
|
+
buffer_eval "def #{key}(attributes = {}, &block)"
|
22
22
|
|
23
23
|
# Set each parameter as a local variable
|
24
24
|
node[@options][:parameters].each do |parameter, value|
|
@@ -67,60 +67,6 @@ module Opulent
|
|
67
67
|
|
68
68
|
# End block
|
69
69
|
buffer_eval "end"
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# definition_context.parent = context
|
74
|
-
#
|
75
|
-
# # # Set call node
|
76
|
-
# # call_node = node[@options][:call]
|
77
|
-
# #
|
78
|
-
# # # Get call node attributes
|
79
|
-
# # attributes = call_node[@options][:attributes]
|
80
|
-
# #
|
81
|
-
# # Evaluate node extension in the current context
|
82
|
-
# if call_node[@options][:extension]
|
83
|
-
# extension = context.evaluate call_node[@options][:extension][@value]
|
84
|
-
# else
|
85
|
-
# extension = {}
|
86
|
-
# end
|
87
|
-
#
|
88
|
-
# # Evaluate and generate node attributes, then process each one to
|
89
|
-
# # by generating the required attribute code
|
90
|
-
# attributes = {}
|
91
|
-
# call_node[@options][:attributes].each do |key, attribute|
|
92
|
-
# unless node[@options][:parameters].has_key? key
|
93
|
-
# attributes[key] = map_attribute key, attribute, context
|
94
|
-
# end
|
95
|
-
# end
|
96
|
-
#
|
97
|
-
# # Go through each extension attribute and use the value where applicable
|
98
|
-
# extend_attributes attributes, extension
|
99
|
-
#
|
100
|
-
# # Definition call arguments
|
101
|
-
# arguments = {}
|
102
|
-
#
|
103
|
-
# # Extract values which appear as definition parameters. If we have the
|
104
|
-
# # key passed as argument, get its value. Otherwise, set the default
|
105
|
-
# # parameter value.
|
106
|
-
# #
|
107
|
-
# # Definition arguments (parameters which are set in definition header)
|
108
|
-
# # will be passed unescaped, to allow node definition to handle escaping
|
109
|
-
# # properly
|
110
|
-
# node[@options][:parameters].each do |key, value|
|
111
|
-
# if call_node[@options][:attributes].has_key? key
|
112
|
-
# arguments[key] = context.evaluate call_node[@options][:attributes][key][@value]
|
113
|
-
# else
|
114
|
-
# arguments[key] = definition_context.evaluate value[@value]
|
115
|
-
# end
|
116
|
-
# end
|
117
|
-
#
|
118
|
-
# # Set the remaining attributes as a value in the arguments
|
119
|
-
# arguments[:attributes] = attributes
|
120
|
-
|
121
|
-
|
122
|
-
# Remove last set of blocks from the block stack
|
123
|
-
@block_stack.pop
|
124
70
|
end
|
125
71
|
end
|
126
72
|
end
|
data/lib/opulent/utils.rb
CHANGED
@@ -25,7 +25,7 @@ module Opulent
|
|
25
25
|
# @param html [String] The string to escape
|
26
26
|
# @return [String] The escaped string
|
27
27
|
def escape(html)
|
28
|
-
EscapeUtils.escape_html html.to_s, false
|
28
|
+
EscapeUtils.escape_html html.to_s.chomp, false
|
29
29
|
end
|
30
30
|
else
|
31
31
|
# Returns an escaped copy of `html`.
|
data/lib/opulent/version.rb
CHANGED