hpricot 0.8.5-i386-mswin32 → 0.8.6-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/ext/hpricot_scan/HpricotScanService.java +48 -36
- data/ext/hpricot_scan/hpricot_scan.c +144 -135
- data/ext/hpricot_scan/hpricot_scan.java.rl +23 -11
- data/ext/hpricot_scan/hpricot_scan.rl +23 -14
- data/lib/fast_xs/1.8/fast_xs.so +0 -0
- data/lib/fast_xs/1.9/fast_xs.so +0 -0
- data/lib/hpricot_scan/1.8/hpricot_scan.so +0 -0
- data/lib/hpricot_scan/1.9/hpricot_scan.so +0 -0
- data/test/test_parser.rb +18 -0
- metadata +4 -4
@@ -375,18 +375,30 @@ public class HpricotScanService implements BasicLibraryService {
|
|
375
375
|
if(!S.xml) {
|
376
376
|
IRubyObject match = runtime.getNil(), e = S.focus;
|
377
377
|
while(e != S.doc) {
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
378
|
+
if (ec.isNil()) {
|
379
|
+
// Anything can contain an unknown element
|
380
|
+
if(match.isNil()) {
|
381
|
+
match = e;
|
382
|
+
}
|
383
|
+
} else {
|
384
|
+
IRubyObject hEC = H_ELE_GET(e, H_ELE_EC);
|
385
|
+
if(hEC instanceof RubyHash) {
|
386
|
+
IRubyObject has = ((RubyHash)hEC).op_aref(scanner.ctx, name);
|
387
|
+
if(!has.isNil()) {
|
388
|
+
if(has == runtime.getTrue()) {
|
389
|
+
if(match.isNil()) {
|
390
|
+
match = e;
|
391
|
+
}
|
392
|
+
} else if(has == x.symAllow) {
|
393
|
+
match = S.focus;
|
394
|
+
} else if(has == x.symDeny) {
|
395
|
+
match = runtime.getNil();
|
385
396
|
}
|
386
|
-
}
|
387
|
-
|
388
|
-
|
389
|
-
|
397
|
+
}
|
398
|
+
} else {
|
399
|
+
// Unknown elements can contain anything
|
400
|
+
if(match.isNil()) {
|
401
|
+
match = e;
|
390
402
|
}
|
391
403
|
}
|
392
404
|
}
|
@@ -356,23 +356,32 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr,
|
|
356
356
|
VALUE match = Qnil, e = S->focus;
|
357
357
|
while (e != S->doc)
|
358
358
|
{
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
359
|
+
if (ec == Qnil) {
|
360
|
+
// anything can contain unknown elements
|
361
|
+
if (match == Qnil)
|
362
|
+
match = e;
|
363
|
+
} else {
|
364
|
+
VALUE hEC = H_ELE_GET(e, H_ELE_EC);
|
365
|
+
|
366
|
+
if (TYPE(hEC) == T_HASH)
|
367
|
+
{
|
368
|
+
VALUE has = rb_hash_lookup(hEC, name);
|
369
|
+
if (has != Qnil) {
|
370
|
+
if (has == Qtrue) {
|
371
|
+
if (match == Qnil)
|
372
|
+
match = e;
|
373
|
+
} else if (has == symAllow) {
|
374
|
+
match = S->focus;
|
375
|
+
} else if (has == symDeny) {
|
376
|
+
match = Qnil;
|
377
|
+
}
|
372
378
|
}
|
379
|
+
} else {
|
380
|
+
// Unknown elements can contain anything
|
381
|
+
if (match == Qnil)
|
382
|
+
match = e;
|
373
383
|
}
|
374
384
|
}
|
375
|
-
|
376
385
|
e = H_ELE_GET(e, H_ELE_PARENT);
|
377
386
|
}
|
378
387
|
|
data/lib/fast_xs/1.8/fast_xs.so
CHANGED
Binary file
|
data/lib/fast_xs/1.9/fast_xs.so
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/test/test_parser.rb
CHANGED
@@ -475,4 +475,22 @@ class TestParser < Test::Unit::TestCase
|
|
475
475
|
assert_nothing_raised {Hpricot.parse(TestFiles::BNQT)}
|
476
476
|
end
|
477
477
|
|
478
|
+
def test_unknown_tag
|
479
|
+
header = <<-edoc
|
480
|
+
<header id="htest">
|
481
|
+
<div id="dtest">blah</div>
|
482
|
+
</header>
|
483
|
+
edoc
|
484
|
+
doc = Hpricot(<<-edoc)
|
485
|
+
<div>#{header}</div>
|
486
|
+
edoc
|
487
|
+
assert_equal header.chomp, (doc/"#htest").to_html
|
488
|
+
end
|
489
|
+
|
490
|
+
def test_nested_unknown_tags
|
491
|
+
header =
|
492
|
+
%(<header id="htest"><div id="dtest"><nav>blah</nav></div></header>)
|
493
|
+
doc = Hpricot(%(<div>#{header}</div>))
|
494
|
+
assert_equal header.chomp, (doc/"#htest").to_html
|
495
|
+
end
|
478
496
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hpricot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 6
|
10
|
+
version: 0.8.6
|
11
11
|
platform: i386-mswin32
|
12
12
|
authors:
|
13
13
|
- why the lucky stiff
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-17 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: a swift, liberal HTML parser with a fantastic library
|