nokogiri 1.3.0 → 1.3.1
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.
- data/CHANGELOG.ja.rdoc +45 -23
- data/CHANGELOG.rdoc +7 -0
- data/README.ja.rdoc +5 -1
- data/README.rdoc +5 -1
- data/Rakefile +9 -9
- data/ext/nokogiri/extconf.rb +27 -4
- data/ext/nokogiri/nokogiri.h +1 -0
- data/ext/nokogiri/xml_namespace.c +5 -0
- data/ext/nokogiri/xml_node.c +7 -21
- data/ext/nokogiri/xml_relax_ng.c +14 -14
- data/ext/nokogiri/xml_schema.c +14 -14
- data/lib/nokogiri/css/generated_parser.rb +153 -255
- data/lib/nokogiri/css/generated_tokenizer.rb +4 -4
- data/lib/nokogiri/css/tokenizer.rex +5 -5
- data/lib/nokogiri/ffi/xml/namespace.rb +4 -0
- data/lib/nokogiri/ffi/xml/node.rb +0 -2
- data/lib/nokogiri/version.rb +6 -2
- data/lib/nokogiri/xml/document.rb +1 -0
- data/lib/nokogiri/xml/node.rb +3 -1
- data/test/css/test_tokenizer.rb +7 -0
- data/test/test_reader.rb +1 -1
- data/test/xml/test_namespace.rb +5 -0
- metadata +8 -5
data/CHANGELOG.ja.rdoc
CHANGED
@@ -1,26 +1,46 @@
|
|
1
|
+
=== 1.3.1 / 2009年6月7日
|
2
|
+
|
3
|
+
* バグの修正
|
4
|
+
|
5
|
+
* extconf.rb は任意のRelaxNGとSchemaの機能を探すようになった
|
6
|
+
* ドキュメントのノードキャッシュに名前空間のノードが入るようになった
|
7
|
+
|
1
8
|
=== 1.3.0 / 2009年5月30日
|
2
9
|
|
3
10
|
* 新しい機能
|
4
11
|
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* Nokogiri::XML::Node#<=>
|
8
|
-
|
9
|
-
* Nokogiri::XML::Node#
|
10
|
-
|
11
|
-
* Nokogiri::
|
12
|
-
* Nokogiri::
|
13
|
-
|
14
|
-
* Nokogiri::
|
15
|
-
|
16
|
-
* Nokogiri::HTML::
|
17
|
-
|
12
|
+
* Builderがブロックの引数の数に応じてスコープが定まるようになった
|
13
|
+
* Builderがアンダースコアで終わるメソッドをtagzと同様にサポートするようになった
|
14
|
+
* Nokogiri::XML::Node#<=> がドキュメントの位置によりノードを比較するように
|
15
|
+
なった
|
16
|
+
* Nokogiri::XML::Node#matches?が与えられたセレクタ内でノードがあればtrue
|
17
|
+
を返すようになった
|
18
|
+
* Nokogiri::XML::Node#ancestors がNokogiri::XML::NodeSetオブジェクトを返すようになった
|
19
|
+
* Nokogiri::XML::Node#ancestorsがオプションのセレクタに対応する親をマッチする
|
20
|
+
ようになった
|
21
|
+
* Nokogiri::HTML::Document#meta_encoding がメタデータのエンコードを返すように
|
22
|
+
なった
|
23
|
+
* Nokogiri::HTML::Document#meta_encoding= でメタデータのエンコードを
|
24
|
+
設定できるようになった
|
25
|
+
* Nokogiri::XML::Document#encoding= でドキュメントのエンコードを
|
26
|
+
設定できるようになった
|
27
|
+
* Nokogiri::XML::Schema でドキュメントがXSDのスキーマに沿って記述されているか
|
28
|
+
を検証できるようになった
|
29
|
+
* Nokogiri::XML::RelaxNG でドキュメントがRelaxNGのスキーマに沿って
|
30
|
+
記述されているかを検証できるようになった
|
31
|
+
* Nokogiri::HTML::ElementDescription はHTML要素の説明フェッチ動作するよう
|
32
|
+
になった
|
33
|
+
* Nokogiri::XML::Node#descriptionは ノードの説明をフェッチ動作するよう
|
34
|
+
になった
|
18
35
|
* Nokogiri::XML::Node#accept は Visitor パターンを実行するようになった
|
19
|
-
* bin/nokogiri
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
36
|
+
* 簡単にドキュメントを解析するコマンド bin/nokogiri を追加
|
37
|
+
(Yataka HARAさんに感謝感激)
|
38
|
+
* Nokogiri::XML::NodeSetが更にArrayとEnumerableの演算を
|
39
|
+
サポートするようになった:
|
40
|
+
index, delete, slice, - (差分), + (連結), & (共通部分),
|
41
|
+
push, pop, shift, ==
|
42
|
+
* Nokogiri.XML, Nokogiri.HTML はNokogiri::XML::ParseOptions objectと一緒に
|
43
|
+
呼び出されるブロックを受け入れるようになった
|
24
44
|
* Nokogiri::XML::Node#namespace は Nokogiri::XML::Namespaceを返すようになった
|
25
45
|
* Nokogiri::XML::Node#namespaceはノードの名前空間を設定するようになった
|
26
46
|
* FFI 経由で JRuby 1.3.0 をサポートするようになった
|
@@ -28,13 +48,15 @@
|
|
28
48
|
* バグの修正
|
29
49
|
|
30
50
|
* nilがCDATAsonstructorに渡される際の問題を修正
|
31
|
-
* Fragment メソッドが正規表現を抜け出させるようになった
|
51
|
+
* Fragment メソッドが正規表現を抜け出させるようになった
|
52
|
+
(Joelさんに感謝感激) (LH #73)
|
32
53
|
* Builder スコープのLH #61, LH #74, LH #70に関しての様々な問題を修正
|
33
54
|
* 名前空間を付け加える時、名前空間が LH#78より除去されてしまう問題を修正
|
34
55
|
* 連結しないノードが発生し、再育成してしまう問題を修正(GH#22)
|
35
56
|
* XSLT が解析中にエラーを発見し損なう問題を修正(GH#32)
|
36
57
|
* CSS selectors内での条件属性のバグ問題を修正(GH#36)
|
37
|
-
* Node#before/after/inner_html=で値なしのHTML
|
58
|
+
* Node#before/after/inner_html=で値なしのHTML属性が受け入れられなかった問題を
|
59
|
+
修正 (GH#35)
|
38
60
|
|
39
61
|
=== 1.2.3 / 2009年3月22日
|
40
62
|
|
@@ -53,13 +75,13 @@
|
|
53
75
|
|
54
76
|
* Nokogiri は soap4r と一緒に使う事が可能。(XSD::XMLParser::Nokogiri 参照)
|
55
77
|
* Nokogiri::XML::Node#inner_html= はノードの中のHTMLをセット出来る
|
56
|
-
* Nokogiri
|
78
|
+
* NokogiriのBuilderのインタフェースの改良
|
57
79
|
* Nokogiri::XML::Node#swap は、現在のノードに新しいhtmlを交換する事が出来る
|
58
80
|
|
59
81
|
|
60
82
|
* バグの修正
|
61
83
|
|
62
|
-
*
|
84
|
+
* BuilderAPIのタグのネスティングを修正 (LH #41)
|
63
85
|
* Nokogiri::HTML.fragment はテキストだけのノードを適切に扱う事が出来る(LH #43)
|
64
86
|
* Nokogiri::XML::Node#before はテキストノードのはじめに挿入する事が出来る (LH #44)
|
65
87
|
* Nokogiri::XML::Node#after はテキストノードの文末に挿入する事が出来る
|
@@ -184,7 +206,7 @@
|
|
184
206
|
|
185
207
|
* 弱参照からドキュメント参照へのメモリー管理の変換
|
186
208
|
* メモリリークに接続
|
187
|
-
*
|
209
|
+
* Builderブロックが取り囲んでいるコンテキストから
|
188
210
|
メソッドの呼び出しをする事が出来る
|
189
211
|
|
190
212
|
=== 1.0.3
|
data/CHANGELOG.rdoc
CHANGED
data/README.ja.rdoc
CHANGED
@@ -8,7 +8,11 @@
|
|
8
8
|
|
9
9
|
== DESCRIPTION:
|
10
10
|
|
11
|
-
Nokogiri はHTMLやXMLやSAXやXSLTやReaderのパーサーです。
|
11
|
+
Nokogiri はHTMLやXMLやSAXやXSLTやReaderのパーサーです。Nokogiri はドキュメント
|
12
|
+
をXPath と CSS3 セレクター経由で検索する機能が特徴のひとつ。
|
13
|
+
|
14
|
+
XMLは暴力に似ている - XMLが君の問題を解決しないとしたら、君はXMLを十分に
|
15
|
+
使いこなしていない事になる。
|
12
16
|
|
13
17
|
== FEATURES:
|
14
18
|
|
data/README.rdoc
CHANGED
@@ -8,7 +8,11 @@
|
|
8
8
|
|
9
9
|
== DESCRIPTION:
|
10
10
|
|
11
|
-
Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser.
|
11
|
+
Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's
|
12
|
+
many features is the ability to search documents via XPath or CSS3 selectors.
|
13
|
+
|
14
|
+
XML is like violence - if it doesn’t solve your problems, you are not using
|
15
|
+
enough of it.
|
12
16
|
|
13
17
|
== FEATURES:
|
14
18
|
|
data/Rakefile
CHANGED
@@ -29,7 +29,7 @@ HOE = Hoe.new('nokogiri', Nokogiri::VERSION) do |p|
|
|
29
29
|
]
|
30
30
|
|
31
31
|
p.extra_dev_deps << "racc"
|
32
|
-
p.extra_dev_deps << "
|
32
|
+
p.extra_dev_deps << "rexical"
|
33
33
|
p.extra_dev_deps << "rake-compiler"
|
34
34
|
|
35
35
|
p.spec_extras = { :extensions => ["ext/nokogiri/extconf.rb"] }
|
@@ -74,7 +74,7 @@ require "#{HOE.name}/\#{RUBY_VERSION.sub(/\\.\\d+$/, '')}/#{HOE.name}"
|
|
74
74
|
eoruby
|
75
75
|
end
|
76
76
|
HOE.spec.extensions = []
|
77
|
-
HOE.spec.platform = '
|
77
|
+
HOE.spec.platform = 'x86-mswin32'
|
78
78
|
HOE.spec.files += Dir["lib/#{HOE.name}/#{HOE.name}.rb"]
|
79
79
|
HOE.spec.files += Dir["lib/#{HOE.name}/1.{8,9}/*"]
|
80
80
|
HOE.spec.files += Dir["ext/nokogiri/*.dll"]
|
@@ -119,7 +119,7 @@ file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
|
|
119
119
|
begin
|
120
120
|
racc = `which racc`.strip
|
121
121
|
racc = "#{::Config::CONFIG['bindir']}/racc" if racc.empty?
|
122
|
-
sh "#{racc} -o #{t.name} #{t.prerequisites.first}"
|
122
|
+
sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
|
123
123
|
rescue
|
124
124
|
abort "need racc, sudo gem install racc"
|
125
125
|
end
|
@@ -127,9 +127,9 @@ end
|
|
127
127
|
|
128
128
|
file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
|
129
129
|
begin
|
130
|
-
sh "
|
130
|
+
sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
|
131
131
|
rescue
|
132
|
-
abort "need
|
132
|
+
abort "need rexical, sudo gem install rexical"
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -190,15 +190,15 @@ unless windows || java || ENV['NOKOGIRI_FFI']
|
|
190
190
|
end
|
191
191
|
|
192
192
|
namespace :install do
|
193
|
-
desc "Install
|
194
|
-
task :deps => %w(
|
193
|
+
desc "Install rex and racc for development"
|
194
|
+
task :deps => %w(rexical racc)
|
195
195
|
|
196
196
|
task :racc do |t|
|
197
197
|
sh "sudo gem install racc"
|
198
198
|
end
|
199
199
|
|
200
|
-
task :
|
201
|
-
sh "sudo gem install
|
200
|
+
task :rexical do
|
201
|
+
sh "sudo gem install rexical"
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -22,17 +22,35 @@ end
|
|
22
22
|
$CFLAGS << " -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline"
|
23
23
|
|
24
24
|
HEADER_DIRS = [
|
25
|
-
|
26
|
-
|
25
|
+
# First search /opt/local for macports
|
26
|
+
'/opt/local/include',
|
27
|
+
'/opt/local/include/libxml2',
|
28
|
+
|
29
|
+
# Then search /usr/local for people that installed from source
|
30
|
+
'/usr/local/include',
|
27
31
|
'/usr/local/include/libxml2',
|
32
|
+
|
33
|
+
# Check the ruby install locations
|
34
|
+
INCLUDEDIR,
|
35
|
+
File.join(INCLUDEDIR, "libxml2"),
|
36
|
+
|
37
|
+
# Finally fall back to /usr
|
38
|
+
'/usr/include',
|
28
39
|
'/usr/include/libxml2',
|
29
40
|
]
|
30
41
|
|
31
42
|
LIB_DIRS = [
|
32
|
-
|
43
|
+
# First search /opt/local for macports
|
33
44
|
'/opt/local/lib',
|
45
|
+
|
46
|
+
# Then search /usr/local for people that installed from source
|
34
47
|
'/usr/local/lib',
|
35
|
-
|
48
|
+
|
49
|
+
# Check the ruby install locations
|
50
|
+
LIBDIR,
|
51
|
+
|
52
|
+
# Finally fall back to /usr
|
53
|
+
'/usr/lib',
|
36
54
|
]
|
37
55
|
|
38
56
|
iconv_dirs = dir_config('iconv', '/opt/local/include', '/opt/local/lib')
|
@@ -80,6 +98,11 @@ unless find_library('exslt', 'exsltFuncRegister', *LIB_DIRS)
|
|
80
98
|
abort "libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'"
|
81
99
|
end
|
82
100
|
|
101
|
+
have_func('xmlRelaxNGSetParserStructuredErrors')
|
102
|
+
have_func('xmlRelaxNGSetValidStructuredErrors')
|
103
|
+
have_func('xmlSchemaSetValidStructuredErrors')
|
104
|
+
have_func('xmlSchemaSetParserStructuredErrors')
|
105
|
+
|
83
106
|
if ENV['CPUPROFILE']
|
84
107
|
unless find_library('profiler', 'ProfilerEnable', *LIB_DIRS)
|
85
108
|
abort "google performance tools are not installed"
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -49,6 +49,11 @@ VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node)
|
|
49
49
|
|
50
50
|
VALUE ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, 0, node);
|
51
51
|
|
52
|
+
VALUE document = DOC_RUBY_OBJECT(doc);
|
53
|
+
|
54
|
+
VALUE node_cache = rb_iv_get(document, "@node_cache");
|
55
|
+
rb_ary_push(node_cache, ns);
|
56
|
+
|
52
57
|
rb_iv_set(ns, "@document", DOC_RUBY_OBJECT(doc));
|
53
58
|
|
54
59
|
node->_private = (void *)ns;
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -807,57 +807,44 @@ VALUE Nokogiri_wrap_xml_node(VALUE klass, xmlNodePtr node)
|
|
807
807
|
if(RTEST(klass))
|
808
808
|
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
809
809
|
|
810
|
-
|
810
|
+
else switch(node->type)
|
811
811
|
{
|
812
812
|
case XML_ELEMENT_NODE:
|
813
813
|
klass = cNokogiriXmlElement;
|
814
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
815
814
|
break;
|
816
815
|
case XML_TEXT_NODE:
|
817
816
|
klass = cNokogiriXmlText;
|
818
|
-
|
817
|
+
break;
|
818
|
+
case XML_ATTRIBUTE_NODE:
|
819
|
+
klass = cNokogiriXmlAttr;
|
819
820
|
break;
|
820
821
|
case XML_ENTITY_REF_NODE:
|
821
822
|
klass = cNokogiriXmlEntityReference;
|
822
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
823
823
|
break;
|
824
824
|
case XML_COMMENT_NODE:
|
825
825
|
klass = cNokogiriXmlComment;
|
826
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
827
826
|
break;
|
828
827
|
case XML_DOCUMENT_FRAG_NODE:
|
829
828
|
klass = cNokogiriXmlDocumentFragment;
|
830
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
831
829
|
break;
|
832
830
|
case XML_PI_NODE:
|
833
831
|
klass = cNokogiriXmlProcessingInstruction;
|
834
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
835
|
-
break;
|
836
|
-
case XML_ATTRIBUTE_NODE:
|
837
|
-
klass = cNokogiriXmlAttr;
|
838
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
839
832
|
break;
|
840
833
|
case XML_ENTITY_DECL:
|
841
834
|
klass = cNokogiriXmlEntityDeclaration;
|
842
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
843
835
|
break;
|
844
836
|
case XML_CDATA_SECTION_NODE:
|
845
837
|
klass = cNokogiriXmlCData;
|
846
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
847
838
|
break;
|
848
839
|
case XML_DTD_NODE:
|
849
840
|
klass = rb_const_get(mNokogiriXml, rb_intern("DTD"));
|
850
|
-
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
851
841
|
break;
|
852
842
|
default:
|
853
|
-
|
854
|
-
cNokogiriXmlNode,
|
855
|
-
mark,
|
856
|
-
debug_node_dealloc,
|
857
|
-
node
|
858
|
-
);
|
843
|
+
klass = cNokogiriXmlNode;
|
859
844
|
}
|
860
845
|
|
846
|
+
rb_node = Data_Wrap_Struct(klass, mark, debug_node_dealloc, node) ;
|
847
|
+
|
861
848
|
node->_private = (void *)rb_node;
|
862
849
|
|
863
850
|
if (DOC_RUBY_OBJECT_TEST(node->doc) && DOC_RUBY_OBJECT(node->doc)) {
|
@@ -866,7 +853,6 @@ VALUE Nokogiri_wrap_xml_node(VALUE klass, xmlNodePtr node)
|
|
866
853
|
}
|
867
854
|
|
868
855
|
rb_ary_push(node_cache, rb_node);
|
869
|
-
//rb_iv_set(rb_node, "@document", document);
|
870
856
|
rb_funcall(document, rb_intern("decorate"), 1, rb_node);
|
871
857
|
|
872
858
|
return rb_node ;
|
data/ext/nokogiri/xml_relax_ng.c
CHANGED
@@ -30,13 +30,13 @@ static VALUE validate_document(VALUE self, VALUE document)
|
|
30
30
|
rb_raise(rb_eRuntimeError, "Could not create a validation context");
|
31
31
|
}
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
#ifdef HAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS
|
34
|
+
xmlRelaxNGSetValidStructuredErrors(
|
35
|
+
valid_ctxt,
|
36
|
+
Nokogiri_error_array_pusher,
|
37
|
+
(void *)errors
|
38
|
+
);
|
39
|
+
#endif
|
40
40
|
|
41
41
|
xmlRelaxNGValidateDoc(valid_ctxt, doc);
|
42
42
|
|
@@ -61,13 +61,13 @@ static VALUE read_memory(VALUE klass, VALUE content)
|
|
61
61
|
VALUE errors = rb_ary_new();
|
62
62
|
xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
#ifdef HAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS
|
65
|
+
xmlRelaxNGSetParserStructuredErrors(
|
66
|
+
ctx,
|
67
|
+
Nokogiri_error_array_pusher,
|
68
|
+
(void *)errors
|
69
|
+
);
|
70
|
+
#endif
|
71
71
|
|
72
72
|
xmlRelaxNGPtr schema = xmlRelaxNGParse(ctx);
|
73
73
|
|
data/ext/nokogiri/xml_schema.c
CHANGED
@@ -30,13 +30,13 @@ static VALUE validate_document(VALUE self, VALUE document)
|
|
30
30
|
rb_raise(rb_eRuntimeError, "Could not create a validation context");
|
31
31
|
}
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
#ifdef HAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS
|
34
|
+
xmlSchemaSetValidStructuredErrors(
|
35
|
+
valid_ctxt,
|
36
|
+
Nokogiri_error_array_pusher,
|
37
|
+
(void *)errors
|
38
|
+
);
|
39
|
+
#endif
|
40
40
|
|
41
41
|
xmlSchemaValidateDoc(valid_ctxt, doc);
|
42
42
|
|
@@ -62,13 +62,13 @@ static VALUE read_memory(VALUE klass, VALUE content)
|
|
62
62
|
VALUE errors = rb_ary_new();
|
63
63
|
xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
#ifdef HAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS
|
66
|
+
xmlSchemaSetParserStructuredErrors(
|
67
|
+
ctx,
|
68
|
+
Nokogiri_error_array_pusher,
|
69
|
+
(void *)errors
|
70
|
+
);
|
71
|
+
#endif
|
72
72
|
|
73
73
|
xmlSchemaPtr schema = xmlSchemaParse(ctx);
|
74
74
|
|
@@ -271,78 +271,59 @@ Racc_debug_parser = false
|
|
271
271
|
|
272
272
|
# reduce 0 omitted
|
273
273
|
|
274
|
-
|
275
|
-
|
276
|
-
result = [val.first, val.last].flatten
|
274
|
+
def _reduce_1(val, _values, result)
|
275
|
+
result = [val.first, val.last].flatten
|
277
276
|
|
278
277
|
result
|
279
|
-
|
280
|
-
.,.,
|
278
|
+
end
|
281
279
|
|
282
|
-
|
283
|
-
|
284
|
-
result = val.flatten
|
280
|
+
def _reduce_2(val, _values, result)
|
281
|
+
result = val.flatten
|
285
282
|
result
|
286
|
-
|
287
|
-
.,.,
|
283
|
+
end
|
288
284
|
|
289
|
-
|
290
|
-
|
291
|
-
result = :DIRECT_ADJACENT_SELECTOR
|
285
|
+
def _reduce_3(val, _values, result)
|
286
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
292
287
|
result
|
293
|
-
|
294
|
-
.,.,
|
288
|
+
end
|
295
289
|
|
296
|
-
|
297
|
-
|
298
|
-
result = :CHILD_SELECTOR
|
290
|
+
def _reduce_4(val, _values, result)
|
291
|
+
result = :CHILD_SELECTOR
|
299
292
|
result
|
300
|
-
|
301
|
-
.,.,
|
293
|
+
end
|
302
294
|
|
303
|
-
|
304
|
-
|
305
|
-
result = :PRECEDING_SELECTOR
|
295
|
+
def _reduce_5(val, _values, result)
|
296
|
+
result = :PRECEDING_SELECTOR
|
306
297
|
result
|
307
|
-
|
308
|
-
.,.,
|
298
|
+
end
|
309
299
|
|
310
|
-
|
311
|
-
|
312
|
-
result = :DESCENDANT_SELECTOR
|
300
|
+
def _reduce_6(val, _values, result)
|
301
|
+
result = :DESCENDANT_SELECTOR
|
313
302
|
result
|
314
|
-
|
315
|
-
.,.,
|
303
|
+
end
|
316
304
|
|
317
|
-
|
318
|
-
|
319
|
-
result = :DESCENDANT_SELECTOR
|
305
|
+
def _reduce_7(val, _values, result)
|
306
|
+
result = :DESCENDANT_SELECTOR
|
320
307
|
result
|
321
|
-
|
322
|
-
.,.,
|
308
|
+
end
|
323
309
|
|
324
|
-
|
325
|
-
|
326
|
-
result = :CHILD_SELECTOR
|
310
|
+
def _reduce_8(val, _values, result)
|
311
|
+
result = :CHILD_SELECTOR
|
327
312
|
result
|
328
|
-
|
329
|
-
.,.,
|
313
|
+
end
|
330
314
|
|
331
|
-
|
332
|
-
|
333
|
-
result = if val[1].nil?
|
315
|
+
def _reduce_9(val, _values, result)
|
316
|
+
result = if val[1].nil?
|
334
317
|
val.first
|
335
318
|
else
|
336
319
|
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
337
320
|
end
|
338
321
|
|
339
322
|
result
|
340
|
-
|
341
|
-
.,.,
|
323
|
+
end
|
342
324
|
|
343
|
-
|
344
|
-
|
345
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
325
|
+
def _reduce_10(val, _values, result)
|
326
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
346
327
|
[
|
347
328
|
val.first,
|
348
329
|
Node.new(:COMBINATOR, [val[1], val.last])
|
@@ -350,30 +331,24 @@ module_eval(<<'.,.,', 'parser.y', 30)
|
|
350
331
|
)
|
351
332
|
|
352
333
|
result
|
353
|
-
|
354
|
-
.,.,
|
334
|
+
end
|
355
335
|
|
356
|
-
|
357
|
-
|
358
|
-
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
336
|
+
def _reduce_11(val, _values, result)
|
337
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
359
338
|
|
360
339
|
result
|
361
|
-
|
362
|
-
.,.,
|
340
|
+
end
|
363
341
|
|
364
342
|
# reduce 12 omitted
|
365
343
|
|
366
|
-
|
367
|
-
|
368
|
-
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
344
|
+
def _reduce_13(val, _values, result)
|
345
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
369
346
|
|
370
347
|
result
|
371
|
-
|
372
|
-
.,.,
|
348
|
+
end
|
373
349
|
|
374
|
-
|
375
|
-
|
376
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
350
|
+
def _reduce_14(val, _values, result)
|
351
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
377
352
|
[
|
378
353
|
Node.new(:ELEMENT_NAME, ['*']),
|
379
354
|
Node.new(:COMBINATOR, val)
|
@@ -381,162 +356,126 @@ module_eval(<<'.,.,', 'parser.y', 45)
|
|
381
356
|
)
|
382
357
|
|
383
358
|
result
|
384
|
-
|
385
|
-
.,.,
|
359
|
+
end
|
386
360
|
|
387
|
-
|
388
|
-
|
389
|
-
result = Node.new(:CONDITIONAL_SELECTOR,
|
361
|
+
def _reduce_15(val, _values, result)
|
362
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
390
363
|
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
391
364
|
)
|
392
365
|
|
393
366
|
result
|
394
|
-
|
395
|
-
.,.,
|
367
|
+
end
|
396
368
|
|
397
|
-
|
398
|
-
|
399
|
-
result = Node.new(val[1], [val.first, val.last])
|
369
|
+
def _reduce_16(val, _values, result)
|
370
|
+
result = Node.new(val[1], [val.first, val.last])
|
400
371
|
|
401
372
|
result
|
402
|
-
|
403
|
-
.,.,
|
373
|
+
end
|
404
374
|
|
405
375
|
# reduce 17 omitted
|
406
376
|
|
407
|
-
|
408
|
-
|
409
|
-
result = Node.new(:CLASS_CONDITION, [val[1]])
|
377
|
+
def _reduce_18(val, _values, result)
|
378
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
410
379
|
result
|
411
|
-
|
412
|
-
.,.,
|
380
|
+
end
|
413
381
|
|
414
|
-
|
415
|
-
|
416
|
-
result = Node.new(:ELEMENT_NAME,
|
382
|
+
def _reduce_19(val, _values, result)
|
383
|
+
result = Node.new(:ELEMENT_NAME,
|
417
384
|
[[val.first, val.last].compact.join(':')]
|
418
385
|
)
|
419
386
|
|
420
387
|
result
|
421
|
-
|
422
|
-
.,.,
|
388
|
+
end
|
423
389
|
|
424
|
-
|
425
|
-
|
426
|
-
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
390
|
+
def _reduce_20(val, _values, result)
|
391
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
427
392
|
result = Node.new(:ELEMENT_NAME, [name])
|
428
393
|
|
429
394
|
result
|
430
|
-
|
431
|
-
.,.,
|
395
|
+
end
|
432
396
|
|
433
|
-
|
434
|
-
|
435
|
-
result = Node.new(:ELEMENT_NAME, val)
|
397
|
+
def _reduce_21(val, _values, result)
|
398
|
+
result = Node.new(:ELEMENT_NAME, val)
|
436
399
|
result
|
437
|
-
|
438
|
-
.,.,
|
400
|
+
end
|
439
401
|
|
440
|
-
|
441
|
-
|
442
|
-
result = val[0]
|
402
|
+
def _reduce_22(val, _values, result)
|
403
|
+
result = val[0]
|
443
404
|
result
|
444
|
-
|
445
|
-
.,.,
|
405
|
+
end
|
446
406
|
|
447
407
|
# reduce 23 omitted
|
448
408
|
|
449
|
-
|
450
|
-
|
451
|
-
result = Node.new(:ATTRIBUTE_CONDITION,
|
409
|
+
def _reduce_24(val, _values, result)
|
410
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
452
411
|
[Node.new(:ELEMENT_NAME, [val[1]])] + (val[2] || [])
|
453
412
|
)
|
454
413
|
|
455
414
|
result
|
456
|
-
|
457
|
-
.,.,
|
415
|
+
end
|
458
416
|
|
459
|
-
|
460
|
-
|
461
|
-
result = Node.new(:ATTRIBUTE_CONDITION,
|
417
|
+
def _reduce_25(val, _values, result)
|
418
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
462
419
|
[val[1]] + (val[2] || [])
|
463
420
|
)
|
464
421
|
|
465
422
|
result
|
466
|
-
|
467
|
-
.,.,
|
423
|
+
end
|
468
424
|
|
469
|
-
|
470
|
-
|
471
|
-
# Non standard, but hpricot supports it.
|
425
|
+
def _reduce_26(val, _values, result)
|
426
|
+
# Non standard, but hpricot supports it.
|
472
427
|
result = Node.new(:PSEUDO_CLASS,
|
473
428
|
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
474
429
|
)
|
475
430
|
|
476
431
|
result
|
477
|
-
|
478
|
-
.,.,
|
432
|
+
end
|
479
433
|
|
480
|
-
|
481
|
-
|
482
|
-
result = Node.new(:FUNCTION, [val.first.strip])
|
434
|
+
def _reduce_27(val, _values, result)
|
435
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
483
436
|
|
484
437
|
result
|
485
|
-
|
486
|
-
.,.,
|
438
|
+
end
|
487
439
|
|
488
|
-
|
489
|
-
|
490
|
-
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
440
|
+
def _reduce_28(val, _values, result)
|
441
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
491
442
|
|
492
443
|
result
|
493
|
-
|
494
|
-
.,.,
|
444
|
+
end
|
495
445
|
|
496
|
-
|
497
|
-
|
498
|
-
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
446
|
+
def _reduce_29(val, _values, result)
|
447
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
499
448
|
|
500
449
|
result
|
501
|
-
|
502
|
-
.,.,
|
450
|
+
end
|
503
451
|
|
504
|
-
|
505
|
-
|
506
|
-
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
452
|
+
def _reduce_30(val, _values, result)
|
453
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
507
454
|
|
508
455
|
result
|
509
|
-
|
510
|
-
.,.,
|
456
|
+
end
|
511
457
|
|
512
|
-
|
513
|
-
|
514
|
-
result = [val.first, val.last]
|
458
|
+
def _reduce_31(val, _values, result)
|
459
|
+
result = [val.first, val.last]
|
515
460
|
result
|
516
|
-
|
517
|
-
.,.,
|
461
|
+
end
|
518
462
|
|
519
|
-
|
520
|
-
|
521
|
-
result = [val.first, val.last]
|
463
|
+
def _reduce_32(val, _values, result)
|
464
|
+
result = [val.first, val.last]
|
522
465
|
result
|
523
|
-
|
524
|
-
.,.,
|
466
|
+
end
|
525
467
|
|
526
|
-
|
527
|
-
|
528
|
-
result = [val.first, val.last]
|
468
|
+
def _reduce_33(val, _values, result)
|
469
|
+
result = [val.first, val.last]
|
529
470
|
result
|
530
|
-
|
531
|
-
.,.,
|
471
|
+
end
|
532
472
|
|
533
473
|
# reduce 34 omitted
|
534
474
|
|
535
475
|
# reduce 35 omitted
|
536
476
|
|
537
|
-
|
538
|
-
|
539
|
-
if val[0] == 'even'
|
477
|
+
def _reduce_36(val, _values, result)
|
478
|
+
if val[0] == 'even'
|
540
479
|
val = ["2","n","+","0"]
|
541
480
|
result = Node.new(:AN_PLUS_B, val)
|
542
481
|
elsif val[0] == 'odd'
|
@@ -551,24 +490,20 @@ module_eval(<<'.,.,', 'parser.y', 123)
|
|
551
490
|
end
|
552
491
|
|
553
492
|
result
|
554
|
-
|
555
|
-
.,.,
|
493
|
+
end
|
556
494
|
|
557
|
-
|
558
|
-
|
559
|
-
if val[1] == 'n'
|
495
|
+
def _reduce_37(val, _values, result)
|
496
|
+
if val[1] == 'n'
|
560
497
|
result = Node.new(:AN_PLUS_B, val)
|
561
498
|
else
|
562
499
|
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
563
500
|
end
|
564
501
|
|
565
502
|
result
|
566
|
-
|
567
|
-
.,.,
|
503
|
+
end
|
568
504
|
|
569
|
-
|
570
|
-
|
571
|
-
# n+3, -n+3
|
505
|
+
def _reduce_38(val, _values, result)
|
506
|
+
# n+3, -n+3
|
572
507
|
if val[0] == 'n'
|
573
508
|
val.unshift("1")
|
574
509
|
result = Node.new(:AN_PLUS_B, val)
|
@@ -581,12 +516,10 @@ module_eval(<<'.,.,', 'parser.y', 147)
|
|
581
516
|
end
|
582
517
|
|
583
518
|
result
|
584
|
-
|
585
|
-
.,.,
|
519
|
+
end
|
586
520
|
|
587
|
-
|
588
|
-
|
589
|
-
if val[1] == 'n'
|
521
|
+
def _reduce_39(val, _values, result)
|
522
|
+
if val[1] == 'n'
|
590
523
|
val << "+"
|
591
524
|
val << "0"
|
592
525
|
result = Node.new(:AN_PLUS_B, val)
|
@@ -595,59 +528,46 @@ module_eval(<<'.,.,', 'parser.y', 161)
|
|
595
528
|
end
|
596
529
|
|
597
530
|
result
|
598
|
-
|
599
|
-
.,.,
|
531
|
+
end
|
600
532
|
|
601
|
-
|
602
|
-
|
603
|
-
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
533
|
+
def _reduce_40(val, _values, result)
|
534
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
604
535
|
|
605
536
|
result
|
606
|
-
|
607
|
-
.,.,
|
537
|
+
end
|
608
538
|
|
609
|
-
|
610
|
-
|
611
|
-
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
539
|
+
def _reduce_41(val, _values, result)
|
540
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
612
541
|
result
|
613
|
-
|
614
|
-
.,.,
|
542
|
+
end
|
615
543
|
|
616
544
|
# reduce 42 omitted
|
617
545
|
|
618
546
|
# reduce 43 omitted
|
619
547
|
|
620
|
-
|
621
|
-
|
622
|
-
result = Node.new(:COMBINATOR, val)
|
548
|
+
def _reduce_44(val, _values, result)
|
549
|
+
result = Node.new(:COMBINATOR, val)
|
623
550
|
|
624
551
|
result
|
625
|
-
|
626
|
-
.,.,
|
552
|
+
end
|
627
553
|
|
628
|
-
|
629
|
-
|
630
|
-
result = Node.new(:COMBINATOR, val)
|
554
|
+
def _reduce_45(val, _values, result)
|
555
|
+
result = Node.new(:COMBINATOR, val)
|
631
556
|
|
632
557
|
result
|
633
|
-
|
634
|
-
.,.,
|
558
|
+
end
|
635
559
|
|
636
|
-
|
637
|
-
|
638
|
-
result = Node.new(:COMBINATOR, val)
|
560
|
+
def _reduce_46(val, _values, result)
|
561
|
+
result = Node.new(:COMBINATOR, val)
|
639
562
|
|
640
563
|
result
|
641
|
-
|
642
|
-
.,.,
|
564
|
+
end
|
643
565
|
|
644
|
-
|
645
|
-
|
646
|
-
result = Node.new(:COMBINATOR, val)
|
566
|
+
def _reduce_47(val, _values, result)
|
567
|
+
result = Node.new(:COMBINATOR, val)
|
647
568
|
|
648
569
|
result
|
649
|
-
|
650
|
-
.,.,
|
570
|
+
end
|
651
571
|
|
652
572
|
# reduce 48 omitted
|
653
573
|
|
@@ -657,85 +577,63 @@ module_eval(<<'.,.,', 'parser.y', 191)
|
|
657
577
|
|
658
578
|
# reduce 51 omitted
|
659
579
|
|
660
|
-
|
661
|
-
|
662
|
-
result = Node.new(:ID, val)
|
580
|
+
def _reduce_52(val, _values, result)
|
581
|
+
result = Node.new(:ID, val)
|
663
582
|
result
|
664
|
-
|
665
|
-
.,.,
|
583
|
+
end
|
666
584
|
|
667
|
-
|
668
|
-
|
669
|
-
result = [val.first, val[1]]
|
585
|
+
def _reduce_53(val, _values, result)
|
586
|
+
result = [val.first, val[1]]
|
670
587
|
result
|
671
|
-
|
672
|
-
.,.,
|
588
|
+
end
|
673
589
|
|
674
|
-
|
675
|
-
|
676
|
-
result = [val.first, val[1]]
|
590
|
+
def _reduce_54(val, _values, result)
|
591
|
+
result = [val.first, val[1]]
|
677
592
|
result
|
678
|
-
|
679
|
-
.,.,
|
593
|
+
end
|
680
594
|
|
681
595
|
# reduce 55 omitted
|
682
596
|
|
683
|
-
|
684
|
-
|
685
|
-
result = :equal
|
597
|
+
def _reduce_56(val, _values, result)
|
598
|
+
result = :equal
|
686
599
|
result
|
687
|
-
|
688
|
-
.,.,
|
600
|
+
end
|
689
601
|
|
690
|
-
|
691
|
-
|
692
|
-
result = :prefix_match
|
602
|
+
def _reduce_57(val, _values, result)
|
603
|
+
result = :prefix_match
|
693
604
|
result
|
694
|
-
|
695
|
-
.,.,
|
605
|
+
end
|
696
606
|
|
697
|
-
|
698
|
-
|
699
|
-
result = :suffix_match
|
607
|
+
def _reduce_58(val, _values, result)
|
608
|
+
result = :suffix_match
|
700
609
|
result
|
701
|
-
|
702
|
-
.,.,
|
610
|
+
end
|
703
611
|
|
704
|
-
|
705
|
-
|
706
|
-
result = :substring_match
|
612
|
+
def _reduce_59(val, _values, result)
|
613
|
+
result = :substring_match
|
707
614
|
result
|
708
|
-
|
709
|
-
.,.,
|
615
|
+
end
|
710
616
|
|
711
|
-
|
712
|
-
|
713
|
-
result = :not_equal
|
617
|
+
def _reduce_60(val, _values, result)
|
618
|
+
result = :not_equal
|
714
619
|
result
|
715
|
-
|
716
|
-
.,.,
|
620
|
+
end
|
717
621
|
|
718
|
-
|
719
|
-
|
720
|
-
result = :includes
|
622
|
+
def _reduce_61(val, _values, result)
|
623
|
+
result = :includes
|
721
624
|
result
|
722
|
-
|
723
|
-
.,.,
|
625
|
+
end
|
724
626
|
|
725
|
-
|
726
|
-
|
727
|
-
result = :dash_match
|
627
|
+
def _reduce_62(val, _values, result)
|
628
|
+
result = :dash_match
|
728
629
|
result
|
729
|
-
|
730
|
-
.,.,
|
630
|
+
end
|
731
631
|
|
732
|
-
|
733
|
-
|
734
|
-
result = Node.new(:NOT, [val[1]])
|
632
|
+
def _reduce_63(val, _values, result)
|
633
|
+
result = Node.new(:NOT, [val[1]])
|
735
634
|
|
736
635
|
result
|
737
|
-
|
738
|
-
.,.,
|
636
|
+
end
|
739
637
|
|
740
638
|
# reduce 64 omitted
|
741
639
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
#--
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by rex 1.0.
|
3
|
+
# This file is automatically generated by rex 1.0.3
|
4
4
|
# from lexical definition file "lib/nokogiri/css/tokenizer.rex".
|
5
|
-
|
5
|
+
#++
|
6
6
|
|
7
7
|
module Nokogiri
|
8
8
|
module CSS
|
@@ -122,7 +122,7 @@ class GeneratedTokenizer < GeneratedParser
|
|
122
122
|
when (text = ss.scan(/[\s\t\r\n\f]+/))
|
123
123
|
@rex_tokens.push action { [:S, text] }
|
124
124
|
|
125
|
-
when (text = ss.scan(/"([^\n\r\f"]
|
125
|
+
when (text = ss.scan(/"([^\n\r\f"]|\n|\r\n|\r|\f|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s\n\r\t\f])?|\\[^\n\r\f0-9A-Fa-f])*"|'([^\n\r\f']|\n|\r\n|\r|\f|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s\n\r\t\f])?|\\[^\n\r\f0-9A-Fa-f])*'/))
|
126
126
|
@rex_tokens.push action { [:STRING, text] }
|
127
127
|
|
128
128
|
when (text = ss.scan(/./))
|
@@ -5,17 +5,17 @@ class GeneratedTokenizer < GeneratedParser
|
|
5
5
|
macro
|
6
6
|
nl \n|\r\n|\r|\f
|
7
7
|
w [\s\r\n\f]*
|
8
|
-
nonascii [
|
8
|
+
nonascii [^\0-\177]
|
9
9
|
num -?([0-9]+|[0-9]*\.[0-9]+)
|
10
|
-
unicode
|
10
|
+
unicode \\[0-9A-Fa-f]{1,6}(\r\n|[\s\n\r\t\f])?
|
11
11
|
|
12
|
-
escape {unicode}
|
12
|
+
escape {unicode}|\\[^\n\r\f0-9A-Fa-f]
|
13
13
|
nmchar [_A-Za-z0-9-]|{nonascii}|{escape}
|
14
14
|
nmstart [_A-Za-z]|{nonascii}|{escape}
|
15
15
|
ident [-@]?({nmstart})({nmchar})*
|
16
16
|
name ({nmchar})+
|
17
|
-
string1 "([^\n\r\f"]
|
18
|
-
string2 '([^\n\r\f']
|
17
|
+
string1 "([^\n\r\f"]|{nl}|{nonascii}|{escape})*"
|
18
|
+
string2 '([^\n\r\f']|{nl}|{nonascii}|{escape})*'
|
19
19
|
string {string1}|{string2}
|
20
20
|
|
21
21
|
rule
|
data/lib/nokogiri/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Nokogiri
|
2
2
|
# The version of Nokogiri you are using
|
3
|
-
VERSION = '1.3.
|
3
|
+
VERSION = '1.3.1'
|
4
4
|
|
5
5
|
# More complete version information about libxml
|
6
6
|
VERSION_INFO = {}
|
@@ -19,8 +19,12 @@ module Nokogiri
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.uses_libxml? # :nodoc:
|
23
|
+
!Nokogiri::VERSION_INFO['libxml'].nil?
|
24
|
+
end
|
25
|
+
|
22
26
|
def self.ffi? # :nodoc:
|
23
|
-
Nokogiri::VERSION_INFO['libxml']['binding'] == 'ffi'
|
27
|
+
uses_libxml? && Nokogiri::VERSION_INFO['libxml']['binding'] == 'ffi'
|
24
28
|
end
|
25
29
|
|
26
30
|
def self.is_2_6_16? # :nodoc:
|
data/lib/nokogiri/xml/node.rb
CHANGED
@@ -324,7 +324,7 @@ module Nokogiri
|
|
324
324
|
def namespaces
|
325
325
|
Hash[*namespace_definitions.map { |nd|
|
326
326
|
key = ['xmlns', nd.prefix].compact.join(':')
|
327
|
-
if
|
327
|
+
if RUBY_VERSION >= '1.9' && document.encoding
|
328
328
|
begin
|
329
329
|
key.force_encoding document.encoding
|
330
330
|
rescue ArgumentError
|
@@ -743,3 +743,5 @@ Please change to Node#write_xml_to(io, :encoding => #{options})
|
|
743
743
|
end
|
744
744
|
end
|
745
745
|
end
|
746
|
+
|
747
|
+
class Nokogiri::XML::Element < Nokogiri::XML::Node ; end
|
data/test/css/test_tokenizer.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
|
2
4
|
|
3
5
|
module Nokogiri
|
@@ -8,6 +10,11 @@ module Nokogiri
|
|
8
10
|
@scanner = Nokogiri::CSS::Tokenizer.new
|
9
11
|
end
|
10
12
|
|
13
|
+
def test_unicode
|
14
|
+
@scanner.scan("a日本語")
|
15
|
+
assert_tokens([[:IDENT, 'a日本語']], @scanner)
|
16
|
+
end
|
17
|
+
|
11
18
|
def test_tokenize_bad_single_quote
|
12
19
|
@scanner.scan("'")
|
13
20
|
assert_tokens([["'", "'"]], @scanner)
|
data/test/test_reader.rb
CHANGED
@@ -71,7 +71,7 @@ class TestReader < Nokogiri::TestCase
|
|
71
71
|
</x>
|
72
72
|
eoxml
|
73
73
|
reader = Nokogiri::XML::Reader(xml)
|
74
|
-
if Nokogiri
|
74
|
+
if Nokogiri.ffi?
|
75
75
|
assert_not_nil reader.source
|
76
76
|
assert reader.source.is_a?(FFI::MemoryPointer)
|
77
77
|
else
|
data/test/xml/test_namespace.rb
CHANGED
@@ -11,6 +11,11 @@ module Nokogiri
|
|
11
11
|
eoxml
|
12
12
|
end
|
13
13
|
|
14
|
+
def test_namespace_is_in_node_cache
|
15
|
+
node = @xml.root.namespace
|
16
|
+
assert @xml.instance_variable_get(:@node_cache).include?(node)
|
17
|
+
end
|
18
|
+
|
14
19
|
def test_namespace_node_prefix
|
15
20
|
namespaces = @xml.root.namespace_definitions
|
16
21
|
assert_equal [nil, 'foo'], namespaces.map { |x| x.prefix }
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-06-07 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version: "0"
|
25
25
|
version:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
27
|
+
name: rexical
|
28
28
|
type: :development
|
29
29
|
version_requirement:
|
30
30
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -53,7 +53,10 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.12.2
|
55
55
|
version:
|
56
|
-
description: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser.
|
56
|
+
description: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's\n\
|
57
|
+
many features is the ability to search documents via XPath or CSS3 selectors.\n\n\
|
58
|
+
XML is like violence - if it doesn\xE2\x80\x99t solve your problems, you are not using\n\
|
59
|
+
enough of it."
|
57
60
|
email:
|
58
61
|
- aaronp@rubyforge.org
|
59
62
|
- mike.dalessio@gmail.com
|
@@ -344,7 +347,7 @@ rubyforge_project: nokogiri
|
|
344
347
|
rubygems_version: 1.3.3
|
345
348
|
signing_key:
|
346
349
|
specification_version: 3
|
347
|
-
summary: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser
|
350
|
+
summary: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser"
|
348
351
|
test_files:
|
349
352
|
- test/css/test_nthiness.rb
|
350
353
|
- test/css/test_parser.rb
|