@@ -76,30 +76,7 @@ def render_tag(context, output)
7676 inner_context [ 'forloop' ] = forloop if forloop
7777
7878 @attributes . each do |key , value |
79- if key . start_with? ( "..." ) && is_inline
80- if key == "..."
81- context . scopes . each do |scope |
82- scope . each do |k , v |
83- inner_context [ k ] = v
84- end
85- end
86- else
87- obj = context . evaluate ( value )
88- if obj . is_a? ( Liquid ::Drop )
89- ( obj . class . invokable_methods - [ 'to_liquid' ] ) . each do |method_name |
90- inner_context [ method_name ] = obj . invoke_drop ( method_name )
91- end
92- elsif obj . is_a? ( Hash )
93- obj . each do |k , v |
94- inner_context [ k ] = v
95- end
96- else
97- raise ::ArgumentError
98- end
99- end
100- else
101- inner_context [ key ] = context . evaluate ( value )
102- end
79+ inner_context [ key ] = context . evaluate ( value )
10380 end
10481
10582 inner_context [ context_variable_name ] = var unless var . nil?
@@ -142,23 +119,11 @@ def rigid_parse(markup)
142119 p . consume? ( :comma )
143120
144121 @attributes = { }
145- while p . look ( :dotdotdot ) || p . look ( :id )
146- if p . consume? ( :dotdotdot )
147- if p . look ( :id )
148- identifier = p . read ( :id )
149- key = "...#{ identifier } "
150- @attributes . delete ( key )
151- @attributes [ key ] = safe_parse_expression ( p )
152- else
153- @attributes . delete ( "..." )
154- @attributes [ "..." ] = true
155- end
156- else
157- key = p . consume
158- p . consume ( :colon )
159- @attributes . delete ( key )
160- @attributes [ key ] = safe_parse_expression ( p )
161- end
122+ while p . look ( :id )
123+ key = p . consume
124+ p . consume ( :colon )
125+ @attributes [ key ] = safe_parse_expression ( p )
126+
162127 p . consume? ( :comma ) # optional comma
163128 end
164129
@@ -190,20 +155,8 @@ def lax_parse(markup)
190155 @is_for_loop = ( with_or_for == FOR )
191156
192157 @attributes = { }
193- markup . scan ( /(\. \. \. )(\w +)?(?=\s |,|$)|#{ TagAttributes . source } / ) do |spread , identifier , key , value |
194- if spread
195- if identifier
196- spread_key = "...#{ identifier } "
197- @attributes . delete ( spread_key )
198- @attributes [ spread_key ] = parse_expression ( identifier )
199- else
200- @attributes . delete ( "..." )
201- @attributes [ "..." ] = true
202- end
203- elsif key && value
204- @attributes . delete ( key )
205- @attributes [ key ] = parse_expression ( value )
206- end
158+ markup . scan ( TagAttributes ) do |key , value |
159+ @attributes [ key ] = parse_expression ( value )
207160 end
208161 end
209162
0 commit comments