builder 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of builder might be problematic. Click here for more details.

data/CHANGES CHANGED
@@ -1,5 +1,10 @@
1
1
  = Change Log
2
2
 
3
+ == Version 1.2.3
4
+
5
+ The attributes in the <?xml ... ?> instruction will be ordered:
6
+ version, encoding, standalone.
7
+
3
8
  == Version 1.2.2
4
9
 
5
10
  Another fix for BlankSlate. The Kernal/Object traps added in 1.2.1
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ rescue Exception
17
17
  nil
18
18
  end
19
19
 
20
- PKG_VERSION = "1.2.2"
20
+ PKG_VERSION = "1.2.3"
21
21
 
22
22
  SRC_RB = FileList['lib/**/*.rb']
23
23
 
@@ -63,7 +63,13 @@ else
63
63
  s.name = 'builder'
64
64
  s.version = PKG_VERSION
65
65
  s.summary = "Builders for MarkUp."
66
- s.description = %{Simple builder classes for creating markup.}
66
+ s.description = <<EOS
67
+ Builder provides a number of builder objects that make creating structured data
68
+ simple to do. Currently the following builder objects are supported:
69
+
70
+ * XML Markup
71
+ * XML Events
72
+ EOS
67
73
 
68
74
  s.files = PKG_FILES.to_a
69
75
 
@@ -221,7 +221,7 @@ module Builder
221
221
  # For example:
222
222
  #
223
223
  # xml.instruct!
224
- # #=> <?xml encoding="UTF-8" version="1.0"?>
224
+ # #=> <?xml version="1.0" encoding="UTF-8"?>
225
225
  # xml.instruct! :aaa, :bbb=>"ccc"
226
226
  # #=> <?aaa bbb="ccc"?>
227
227
  #
@@ -231,7 +231,12 @@ module Builder
231
231
  a = { :version=>"1.0", :encoding=>"UTF-8" }
232
232
  attrs = a.merge attrs
233
233
  end
234
- _special("<?#{directive_tag}", "?>", nil, attrs)
234
+ _special(
235
+ "<?#{directive_tag}",
236
+ "?>",
237
+ nil,
238
+ attrs,
239
+ [:version, :encoding, :standalone])
235
240
  end
236
241
 
237
242
  private
@@ -245,11 +250,11 @@ module Builder
245
250
  end
246
251
 
247
252
  # Insert special instruction.
248
- def _special(open, close, data=nil, attrs=nil)
253
+ def _special(open, close, data=nil, attrs=nil, order=[])
249
254
  _indent
250
255
  @target << open
251
256
  @target << data if data
252
- _insert_attributes(attrs) if attrs
257
+ _insert_attributes(attrs, order) if attrs
253
258
  @target << close
254
259
  _newline
255
260
  end
@@ -269,10 +274,14 @@ module Builder
269
274
  end
270
275
 
271
276
  # Insert the attributes (given in the hash).
272
- def _insert_attributes(attrs)
277
+ def _insert_attributes(attrs, order=[])
273
278
  return if attrs.nil?
279
+ order.each do |k|
280
+ v = attrs[k]
281
+ @target << %{ #{k}="#{v}"} if v
282
+ end
274
283
  attrs.each do |k, v|
275
- @target << %{ #{k}="#{v}"}
284
+ @target << %{ #{k}="#{v}"} unless order.member?(k)
276
285
  end
277
286
  end
278
287
 
@@ -231,7 +231,7 @@ class TestSpecialMarkup < Test::Unit::TestCase
231
231
 
232
232
  def test_indented_instruct
233
233
  @xml.p { @xml.instruct! :xml }
234
- assert_match %r{<p>\n <\?xml( version="1.0"| encoding="UTF-8"){2}\?>\n</p>\n},
234
+ assert_match %r{<p>\n <\?xml version="1.0" encoding="UTF-8"\?>\n</p>\n},
235
235
  @xml.target!
236
236
  end
237
237
 
@@ -242,12 +242,17 @@ class TestSpecialMarkup < Test::Unit::TestCase
242
242
 
243
243
  def test_xml_instruct
244
244
  @xml.instruct!
245
- assert_match /^<\?xml( version="1.0"| encoding="UTF-8"){2}\?>$/, @xml.target!
245
+ assert_match /^<\?xml version="1.0" encoding="UTF-8"\?>$/, @xml.target!
246
246
  end
247
247
 
248
248
  def test_xml_instruct_with_overrides
249
249
  @xml.instruct! :xml, :encoding=>"UCS-2"
250
- assert_match /^<\?xml( version="1.0"| encoding="UCS-2"){2}\?>$/, @xml.target!
250
+ assert_match /^<\?xml version="1.0" encoding="UCS-2"\?>$/, @xml.target!
251
+ end
252
+
253
+ def test_xml_instruct_with_standalong
254
+ @xml.instruct! :xml, :encoding=>"UCS-2", :standalone=>"yes"
255
+ assert_match /^<\?xml version="1.0" encoding="UCS-2" standalone="yes"\?>$/, @xml.target!
251
256
  end
252
257
 
253
258
  def test_no_blocks
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.1
2
+ rubygems_version: 0.8.3
3
3
  specification_version: 1
4
4
  name: builder
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.2
7
- date: 2004-11-23
6
+ version: 1.2.3
7
+ date: 2005-01-08
8
8
  summary: Builders for MarkUp.
9
9
  require_paths:
10
10
  - lib
11
- author: Jim Weirich
12
11
  email: jim@weirichhouse.org
13
12
  homepage: http://onestepback.org
14
13
  rubyforge_project:
15
- description: Simple builder classes for creating markup.
14
+ description: "Builder provides a number of builder objects that make creating structured data
15
+ simple to do. Currently the following builder objects are supported: * XML
16
+ Markup * XML Events"
16
17
  autorequire: builder
17
18
  default_executable:
18
19
  bindir: bin
@@ -25,22 +26,24 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
26
  version: 0.0.0
26
27
  version:
27
28
  platform: ruby
29
+ authors:
30
+ - Jim Weirich
28
31
  files:
29
32
  - lib/builder.rb
30
- - lib/builder/blankslate.rb
33
+ - lib/builder/xmlmarkup.rb
31
34
  - lib/builder/xmlbase.rb
35
+ - lib/builder/blankslate.rb
32
36
  - lib/builder/xmlevents.rb
33
- - lib/builder/xmlmarkup.rb
34
- - test/preload.rb
35
- - test/testblankslate.rb
36
37
  - test/testmarkupbuilder.rb
38
+ - test/testblankslate.rb
39
+ - test/preload.rb
37
40
  - scripts/publish.rb
38
- - CHANGES
39
41
  - README
40
42
  - Rakefile
43
+ - CHANGES
41
44
  test_files:
42
- - test/testblankslate.rb
43
45
  - test/testmarkupbuilder.rb
46
+ - test/testblankslate.rb
44
47
  rdoc_options:
45
48
  - "--title"
46
49
  - "Builder -- Easy XML Building"
@@ -48,9 +51,9 @@ rdoc_options:
48
51
  - README
49
52
  - "--line-numbers"
50
53
  extra_rdoc_files:
51
- - CHANGES
52
54
  - README
53
55
  - Rakefile
56
+ - CHANGES
54
57
  executables: []
55
58
  extensions: []
56
59
  requirements: []