nokogiri 1.2.1-x86-mswin32-60 → 1.2.2-x86-mswin32-60

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

Potentially problematic release.


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

Files changed (76) hide show
  1. data/.autotest +15 -0
  2. data/{History.ja.txt → CHANGELOG.ja.rdoc} +30 -2
  3. data/{History.txt → CHANGELOG.rdoc} +28 -2
  4. data/Manifest.txt +13 -7
  5. data/{README.ja.txt → README.ja.rdoc} +3 -1
  6. data/{README.txt → README.rdoc} +7 -1
  7. data/Rakefile +8 -25
  8. data/ext/nokogiri/extconf.rb +4 -4
  9. data/ext/nokogiri/html_entity_lookup.c +30 -0
  10. data/ext/nokogiri/html_entity_lookup.h +8 -0
  11. data/ext/nokogiri/native.c +22 -0
  12. data/ext/nokogiri/native.h +27 -4
  13. data/ext/nokogiri/native.so +0 -0
  14. data/ext/nokogiri/xml_document.c +31 -4
  15. data/ext/nokogiri/xml_document.h +11 -0
  16. data/ext/nokogiri/xml_document_fragment.c +1 -1
  17. data/ext/nokogiri/xml_node.c +71 -58
  18. data/ext/nokogiri/xml_node_set.c +26 -0
  19. data/ext/nokogiri/xml_reader.c +4 -2
  20. data/ext/nokogiri/xml_sax_parser.c +0 -37
  21. data/ext/nokogiri/xml_sax_push_parser.c +2 -2
  22. data/ext/nokogiri/xml_xpath_context.c +34 -7
  23. data/lib/nokogiri.rb +25 -0
  24. data/lib/nokogiri/css/generated_tokenizer.rb +2 -2
  25. data/lib/nokogiri/css/node.rb +2 -0
  26. data/lib/nokogiri/css/parser.rb +3 -2
  27. data/lib/nokogiri/html.rb +9 -52
  28. data/lib/nokogiri/html/document.rb +2 -0
  29. data/lib/nokogiri/html/entity_lookup.rb +11 -0
  30. data/lib/nokogiri/version.rb +1 -1
  31. data/lib/nokogiri/xml.rb +1 -2
  32. data/lib/nokogiri/xml/builder.rb +18 -5
  33. data/lib/nokogiri/xml/document.rb +15 -1
  34. data/lib/nokogiri/xml/fragment_handler.rb +34 -0
  35. data/lib/nokogiri/xml/node.rb +104 -29
  36. data/lib/nokogiri/xml/node_set.rb +12 -10
  37. data/lib/nokogiri/xml/sax/parser.rb +3 -3
  38. data/lib/xsd/xmlparser/nokogiri.rb +53 -0
  39. data/tasks/test.rb +7 -5
  40. data/test/css/test_nthiness.rb +1 -0
  41. data/test/css/test_parser.rb +1 -0
  42. data/test/css/test_tokenizer.rb +1 -0
  43. data/test/css/test_xpath_visitor.rb +1 -0
  44. data/test/helper.rb +4 -0
  45. data/test/hpricot/test_alter.rb +1 -0
  46. data/test/html/sax/test_parser.rb +13 -0
  47. data/test/html/test_builder.rb +21 -0
  48. data/test/html/test_document.rb +36 -0
  49. data/test/html/test_document_encoding.rb +46 -0
  50. data/test/html/test_named_characters.rb +14 -0
  51. data/test/html/test_node.rb +80 -0
  52. data/test/test_convert_xpath.rb +1 -0
  53. data/test/test_css_cache.rb +1 -0
  54. data/test/test_nokogiri.rb +8 -0
  55. data/test/xml/sax/test_parser.rb +6 -0
  56. data/test/xml/sax/test_push_parser.rb +1 -0
  57. data/test/xml/test_builder.rb +9 -0
  58. data/test/xml/test_cdata.rb +1 -0
  59. data/test/xml/test_comment.rb +1 -0
  60. data/test/xml/test_document.rb +58 -0
  61. data/test/xml/test_document_encoding.rb +15 -14
  62. data/test/xml/test_document_fragment.rb +6 -0
  63. data/test/xml/test_dtd.rb +1 -0
  64. data/test/xml/test_dtd_encoding.rb +1 -0
  65. data/test/xml/test_entity_reference.rb +1 -0
  66. data/test/xml/test_node.rb +52 -4
  67. data/test/xml/test_node_encoding.rb +1 -0
  68. data/test/xml/test_node_set.rb +21 -1
  69. data/test/xml/test_processing_instruction.rb +1 -0
  70. data/test/xml/test_reader_encoding.rb +1 -0
  71. data/test/xml/test_unparented_node.rb +381 -0
  72. data/test/xml/test_xpath.rb +1 -0
  73. metadata +34 -16
  74. data/lib/nokogiri/xml/after_handler.rb +0 -18
  75. data/lib/nokogiri/xml/before_handler.rb +0 -33
  76. data/vendor/hoe.rb +0 -1020
@@ -6,6 +6,7 @@ module Nokogiri
6
6
  if RUBY_VERSION =~ /^1\.9/
7
7
  class TestReaderEncoding < Nokogiri::TestCase
8
8
  def setup
9
+ super
9
10
  @reader = Nokogiri::XML::Reader(
10
11
  File.read(XML_FILE),
11
12
  XML_FILE,
@@ -0,0 +1,381 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
2
+
3
+ require 'stringio'
4
+
5
+ module Nokogiri
6
+ module XML
7
+ class TestUnparentedNode < Nokogiri::TestCase
8
+ def setup
9
+ begin
10
+ xml = Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE)
11
+ @node = xml.at('staff')
12
+ @node.unlink
13
+ end
14
+ GC.start # try to GC the document
15
+ end
16
+
17
+ def test_node_still_has_document
18
+ assert @node.document
19
+ end
20
+
21
+ def test_add_namespace
22
+ node = @node.at('address')
23
+ node.unlink
24
+ node.add_namespace('foo', 'http://tenderlovemaking.com')
25
+ assert_equal 'http://tenderlovemaking.com', node.namespaces['xmlns:foo']
26
+ end
27
+
28
+ def test_write_to
29
+ io = StringIO.new
30
+ @node.write_to io
31
+ io.rewind
32
+ assert_equal @node.to_xml, io.read
33
+ end
34
+
35
+ def test_attribute_with_symbol
36
+ assert_equal 'Yes', @node.css('address').first[:domestic]
37
+ end
38
+
39
+ def test_write_to_with_block
40
+ called = false
41
+ io = StringIO.new
42
+ conf = nil
43
+ @node.write_to io do |config|
44
+ called = true
45
+ conf = config
46
+ config.format.as_html.no_empty_tags
47
+ end
48
+ io.rewind
49
+ assert called
50
+ assert_equal @node.serialize(nil, conf.options), io.read
51
+ end
52
+
53
+ %w{ xml html xhtml }.each do |type|
54
+ define_method(:"test_write_#{type}_to") do
55
+ io = StringIO.new
56
+ assert @node.send(:"write_#{type}_to", io)
57
+ io.rewind
58
+ assert_match @node.send(:"to_#{type}"), io.read
59
+ end
60
+ end
61
+
62
+ def test_serialize_with_block
63
+ called = false
64
+ conf = nil
65
+ string = @node.serialize do |config|
66
+ called = true
67
+ conf = config
68
+ config.format.as_html.no_empty_tags
69
+ end
70
+ assert called
71
+ assert_equal @node.serialize(nil, conf.options), string
72
+ end
73
+
74
+ def test_values
75
+ assert_equal %w{ Yes Yes }, @node.xpath('.//address')[1].values
76
+ end
77
+
78
+ def test_keys
79
+ assert_equal %w{ domestic street }, @node.xpath('.//address')[1].keys
80
+ end
81
+
82
+ def test_each
83
+ attributes = []
84
+ @node.xpath('.//address')[1].each do |key, value|
85
+ attributes << [key, value]
86
+ end
87
+ assert_equal [['domestic', 'Yes'], ['street', 'Yes']], attributes
88
+ end
89
+
90
+ def test_new
91
+ assert node = Nokogiri::XML::Node.new('input', @node)
92
+ assert_equal 1, node.node_type
93
+ end
94
+
95
+ def test_to_str
96
+ assert name = @node.xpath('.//name').first
97
+ assert_match(/Margaret/, '' + name)
98
+ assert_equal('Margaret Martin', '' + name.children.first)
99
+ end
100
+
101
+ def test_ancestors
102
+ assert(address = @node.xpath('.//address').first)
103
+ assert_equal 3, address.ancestors.length
104
+ assert_equal ['employee', 'staff', nil],
105
+ address.ancestors.map { |x| x ? x.name : x }
106
+ end
107
+
108
+ def test_read_only?
109
+ assert entity_decl = @node.internal_subset.children.find { |x|
110
+ x.type == Node::ENTITY_DECL
111
+ }
112
+ assert entity_decl.read_only?
113
+ end
114
+
115
+ def test_remove_attribute
116
+ address = @node.xpath('./employee/address').first
117
+ assert_equal 'Yes', address['domestic']
118
+ address.remove_attribute 'domestic'
119
+ assert_nil address['domestic']
120
+ end
121
+
122
+ def test_delete
123
+ address = @node.xpath('./employee/address').first
124
+ assert_equal 'Yes', address['domestic']
125
+ address.delete 'domestic'
126
+ assert_nil address['domestic']
127
+ end
128
+
129
+ def test_add_child_in_same_document
130
+ child = @node.css('employee').first
131
+
132
+ assert previous_last_child = child.children.last
133
+ assert new_child = child.children.first
134
+
135
+ last = child.children.last
136
+
137
+ child.add_child(new_child)
138
+ assert_equal new_child, child.children.last
139
+ assert_equal last, child.children.last
140
+ end
141
+
142
+ def test_add_child_from_other_document
143
+ d1 = Nokogiri::XML("<root><item>1</item><item>2</item></root>")
144
+ d2 = Nokogiri::XML("<root><item>3</item><item>4</item></root>")
145
+
146
+ d2.at('root').search('item').each do |i|
147
+ d1.at('root').add_child i
148
+ end
149
+
150
+ assert_equal 0, d2.search('item').size
151
+ assert_equal 4, d1.search('item').size
152
+ end
153
+
154
+ def test_add_child
155
+ xml = Nokogiri::XML(<<-eoxml)
156
+ <root>
157
+ <a>Hello world</a>
158
+ </root>
159
+ eoxml
160
+ text_node = Nokogiri::XML::Text.new('hello', xml)
161
+ assert_equal Nokogiri::XML::Node::TEXT_NODE, text_node.type
162
+ xml.root.add_child text_node
163
+ assert_match 'hello', xml.to_s
164
+ end
165
+
166
+ def test_chevron_works_as_add_child
167
+ xml = Nokogiri::XML(<<-eoxml)
168
+ <root>
169
+ <a>Hello world</a>
170
+ </root>
171
+ eoxml
172
+ text_node = Nokogiri::XML::Text.new('hello', xml)
173
+ xml.root << text_node
174
+ assert_match 'hello', xml.to_s
175
+ end
176
+
177
+ def test_add_previous_sibling
178
+ xml = Nokogiri::XML(<<-eoxml)
179
+ <root>
180
+ <a>Hello world</a>
181
+ </root>
182
+ eoxml
183
+ b_node = Nokogiri::XML::Node.new('a', xml)
184
+ assert_equal Nokogiri::XML::Node::ELEMENT_NODE, b_node.type
185
+ b_node.content = 'first'
186
+ a_node = xml.xpath('.//a').first
187
+ a_node.add_previous_sibling(b_node)
188
+ assert_equal('first', xml.xpath('.//a').first.text)
189
+ end
190
+
191
+ def test_add_previous_sibling_merge
192
+ xml = Nokogiri::XML(<<-eoxml)
193
+ <root>
194
+ <a>Hello world</a>
195
+ </root>
196
+ eoxml
197
+
198
+ assert a_tag = xml.css('a').first
199
+
200
+ left_space = a_tag.previous
201
+ right_space = a_tag.next
202
+ assert left_space.text?
203
+ assert right_space.text?
204
+
205
+ left_space.add_previous_sibling(right_space)
206
+ assert_equal left_space, right_space
207
+ end
208
+
209
+ def test_add_next_sibling_merge
210
+ xml = Nokogiri::XML(<<-eoxml)
211
+ <root>
212
+ <a>Hello world</a>
213
+ </root>
214
+ eoxml
215
+
216
+ assert a_tag = xml.css('a').first
217
+
218
+ left_space = a_tag.previous
219
+ right_space = a_tag.next
220
+ assert left_space.text?
221
+ assert right_space.text?
222
+
223
+ right_space.add_next_sibling(left_space)
224
+ assert_equal left_space, right_space
225
+ end
226
+
227
+ def test_find_by_css_with_tilde_eql
228
+ xml = Nokogiri::XML.parse(<<-eoxml)
229
+ <root>
230
+ <a>Hello world</a>
231
+ <a class='foo bar'>Bar</a>
232
+ <a class='bar foo'>Bar</a>
233
+ <a class='bar'>Bar</a>
234
+ <a class='baz bar foo'>Bar</a>
235
+ <a class='bazbarfoo'>Awesome</a>
236
+ <a class='bazbar'>Awesome</a>
237
+ </root>
238
+ eoxml
239
+ set = xml.css('a[@class~="bar"]')
240
+ assert_equal 4, set.length
241
+ assert_equal ['Bar'], set.map { |node| node.content }.uniq
242
+ end
243
+
244
+ def test_unlink
245
+ xml = Nokogiri::XML.parse(<<-eoxml)
246
+ <root>
247
+ <a class='foo bar'>Bar</a>
248
+ <a class='bar foo'>Bar</a>
249
+ <a class='bar'>Bar</a>
250
+ <a>Hello world</a>
251
+ <a class='baz bar foo'>Bar</a>
252
+ <a class='bazbarfoo'>Awesome</a>
253
+ <a class='bazbar'>Awesome</a>
254
+ </root>
255
+ eoxml
256
+ node = xml.xpath('.//a')[3]
257
+ assert_equal('Hello world', node.text)
258
+ assert_match(/Hello world/, xml.to_s)
259
+ assert node.parent
260
+ assert node.document
261
+ assert node.previous_sibling
262
+ assert node.next_sibling
263
+ node.unlink
264
+ assert !node.parent
265
+ # assert !node.document
266
+ assert !node.previous_sibling
267
+ assert !node.next_sibling
268
+ assert_no_match(/Hello world/, xml.to_s)
269
+ end
270
+
271
+ def test_next_sibling
272
+ assert sibling = @node.child.next_sibling
273
+ assert_equal('employee', sibling.name)
274
+ end
275
+
276
+ def test_previous_sibling
277
+ assert sibling = @node.child.next_sibling
278
+ assert_equal('employee', sibling.name)
279
+ assert_equal(sibling.previous_sibling, @node.child)
280
+ end
281
+
282
+ def test_name=
283
+ @node.name = 'awesome'
284
+ assert_equal('awesome', @node.name)
285
+ end
286
+
287
+ def test_child
288
+ assert child = @node.child
289
+ assert_equal('text', child.name)
290
+ end
291
+
292
+ def test_key?
293
+ assert node = @node.search('.//address').first
294
+ assert(!node.key?('asdfasdf'))
295
+ end
296
+
297
+ def test_set_property
298
+ assert node = @node.search('.//address').first
299
+ node['foo'] = 'bar'
300
+ assert_equal('bar', node['foo'])
301
+ end
302
+
303
+ def test_attributes
304
+ assert node = @node.search('.//address').first
305
+ assert_nil(node['asdfasdfasdf'])
306
+ assert_equal('Yes', node['domestic'])
307
+
308
+ assert node = @node.search('.//address')[2]
309
+ attr = node.attributes
310
+ assert_equal 2, attr.size
311
+ assert_equal 'Yes', attr['domestic'].value
312
+ assert_equal 'Yes', attr['domestic'].to_s
313
+ assert_equal 'No', attr['street'].value
314
+ end
315
+
316
+ def test_path
317
+ assert set = @node.search('.//employee')
318
+ assert node = set.first
319
+ assert_equal('/staff/employee[1]', node.path)
320
+ end
321
+
322
+ def test_search_by_symbol
323
+ assert set = @node.search(:employee)
324
+ assert 5, set.length
325
+
326
+ assert node = @node.at(:employee)
327
+ assert node.text =~ /EMP0001/
328
+ end
329
+
330
+ def test_new_node
331
+ node = Nokogiri::XML::Node.new('form', @node.document)
332
+ assert_equal('form', node.name)
333
+ assert(node.document)
334
+ end
335
+
336
+ def test_encode_special_chars
337
+ foo = @node.css('employee').first.encode_special_chars('&')
338
+ assert_equal '&amp;', foo
339
+ end
340
+
341
+ def test_content
342
+ node = Nokogiri::XML::Node.new('form', @node)
343
+ assert_equal('', node.content)
344
+
345
+ node.content = 'hello world!'
346
+ assert_equal('hello world!', node.content)
347
+ end
348
+
349
+ def test_whitespace_nodes
350
+ doc = Nokogiri::XML.parse("<root><b>Foo</b>\n<i>Bar</i> <p>Bazz</p></root>")
351
+ children = doc.at('.//root').children.collect{|j| j.to_s}
352
+ assert_equal "\n", children[1]
353
+ assert_equal " ", children[3]
354
+ end
355
+
356
+ def test_replace
357
+ set = @node.search('.//employee')
358
+ assert 5, set.length
359
+ assert 0, @node.search('.//form').length
360
+
361
+ first = set[0]
362
+ second = set[1]
363
+
364
+ node = Nokogiri::XML::Node.new('form', @node)
365
+ first.replace(node)
366
+
367
+ assert set = @node.search('.//employee')
368
+ assert_equal 4, set.length
369
+ assert 1, @node.search('.//form').length
370
+
371
+ assert_equal set[0].to_xml, second.to_xml
372
+ end
373
+
374
+ def test_illegal_replace_of_node_with_doc
375
+ new_node = Nokogiri::XML.parse('<foo>bar</foo>')
376
+ old_node = @node.at('.//employee')
377
+ assert_raises(ArgumentError){ old_node.replace new_node }
378
+ end
379
+ end
380
+ end
381
+ end
@@ -4,6 +4,7 @@ module Nokogiri
4
4
  module XML
5
5
  class TestXPath < Nokogiri::TestCase
6
6
  def setup
7
+ super
7
8
  @xml = Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE)
8
9
 
9
10
  @handler = Class.new {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Aaron Patterson
@@ -10,10 +10,19 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-02-23 00:00:00 -08:00
13
+ date: 2009-03-14 00:00:00 -07:00
14
14
  default_executable:
15
- dependencies: []
16
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: hoe
18
+ type: :development
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.9.0
25
+ version:
17
26
  description: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser."
18
27
  email:
19
28
  - aaronp@rubyforge.org
@@ -23,21 +32,24 @@ executables: []
23
32
  extensions: []
24
33
 
25
34
  extra_rdoc_files:
26
- - History.ja.txt
27
- - History.txt
28
35
  - Manifest.txt
29
- - README.ja.txt
30
- - README.txt
36
+ - CHANGELOG.ja.rdoc
37
+ - CHANGELOG.rdoc
38
+ - README.ja.rdoc
39
+ - README.rdoc
31
40
  files:
32
- - History.ja.txt
33
- - History.txt
41
+ - .autotest
42
+ - CHANGELOG.ja.rdoc
43
+ - CHANGELOG.rdoc
34
44
  - Manifest.txt
35
- - README.ja.txt
36
- - README.txt
45
+ - README.ja.rdoc
46
+ - README.rdoc
37
47
  - Rakefile
38
48
  - ext/nokogiri/extconf.rb
39
49
  - ext/nokogiri/html_document.c
40
50
  - ext/nokogiri/html_document.h
51
+ - ext/nokogiri/html_entity_lookup.c
52
+ - ext/nokogiri/html_entity_lookup.h
41
53
  - ext/nokogiri/html_sax_parser.c
42
54
  - ext/nokogiri/html_sax_parser.h
43
55
  - ext/nokogiri/native.c
@@ -102,13 +114,12 @@ files:
102
114
  - lib/nokogiri/html.rb
103
115
  - lib/nokogiri/html/builder.rb
104
116
  - lib/nokogiri/html/document.rb
117
+ - lib/nokogiri/html/entity_lookup.rb
105
118
  - lib/nokogiri/html/sax/parser.rb
106
119
  - lib/nokogiri/syntax_error.rb
107
120
  - lib/nokogiri/version.rb
108
121
  - lib/nokogiri/xml.rb
109
- - lib/nokogiri/xml/after_handler.rb
110
122
  - lib/nokogiri/xml/attr.rb
111
- - lib/nokogiri/xml/before_handler.rb
112
123
  - lib/nokogiri/xml/builder.rb
113
124
  - lib/nokogiri/xml/cdata.rb
114
125
  - lib/nokogiri/xml/comment.rb
@@ -117,6 +128,7 @@ files:
117
128
  - lib/nokogiri/xml/dtd.rb
118
129
  - lib/nokogiri/xml/element.rb
119
130
  - lib/nokogiri/xml/entity_declaration.rb
131
+ - lib/nokogiri/xml/fragment_handler.rb
120
132
  - lib/nokogiri/xml/node.rb
121
133
  - lib/nokogiri/xml/node/save_options.rb
122
134
  - lib/nokogiri/xml/node_set.rb
@@ -134,6 +146,7 @@ files:
134
146
  - lib/nokogiri/xml/xpath_context.rb
135
147
  - lib/nokogiri/xslt.rb
136
148
  - lib/nokogiri/xslt/stylesheet.rb
149
+ - lib/xsd/xmlparser/nokogiri.rb
137
150
  - tasks/test.rb
138
151
  - test/css/test_nthiness.rb
139
152
  - test/css/test_parser.rb
@@ -166,6 +179,8 @@ files:
166
179
  - test/html/sax/test_parser.rb
167
180
  - test/html/test_builder.rb
168
181
  - test/html/test_document.rb
182
+ - test/html/test_document_encoding.rb
183
+ - test/html/test_named_characters.rb
169
184
  - test/html/test_node.rb
170
185
  - test/test_convert_xpath.rb
171
186
  - test/test_css_cache.rb
@@ -193,8 +208,8 @@ files:
193
208
  - test/xml/test_processing_instruction.rb
194
209
  - test/xml/test_reader_encoding.rb
195
210
  - test/xml/test_text.rb
211
+ - test/xml/test_unparented_node.rb
196
212
  - test/xml/test_xpath.rb
197
- - vendor/hoe.rb
198
213
  - ext/nokogiri/iconv.dll
199
214
  - ext/nokogiri/libexslt.dll
200
215
  - ext/nokogiri/libxml2.dll
@@ -206,7 +221,7 @@ homepage: http://nokogiri.rubyforge.org/
206
221
  post_install_message:
207
222
  rdoc_options:
208
223
  - --main
209
- - README.txt
224
+ - README.rdoc
210
225
  require_paths:
211
226
  - lib
212
227
  - ext
@@ -243,6 +258,8 @@ test_files:
243
258
  - test/html/sax/test_parser.rb
244
259
  - test/html/test_builder.rb
245
260
  - test/html/test_document.rb
261
+ - test/html/test_document_encoding.rb
262
+ - test/html/test_named_characters.rb
246
263
  - test/html/test_node.rb
247
264
  - test/test_convert_xpath.rb
248
265
  - test/test_css_cache.rb
@@ -270,4 +287,5 @@ test_files:
270
287
  - test/xml/test_processing_instruction.rb
271
288
  - test/xml/test_reader_encoding.rb
272
289
  - test/xml/test_text.rb
290
+ - test/xml/test_unparented_node.rb
273
291
  - test/xml/test_xpath.rb