@@ -42,10 +42,6 @@ def for_loop?
4242 @is_for_loop
4343 end
4444
45- def inherit_context?
46- @inherit_context
47- end
48-
4945 def render_to_output_buffer ( context , output )
5046 render_tag ( context , output )
5147 end
@@ -77,20 +73,21 @@ def render_tag(context, output)
7773 inner_context . partial = true
7874 end
7975
80- if is_inline && inherit_context?
81- context . scopes . each do |scope |
82- scope . each do |key , value |
83- inner_context [ key ] = value
84- end
85- end
86- end
76+ inner_context [ 'forloop' ] = forloop if forloop
8777
8878 @attributes . each do |key , value |
89- inner_context [ key ] = context . evaluate ( value )
79+ if key == "..." && is_inline
80+ context . scopes . each do |scope |
81+ scope . each do |k , v |
82+ inner_context [ k ] = v
83+ end
84+ end
85+ else
86+ inner_context [ key ] = context . evaluate ( value )
87+ end
9088 end
9189
9290 inner_context [ context_variable_name ] = var unless var . nil?
93- inner_context [ 'forloop' ] = forloop if forloop
9491
9592 partial . render_to_output_buffer ( inner_context , output )
9693 forloop &.send ( :increment! )
@@ -129,19 +126,17 @@ def rigid_parse(markup)
129126 # optional comma
130127 p . consume? ( :comma )
131128
132- @inherit_context = false
133- # ... inline snippets syntax
134- if p . consume? ( :dotdotdot )
135- p . consume? ( :comma )
136-
137- @inherit_context = true
138- end
139-
140129 @attributes = { }
141- while p . look ( :id )
142- key = p . consume
143- p . consume ( :colon )
144- @attributes [ key ] = safe_parse_expression ( p )
130+ while p . look ( :dotdotdot ) || p . look ( :id )
131+ if p . consume? ( :dotdotdot )
132+ @attributes . delete ( "..." )
133+ @attributes [ "..." ] = true
134+ else
135+ key = p . consume
136+ p . consume ( :colon )
137+ @attributes . delete ( key )
138+ @attributes [ key ] = safe_parse_expression ( p )
139+ end
145140 p . consume? ( :comma ) # optional comma
146141 end
147142
@@ -172,11 +167,16 @@ def lax_parse(markup)
172167 @variable_name_expr = variable_name ? parse_expression ( variable_name ) : nil
173168 @template_name_expr = parse_expression ( template_name )
174169 @is_for_loop = ( with_or_for == FOR )
175- @inherit_context = markup . include? ( '...' )
176170
177171 @attributes = { }
178- markup . scan ( TagAttributes ) do |key , value |
179- @attributes [ key ] = parse_expression ( value )
172+ markup . scan ( /(#{ ContextInheritance } )|#{ TagAttributes . source } / ) do |context_marker , key , value |
173+ if context_marker
174+ @attributes . delete ( "..." )
175+ @attributes [ "..." ] = true
176+ elsif key && value
177+ @attributes . delete ( key )
178+ @attributes [ key ] = parse_expression ( value )
179+ end
180180 end
181181 end
182182
0 commit comments