public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fixed the ordering of attributes in the xml-decleration of Builder #540 
[woeye]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@505 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Tue Jan 25 04:47:11 -0800 2005
commit  136962322b8da0d6c09b4962194216cc4d248130
tree    51068b221da882b654546421543623c25f5a6985
parent  efa81dad5158eb61243d00811e4664248dd2c167
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Fixed the ordering of attributes in the xml-decleration of Builder #540 [woeye]
0
+
0
 * Added @request.raw_post as a convenience access to @request.env['RAW_POST_DATA'] #534 [Tobias Luetke]
0
 
0
 * Added support for automatic id-based indexing for lists of items #532 [dblack]. Example:
...
221
222
223
224
 
225
226
227
...
231
232
233
234
 
 
 
 
 
 
235
236
237
238
...
245
246
247
248
 
249
250
251
252
 
253
254
255
256
257
...
269
270
271
272
 
273
 
 
 
 
274
275
 
276
277
278
...
221
222
223
 
224
225
226
227
...
231
232
233
 
234
235
236
237
238
239
240
241
242
243
...
250
251
252
 
253
254
255
256
 
257
258
259
260
261
262
...
274
275
276
 
277
278
279
280
281
282
283
 
284
285
286
287
0
@@ -221,7 +221,7 @@
0
     # For example:
0
     #
0
     # xml.instruct!
0
- # #=> <?xml encoding="UTF-8" version="1.0"?>
0
+ # #=> <?xml version="1.0" encoding="UTF-8"?>
0
     # xml.instruct! :aaa, :bbb=>"ccc"
0
     # #=> <?aaa bbb="ccc"?>
0
     #
0
@@ -231,7 +231,12 @@
0
   a = { :version=>"1.0", :encoding=>"UTF-8" }
0
   attrs = a.merge attrs
0
       end
0
- _special("<?#{directive_tag}", "?>", nil, attrs)
0
+ _special(
0
+ "<?#{directive_tag}",
0
+ "?>",
0
+ nil,
0
+ attrs,
0
+ [:version, :encoding, :standalone])
0
     end
0
 
0
     private
0
0
@@ -245,11 +250,11 @@
0
     end
0
     
0
     # Insert special instruction.
0
- def _special(open, close, data=nil, attrs=nil)
0
+ def _special(open, close, data=nil, attrs=nil, order=[])
0
       _indent
0
       @target << open
0
       @target << data if data
0
- _insert_attributes(attrs) if attrs
0
+ _insert_attributes(attrs, order) if attrs
0
       @target << close
0
       _newline
0
     end
0
0
0
@@ -269,10 +274,14 @@
0
     end
0
 
0
     # Insert the attributes (given in the hash).
0
- def _insert_attributes(attrs)
0
+ def _insert_attributes(attrs, order=[])
0
       return if attrs.nil?
0
+ order.each do |k|
0
+ v = attrs[k]
0
+ @target << %{ #{k}="#{v}"} if v
0
+ end
0
       attrs.each do |k, v|
0
- @target << %{ #{k}="#{v}"}
0
+ @target << %{ #{k}="#{v}"} unless order.member?(k)
0
       end
0
     end
0
 

Comments

    No one has commented yet.