meteor 0.9.8.4 → 0.9.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/demo/demo_html4.rb +6 -8
- data/demo/demo_html5.rb +4 -4
- data/demo/demo_xhtml4.rb +4 -4
- data/demo/demo_xhtml5.rb +4 -4
- data/lib/meteor.rb +323 -324
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd6ded69e48a76c934b6bda41de96b34433d7355
|
4
|
+
data.tar.gz: 3bbcf8dc83328e7740c19cfa6e1a2db34bfbb37a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9e5bb531990ea461bf5f17d72612a3401dbbc470bc4f40a72e45a8c20eaf2aeb3359d47a33f7ff81bb0391fd8a12487d29446c3ca8fde732d492a5217e331f7
|
7
|
+
data.tar.gz: 34f7f51659f1009ed187a45c80afc4f603c590280bf0a9db5bb596846b6559030755a886671d15631ca7e3414479ff9d0b40e1823708fbfc94c6af3c45e54a14
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ DOMのように全体をオブジェクトのツリー構造に変換するの
|
|
39
39
|
必要は全くありません。)
|
40
40
|
|
41
41
|
## API
|
42
|
-
http://rubydoc.info/github/asip/meteor/
|
42
|
+
http://rubydoc.info/github/asip/meteor/frames
|
43
43
|
|
44
44
|
## Gem
|
45
45
|
https://rubygems.org/gems/meteor
|
@@ -54,4 +54,4 @@ Licensed under the LGPL V2.1.
|
|
54
54
|
Yasumasa Ashida (ys.ashida@gmail.com)
|
55
55
|
|
56
56
|
## Copyright
|
57
|
-
(c) 2008-
|
57
|
+
(c) 2008-2016 Yasumasa Ashida
|
data/demo/demo_html4.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#require 'rubygems'
|
5
5
|
require 'meteor'
|
6
6
|
|
7
|
-
#Meteor::ElementFactory.
|
7
|
+
#Meteor::ElementFactory.link(:html,'ml/sample_4.html', 'UTF-8')
|
8
8
|
Meteor::ElementFactory.options= {type: :html4}
|
9
9
|
Meteor::ElementFactory.link('ml/sample_4.html')
|
10
10
|
|
@@ -33,7 +33,7 @@ elm_text1 = root.element('input', id: 'text1')
|
|
33
33
|
#elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
|
34
34
|
elm_text1.attrs = {value: 'メモ', disabled: true, readonly: true}
|
35
35
|
#puts elm_text1.attrs
|
36
|
-
#elm_text1['disabled'] = nil
|
36
|
+
#elm_text1['disabled'] = nil #elm_text1.remove_attr('disabled')
|
37
37
|
#map = elm_text1.attr_map
|
38
38
|
#map.names.each { |item|
|
39
39
|
# puts item
|
@@ -45,18 +45,16 @@ elm_text1.attrs = {value: 'メモ', disabled: true, readonly: true}
|
|
45
45
|
##elm_radio1 = root.css('#radio1') #elm_radio1 = root.css('input#radio1')
|
46
46
|
##elm_radio1 = root.css('.test') #elm_radio1 = root.css('input.test')
|
47
47
|
##elm_radio1 = root.css('[id=radio1][type=radio]')
|
48
|
-
#elm_radio1['checked'] =
|
48
|
+
#elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
|
49
49
|
#puts elm_radio1.document
|
50
50
|
|
51
51
|
#elm_select1 = root.element('select', id: 'select1')
|
52
52
|
#elm_select1 = root.element('select')
|
53
|
-
#elm_select1.attr('multiple',
|
54
|
-
#elm_select1['multiple']
|
55
|
-
##puts elm_select1.attr('multiple')
|
56
|
-
#puts elm_select1['multiple']
|
53
|
+
#elm_select1['multiple'] = true #elm_select1.attr('multiple',true)
|
54
|
+
#puts elm_select1['multiple'] #puts elm_select1.attr('multiple')
|
57
55
|
|
58
56
|
#elm_option1 = root.element('option', id: 'option1')
|
59
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected:
|
57
|
+
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
60
58
|
#elm_option1['selected'] = nil #elm_option1.remove_attr('selected')
|
61
59
|
#puts elm_option1['selected'] #puts elm_option1.attr('selected')
|
62
60
|
#puts elm_text1['readonly'] #puts elm_text1.attr('readonly')
|
data/demo/demo_html5.rb
CHANGED
@@ -29,16 +29,16 @@ elm_text1['required'] = true #elm_text1.attr(required: true)
|
|
29
29
|
#}
|
30
30
|
|
31
31
|
#elm_radio1 = root.element('input', id: 'radio1', type: 'radio')
|
32
|
-
#elm_radio1['checked'] = true #elm_radio1.attr(checked:
|
32
|
+
#elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
|
33
33
|
#puts elm_radio1.document
|
34
34
|
|
35
35
|
#elm_select1 = root.element('select', id: 'select1')
|
36
36
|
#elm_select1 = root.element('select')
|
37
|
-
#elm_select1['multiple'] = true #elm_select1.attr(multiple:
|
38
|
-
#puts elm_select1['multiple']
|
37
|
+
#elm_select1['multiple'] = true #elm_select1.attr(multiple: true)
|
38
|
+
#puts elm_select1['multiple'] #puts elm_select1.attr('multiple')
|
39
39
|
|
40
40
|
#elm_option1 = root.element('option', id: 'option1')
|
41
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected:
|
41
|
+
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
42
42
|
#elm_option1['selected'] = nil #elm_option1.remove_attr('selected')
|
43
43
|
#puts elm_option1['selected'] #puts elm_option1.attr('selected')
|
44
44
|
#puts elm_text1['readonly'] #puts elm_text1.attr('readonly')
|
data/demo/demo_xhtml4.rb
CHANGED
@@ -32,7 +32,7 @@ elm_hello2.content = "Hello,Tester" #elm_hello2.content("Hello,Tester")
|
|
32
32
|
#}
|
33
33
|
|
34
34
|
elm_radio1 = root.element("input", id: "radio1", type: "radio")
|
35
|
-
elm_radio1['checked'] = true #elm_radio1.attribute(checked:
|
35
|
+
elm_radio1['checked'] = true #elm_radio1.attribute(checked: true)
|
36
36
|
|
37
37
|
#elm_select1 = root.element("select",id: "select1")
|
38
38
|
#elm_select1 = root.element("select")
|
@@ -40,9 +40,9 @@ elm_radio1['checked'] = true #elm_radio1.attribute(checked: "true")
|
|
40
40
|
#puts elm_select1['multiple'] #puts elm_select1.attr("multiple")
|
41
41
|
|
42
42
|
#elm_option1 = root.element("option",id: "option1")
|
43
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected:
|
44
|
-
#puts elm_option1['selected']
|
45
|
-
#puts elm_option1['readonly']
|
43
|
+
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
44
|
+
#puts elm_option1['selected'] #puts elm_option1.attr("selected")
|
45
|
+
#puts elm_option1['readonly'] #puts elm_text1.attr("readonly")
|
46
46
|
|
47
47
|
elm_select2 = root.element("select",id: "select2")
|
48
48
|
elm_select2["multiple"] = true
|
data/demo/demo_xhtml5.rb
CHANGED
@@ -34,16 +34,16 @@ elm_text1['required'] = true #elm_text1.attr(required: true)
|
|
34
34
|
#}
|
35
35
|
|
36
36
|
#elm_radio1 = root.element("input",id: "radio1", type: "radio")
|
37
|
-
#elm_radio1['checked'] = true #elm_radio1.attr(checked:
|
37
|
+
#elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
|
38
38
|
|
39
39
|
#elm_select1 = root.element("select",id: "select1")
|
40
40
|
#elm_select1 = root.element("select")
|
41
41
|
#elm_select1['multiple'] = true #elm_select1.attr(multiple: true)
|
42
42
|
#puts elm_select1['multiple'] #puts elm_select1.attr("multiple")
|
43
43
|
#elm_option1 = root.element("option",id: "option1")
|
44
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected:
|
45
|
-
#puts elm_option1['selected']
|
46
|
-
#puts elm_text1['readonly']
|
44
|
+
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
45
|
+
#puts elm_option1['selected'] #puts elm_option1.attr("selected")
|
46
|
+
#puts elm_text1['readonly'] #puts elm_text1.attr("readonly")
|
47
47
|
|
48
48
|
elm_select2 = root.element("select",id: "select2")
|
49
49
|
elm_select2["multiple"] = true
|
data/lib/meteor.rb
CHANGED
@@ -18,12 +18,12 @@
|
|
18
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
19
|
#
|
20
20
|
# @author Yasumasa Ashida
|
21
|
-
# @version 0.9.8.
|
21
|
+
# @version 0.9.8.5
|
22
22
|
#
|
23
23
|
|
24
24
|
module Meteor
|
25
25
|
|
26
|
-
VERSION = '0.9.8.
|
26
|
+
VERSION = '0.9.8.5'.freeze
|
27
27
|
|
28
28
|
#require 'fileutils'
|
29
29
|
|
@@ -79,7 +79,7 @@ module Meteor
|
|
79
79
|
#
|
80
80
|
class Element
|
81
81
|
|
82
|
-
attr_accessor :
|
82
|
+
attr_accessor :name
|
83
83
|
attr_accessor :attributes
|
84
84
|
attr_accessor :mixed_content
|
85
85
|
attr_accessor :raw_content
|
@@ -95,13 +95,13 @@ module Meteor
|
|
95
95
|
attr_accessor :copy
|
96
96
|
attr_accessor :removed
|
97
97
|
|
98
|
-
alias :
|
99
|
-
alias :
|
98
|
+
alias :tag :name
|
99
|
+
alias :tag= :name=
|
100
100
|
|
101
101
|
#
|
102
102
|
# initializer (イニシャライザ)
|
103
|
-
# @overload initialize(
|
104
|
-
# @param [String,Symbol]
|
103
|
+
# @overload initialize(name)
|
104
|
+
# @param [String,Symbol] name tag name (タグ名)
|
105
105
|
# @overload initialize(elm)
|
106
106
|
# @param [Meteor::Element] elm element (要素)
|
107
107
|
# @overload initialize(elm,ps)
|
@@ -119,7 +119,7 @@ module Meteor
|
|
119
119
|
raise ArgumentError
|
120
120
|
end
|
121
121
|
when TWO
|
122
|
-
@
|
122
|
+
@name = args[0].name
|
123
123
|
@attributes = String.new(args[0].attributes)
|
124
124
|
@mixed_content = String.new(args[0].mixed_content)
|
125
125
|
#@pattern = String.new(args[0].pattern)
|
@@ -140,10 +140,10 @@ module Meteor
|
|
140
140
|
|
141
141
|
#
|
142
142
|
# initializer (イニシャライザ)
|
143
|
-
# @param [String]
|
143
|
+
# @param [String] name tag name (タグ名)
|
144
144
|
#
|
145
|
-
def initialize_s(
|
146
|
-
@
|
145
|
+
def initialize_s(name)
|
146
|
+
@name = name
|
147
147
|
#@attributes = nil
|
148
148
|
#@mixed_content = nil
|
149
149
|
#@pattern = nil
|
@@ -163,7 +163,7 @@ module Meteor
|
|
163
163
|
# @param [Meteor::Element] elm element (要素)
|
164
164
|
#
|
165
165
|
def initialize_e(elm)
|
166
|
-
@
|
166
|
+
@name = elm.name
|
167
167
|
@attributes = String.new(elm.attributes)
|
168
168
|
#@pattern = String.new(elm.pattern)
|
169
169
|
@pattern = elm.pattern
|
@@ -244,27 +244,27 @@ module Meteor
|
|
244
244
|
case @parser.doc_type
|
245
245
|
when Parser::HTML, Parser::HTML5, Parser::HTML4
|
246
246
|
if @cx
|
247
|
-
#@pattern_cc = '' << SET_CX_1 << elm.
|
248
|
-
@document = "<!-- @#{@
|
247
|
+
#@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
|
248
|
+
@document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
|
249
249
|
else
|
250
250
|
if @empty
|
251
|
-
#@pattern_cc = '' << TAG_OPEN << elm.
|
252
|
-
@document = "<#{@
|
251
|
+
#@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
|
252
|
+
@document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
|
253
253
|
else
|
254
|
-
@document = '' << Meteor::Core::Kernel::TAG_OPEN << @
|
254
|
+
@document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE
|
255
255
|
#@document = "<#{@name}#{@attributes}>"
|
256
256
|
end
|
257
257
|
end
|
258
258
|
when Parser::XHTML4, Parser::XHTML5, Parser::XML
|
259
259
|
if @cx
|
260
|
-
#@pattern_cc = '' << SET_CX_1 << elm.
|
261
|
-
@document = "<!-- @#{@
|
260
|
+
#@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
|
261
|
+
@document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
|
262
262
|
else
|
263
263
|
if @empty
|
264
|
-
#@pattern_cc = '' << TAG_OPEN << elm.
|
265
|
-
@document = "<#{@
|
264
|
+
#@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
|
265
|
+
@document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
|
266
266
|
else
|
267
|
-
@document = '' << Meteor::Core::Kernel::TAG_OPEN << @
|
267
|
+
@document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE3
|
268
268
|
#@document = "<#{@name}#{@attributes}/>"
|
269
269
|
end
|
270
270
|
end
|
@@ -279,22 +279,22 @@ module Meteor
|
|
279
279
|
# @overload element()
|
280
280
|
# get element (要素を取得する)
|
281
281
|
# @return [Meteor::Element] element (要素)
|
282
|
-
# @overload element(
|
282
|
+
# @overload element(name)
|
283
283
|
# get element using tag name (要素のタグ名で要素を取得する)
|
284
|
-
# @param [String,Symbol]
|
284
|
+
# @param [String,Symbol] name tag name (タグ名)
|
285
285
|
# @return [Meteor::Element] element (要素)
|
286
|
-
# @overload element(
|
286
|
+
# @overload element(name,attrs)
|
287
287
|
# get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
288
|
-
# @param [String,Symbol]
|
288
|
+
# @param [String,Symbol] name tag name (タグ名)
|
289
289
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
290
290
|
# @return [Meteor::Element] element (要素)
|
291
291
|
# @overload element(attrs)
|
292
292
|
# get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
293
293
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
294
294
|
# @return [Meteor::Element] element(要素)
|
295
|
-
# @overload element(
|
295
|
+
# @overload element(name,attr_name,attr_value)
|
296
296
|
# get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
|
297
|
-
# @param [String,Symbol] tag
|
297
|
+
# @param [String,Symbol] name tag name (タグ名)
|
298
298
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
299
299
|
# @param [String] attr_value attribute value (属性値)
|
300
300
|
# @return [Meteor::Element] element (要素)
|
@@ -303,9 +303,9 @@ module Meteor
|
|
303
303
|
# @param [String,Symbol] attr_name 属性名
|
304
304
|
# @param [String] attr_value 属性値
|
305
305
|
# @return [Meteor::Element] element (要素)
|
306
|
-
# @overload element(
|
306
|
+
# @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
|
307
307
|
# get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
|
308
|
-
# @param [String,Symbol] tag
|
308
|
+
# @param [String,Symbol] name tag name (タグ名)
|
309
309
|
# @param [String,Symbol] attr_name1 attribute name1 (属性名1)
|
310
310
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
311
311
|
# @param [String,Symbol] attr_name2 attribute name2 (属性名2)
|
@@ -337,22 +337,22 @@ module Meteor
|
|
337
337
|
|
338
338
|
#
|
339
339
|
# get elements (要素を取得する)
|
340
|
-
# @overload elements(
|
340
|
+
# @overload elements(name)
|
341
341
|
# get elements using tag name (要素のタグ名で要素を取得する)
|
342
|
-
# @param [String,Symbol]
|
342
|
+
# @param [String,Symbol] name tag name (タグ名)
|
343
343
|
# @return [Array<Meteor::Element>] element array(要素配列)
|
344
|
-
# @overload elements(
|
344
|
+
# @overload elements(name,attrs)
|
345
345
|
# get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
346
|
-
# @param [String,Symbol]
|
346
|
+
# @param [String,Symbol] name tag name (タグ名)
|
347
347
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
348
348
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
349
349
|
# @overload elements(attrs)
|
350
350
|
# get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
351
351
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
352
352
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
353
|
-
# @overload elements(
|
353
|
+
# @overload elements(name,attr_name,attr_value)
|
354
354
|
# get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
|
355
|
-
# @param [String,Symbol] tag
|
355
|
+
# @param [String,Symbol] name tag name (タグ名)
|
356
356
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
357
357
|
# @param [String] attr_value attribute value (属性値)
|
358
358
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
@@ -361,9 +361,9 @@ module Meteor
|
|
361
361
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
362
362
|
# @param [String] attr_value attribute value (属性値)
|
363
363
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
364
|
-
# @overload elements(
|
364
|
+
# @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
|
365
365
|
# get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
|
366
|
-
# @param [String,Symbol]
|
366
|
+
# @param [String,Symbol] name tag name (タグ名)
|
367
367
|
# @param [String,Symbol] attr_name1 attribute name1 (属性名1)
|
368
368
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
369
369
|
# @param [String,Symbol] attr_name2 attribute name2 (属性名2)
|
@@ -395,9 +395,9 @@ module Meteor
|
|
395
395
|
|
396
396
|
#
|
397
397
|
# get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
|
398
|
-
# @overload cxtag(
|
398
|
+
# @overload cxtag(name,id)
|
399
399
|
# get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
|
400
|
-
# @param [String,Symbol]
|
400
|
+
# @param [String,Symbol] name tag name (タグ名)
|
401
401
|
# @param [String] id id attribute value (ID属性値)
|
402
402
|
# @return [Meteor::Element] element(要素)
|
403
403
|
# @overload cxtag(id)
|
@@ -1363,13 +1363,13 @@ module Meteor
|
|
1363
1363
|
|
1364
1364
|
#
|
1365
1365
|
# initializer (イニシャライザ)
|
1366
|
-
# @overload initialize(
|
1367
|
-
# @param [String,Symbol]
|
1366
|
+
# @overload initialize(name)
|
1367
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1368
1368
|
# @overload initialize(attr_name,attr_value)
|
1369
1369
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
1370
1370
|
# @param [String] attr_value attribute value (属性値)
|
1371
|
-
# @overload initialize(
|
1372
|
-
# @param [String,Symbol]
|
1371
|
+
# @overload initialize(name,attr_name,attr_value)
|
1372
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1373
1373
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
1374
1374
|
# @param [String] attr_value attribute value (属性値)
|
1375
1375
|
# @overload initialize(attr_name1,attr_value1,attr_name2,attr_value2)
|
@@ -1377,8 +1377,8 @@ module Meteor
|
|
1377
1377
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
1378
1378
|
# @param [String,Symbol] attr_name2 attribute name2 (属性名2)
|
1379
1379
|
# @param [String] attr_value2 attribute value2 (属性値2)
|
1380
|
-
# @overload initialize(
|
1381
|
-
# @param [String,Symbol]
|
1380
|
+
# @overload initialize(name,attr_name1,attr_value1,attr_name2,attr_value2)
|
1381
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1382
1382
|
# @param [String,Symbol] attr_name1 attribute name1 (属性名1)
|
1383
1383
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
1384
1384
|
# @param [String,Symbol] attr_name2 attribute name2 (属性名2)
|
@@ -1399,8 +1399,8 @@ module Meteor
|
|
1399
1399
|
end
|
1400
1400
|
end
|
1401
1401
|
|
1402
|
-
def initialize_1(
|
1403
|
-
self.message="element not found : #{
|
1402
|
+
def initialize_1(name)
|
1403
|
+
self.message="element not found : #{name}"
|
1404
1404
|
end
|
1405
1405
|
|
1406
1406
|
private :initialize_1
|
@@ -1411,8 +1411,8 @@ module Meteor
|
|
1411
1411
|
|
1412
1412
|
private :initialize_2
|
1413
1413
|
|
1414
|
-
def initialize_3(
|
1415
|
-
self.message="element not found : #{
|
1414
|
+
def initialize_3(name, attr_name, attr_value)
|
1415
|
+
self.message="element not found : #{name}[#{attr_name}=#{attr_value}]"
|
1416
1416
|
end
|
1417
1417
|
|
1418
1418
|
private :initialize_3
|
@@ -1423,8 +1423,8 @@ module Meteor
|
|
1423
1423
|
|
1424
1424
|
private :initialize_4
|
1425
1425
|
|
1426
|
-
def initialize_5(
|
1427
|
-
self.message="element not found : #{
|
1426
|
+
def initialize_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
1427
|
+
self.message="element not found : #{name}[#{attr_name1}=#{attr_value1}][#{attr_name2}=#{attr_value2}]"
|
1428
1428
|
end
|
1429
1429
|
|
1430
1430
|
private :initialize_5
|
@@ -1794,22 +1794,22 @@ module Meteor
|
|
1794
1794
|
|
1795
1795
|
#
|
1796
1796
|
# get element (要素を取得する)
|
1797
|
-
# @overload element(
|
1797
|
+
# @overload element(name)
|
1798
1798
|
# get element using tag name (要素のタグ名で要素を取得する)
|
1799
|
-
# @param [String,Symbol]
|
1799
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1800
1800
|
# @return [Meteor::Element] element(要素)
|
1801
|
-
# @overload element(
|
1801
|
+
# @overload element(name,attrs)
|
1802
1802
|
# get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
1803
|
-
# @param [String,Symbol] tag
|
1803
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1804
1804
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
1805
1805
|
# @return [Meteor::Element] element (要素)
|
1806
1806
|
# @overload element(attrs)
|
1807
1807
|
# get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
1808
1808
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
1809
1809
|
# @return [Meteor::Element] element (要素)
|
1810
|
-
# @overload element(
|
1810
|
+
# @overload element(name,attr_name,attr_value)
|
1811
1811
|
# get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
|
1812
|
-
# @param [String,Symbol] tag
|
1812
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1813
1813
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
1814
1814
|
# @param [String] attr_value attribute value (属性値)
|
1815
1815
|
# @return [Meteor::Element] element (要素)
|
@@ -1818,9 +1818,9 @@ module Meteor
|
|
1818
1818
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
1819
1819
|
# @param [String] attr_value attribute value (属性値)
|
1820
1820
|
# @return [Meteor::Element] element (要素)
|
1821
|
-
# @overload element(
|
1821
|
+
# @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
|
1822
1822
|
# get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
|
1823
|
-
# @param [String,Symbol]
|
1823
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1824
1824
|
# @param [String,Symbol] attr_name1 attribute name1 (属性名1)
|
1825
1825
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
1826
1826
|
# @param [String,Symbol] attr_name2 attribute name2 (属性名2)
|
@@ -1913,15 +1913,15 @@ module Meteor
|
|
1913
1913
|
|
1914
1914
|
#
|
1915
1915
|
# get element using tag name (タグ名で検索し、要素を取得する)
|
1916
|
-
# @param [String,Symbol]
|
1916
|
+
# @param [String,Symbol] name tag name (タグ名)
|
1917
1917
|
# @return [Meteor::Element] element(要素)
|
1918
1918
|
#
|
1919
|
-
def element_1(
|
1919
|
+
def element_1(name)
|
1920
1920
|
|
1921
|
-
@
|
1921
|
+
@_name = Regexp.quote(name)
|
1922
1922
|
|
1923
1923
|
#要素検索用パターン
|
1924
|
-
@pattern_cc = "<#{@
|
1924
|
+
@pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>|<#{@_name}((?:|\\s[^<>]*))>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
1925
1925
|
|
1926
1926
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
1927
1927
|
#内容あり要素検索
|
@@ -1929,9 +1929,9 @@ module Meteor
|
|
1929
1929
|
|
1930
1930
|
if @res
|
1931
1931
|
if @res[1]
|
1932
|
-
element_without_1(
|
1932
|
+
element_without_1(name)
|
1933
1933
|
else
|
1934
|
-
element_with_1(
|
1934
|
+
element_with_1(name)
|
1935
1935
|
end
|
1936
1936
|
#else
|
1937
1937
|
end
|
@@ -1941,9 +1941,9 @@ module Meteor
|
|
1941
1941
|
|
1942
1942
|
private :element_1
|
1943
1943
|
|
1944
|
-
def element_with_1(
|
1944
|
+
def element_with_1(name)
|
1945
1945
|
|
1946
|
-
@elm_ = Meteor::Element.new(
|
1946
|
+
@elm_ = Meteor::Element.new(name)
|
1947
1947
|
|
1948
1948
|
unless @on_search
|
1949
1949
|
#属性
|
@@ -1961,9 +1961,9 @@ module Meteor
|
|
1961
1961
|
@elm_.document = @res[0]
|
1962
1962
|
end
|
1963
1963
|
#内容あり要素検索用パターン
|
1964
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
1965
|
-
#@pattern_cc << TAG_SEARCH_NC_1_2 << @
|
1966
|
-
@pattern_cc = "<#{@
|
1964
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_1_1 << @_name
|
1965
|
+
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
|
1966
|
+
@pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
1967
1967
|
|
1968
1968
|
@elm_.pattern = @pattern_cc
|
1969
1969
|
|
@@ -1976,16 +1976,16 @@ module Meteor
|
|
1976
1976
|
|
1977
1977
|
private :element_with_1
|
1978
1978
|
|
1979
|
-
def element_without_1(
|
1979
|
+
def element_without_1(name)
|
1980
1980
|
#要素
|
1981
|
-
@elm_ = Meteor::Element.new(
|
1981
|
+
@elm_ = Meteor::Element.new(name)
|
1982
1982
|
#属性
|
1983
1983
|
@elm_.attributes = @res[1]
|
1984
1984
|
#全体
|
1985
1985
|
@elm_.document = @res[0]
|
1986
1986
|
#空要素検索用パターン
|
1987
|
-
@pattern_cc = '' << TAG_OPEN << @
|
1988
|
-
#@pattern_cc = "<#{@
|
1987
|
+
@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_1_3
|
1988
|
+
#@pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>"
|
1989
1989
|
@elm_.pattern = @pattern_cc
|
1990
1990
|
|
1991
1991
|
@elm_.empty = false
|
@@ -1999,13 +1999,13 @@ module Meteor
|
|
1999
1999
|
|
2000
2000
|
#
|
2001
2001
|
# get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で検索し、要素を取得する)
|
2002
|
-
# @param [String] tag
|
2002
|
+
# @param [String] name tag name (タグ名)
|
2003
2003
|
# @param [String] attr_name attribute name (属性名)
|
2004
2004
|
# @param [String] attr_value attribute value (属性値)
|
2005
2005
|
# @return [Meteor::Element] element (要素)
|
2006
|
-
def element_3(
|
2006
|
+
def element_3(name, attr_name, attr_value)
|
2007
2007
|
|
2008
|
-
element_quote_3(
|
2008
|
+
element_quote_3(name,attr_name,attr_value)
|
2009
2009
|
|
2010
2010
|
@pattern_cc_1 = element_pattern_3
|
2011
2011
|
|
@@ -2025,30 +2025,30 @@ module Meteor
|
|
2025
2025
|
@res = @res1
|
2026
2026
|
#@pattern_cc = @pattern_cc_1
|
2027
2027
|
if @res[1]
|
2028
|
-
element_without_3(
|
2028
|
+
element_without_3(name)
|
2029
2029
|
else
|
2030
|
-
element_with_3_1(
|
2030
|
+
element_with_3_1(name)
|
2031
2031
|
end
|
2032
2032
|
elsif @res1.begin(0) > @res2.begin(0)
|
2033
2033
|
@res = @res2
|
2034
2034
|
#@pattern_cc = @pattern_cc_2
|
2035
|
-
element_with_3_1(
|
2035
|
+
element_with_3_1(name)
|
2036
2036
|
end
|
2037
2037
|
elsif @res1 && !@res2
|
2038
2038
|
@res = @res1
|
2039
2039
|
#@pattern_cc = @pattern_cc_1
|
2040
2040
|
if @res[1]
|
2041
|
-
element_without_3(
|
2041
|
+
element_without_3(name)
|
2042
2042
|
else
|
2043
|
-
element_with_3_1(
|
2043
|
+
element_with_3_1(name)
|
2044
2044
|
end
|
2045
2045
|
elsif @res2 && !@res1
|
2046
2046
|
@res = @res2
|
2047
2047
|
#@pattern_cc = @pattern_cc_2
|
2048
|
-
element_with_3_1(
|
2048
|
+
element_with_3_1(name)
|
2049
2049
|
else
|
2050
2050
|
if @error_check
|
2051
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
2051
|
+
puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
|
2052
2052
|
end
|
2053
2053
|
@elm_ = nil
|
2054
2054
|
end
|
@@ -2059,26 +2059,25 @@ module Meteor
|
|
2059
2059
|
private :element_3
|
2060
2060
|
|
2061
2061
|
def element_pattern_3
|
2062
|
-
|
2063
|
-
"<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_tag}[^<>]*>)).)*)<\\/#{@_tag}>"
|
2062
|
+
"<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
2064
2063
|
end
|
2065
2064
|
|
2066
2065
|
private :element_pattern_3
|
2067
2066
|
|
2068
|
-
def element_quote_3(
|
2069
|
-
@
|
2067
|
+
def element_quote_3(name,attr_name,attr_value)
|
2068
|
+
@_name = Regexp.quote(name)
|
2070
2069
|
@_attr_name = Regexp.quote(attr_name)
|
2071
2070
|
@_attr_value = Regexp.quote(attr_value)
|
2072
2071
|
end
|
2073
2072
|
|
2074
2073
|
private :element_quote_3
|
2075
2074
|
|
2076
|
-
def element_with_3_1(
|
2075
|
+
def element_with_3_1(name)
|
2077
2076
|
#puts @res.captures.length
|
2078
2077
|
case @res.captures.length
|
2079
2078
|
when FOUR
|
2080
2079
|
#要素
|
2081
|
-
@elm_ = Meteor::Element.new(
|
2080
|
+
@elm_ = Meteor::Element.new(name)
|
2082
2081
|
#属性
|
2083
2082
|
@elm_.attributes = @res[1]
|
2084
2083
|
#内容
|
@@ -2086,10 +2085,10 @@ module Meteor
|
|
2086
2085
|
#全体
|
2087
2086
|
@elm_.document = @res[0]
|
2088
2087
|
#内容あり要素検索用パターン
|
2089
|
-
#@pattern_cc = ''<< TAG_OPEN << @
|
2090
|
-
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @
|
2091
|
-
#@pattern_cc << TAG_SEARCH_NC_1_2 << @
|
2092
|
-
@pattern_cc = "<#{@
|
2088
|
+
#@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
|
2089
|
+
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
|
2090
|
+
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
|
2091
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
2093
2092
|
|
2094
2093
|
@elm_.pattern = @pattern_cc
|
2095
2094
|
|
@@ -2099,7 +2098,7 @@ module Meteor
|
|
2099
2098
|
|
2100
2099
|
when FIVE
|
2101
2100
|
#要素
|
2102
|
-
@elm_ = Meteor::Element.new(
|
2101
|
+
@elm_ = Meteor::Element.new(name)
|
2103
2102
|
#属性
|
2104
2103
|
@elm_.attributes = @res[2]
|
2105
2104
|
#内容
|
@@ -2107,10 +2106,10 @@ module Meteor
|
|
2107
2106
|
#全体
|
2108
2107
|
@elm_.document = @res[0]
|
2109
2108
|
#内容あり要素検索用パターン
|
2110
|
-
#@pattern_cc = ''<< TAG_OPEN << @
|
2111
|
-
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @
|
2112
|
-
#@pattern_cc << TAG_SEARCH_NC_1_2 << @
|
2113
|
-
@pattern_cc = "<#{@
|
2109
|
+
#@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
|
2110
|
+
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
|
2111
|
+
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
|
2112
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
|
2114
2113
|
|
2115
2114
|
@elm_.pattern = @pattern_cc
|
2116
2115
|
|
@@ -2120,7 +2119,7 @@ module Meteor
|
|
2120
2119
|
|
2121
2120
|
when THREE,SIX
|
2122
2121
|
#内容
|
2123
|
-
@elm_ = Meteor::Element.new(
|
2122
|
+
@elm_ = Meteor::Element.new(name)
|
2124
2123
|
unless @on_search
|
2125
2124
|
#属性
|
2126
2125
|
@elm_.attributes = @res[1].chop
|
@@ -2164,29 +2163,29 @@ module Meteor
|
|
2164
2163
|
|
2165
2164
|
def element_pattern_with_3_2
|
2166
2165
|
|
2167
|
-
#@pattern_cc_1 = '' << TAG_OPEN << @
|
2166
|
+
#@pattern_cc_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
2168
2167
|
#@pattern_cc_1 << @_attr_value << TAG_SEARCH_2_4_2
|
2169
|
-
@pattern_cc_1 = "<#{@
|
2168
|
+
@pattern_cc_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
|
2170
2169
|
|
2171
|
-
@pattern_cc_1b = '' << TAG_OPEN << @
|
2172
|
-
#@pattern_cc_1b = "<#{@
|
2170
|
+
@pattern_cc_1b = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4
|
2171
|
+
#@pattern_cc_1b = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
|
2173
2172
|
|
2174
|
-
#@pattern_cc_1_1 = '' << TAG_OPEN << @
|
2173
|
+
#@pattern_cc_1_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
2175
2174
|
#@pattern_cc_1_1 << @_attr_value << TAG_SEARCH_4_7
|
2176
|
-
@pattern_cc_1_1 = "<#{@
|
2175
|
+
@pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
2177
2176
|
|
2178
|
-
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @
|
2179
|
-
#@pattern_cc_1_2 = ".*?<#{@
|
2177
|
+
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_name << TAG_SEARCH_4_3
|
2178
|
+
#@pattern_cc_1_2 = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
|
2180
2179
|
|
2181
2180
|
|
2182
|
-
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @
|
2183
|
-
#@pattern_cc_2 = '' << "<\\/#{@
|
2181
|
+
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_name << TAG_CLOSE
|
2182
|
+
#@pattern_cc_2 = '' << "<\\/#{@_name}>"
|
2184
2183
|
|
2185
|
-
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @
|
2186
|
-
#@pattern_cc_2_1 = ".*?<\\/#{@
|
2184
|
+
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_name << TAG_CLOSE
|
2185
|
+
#@pattern_cc_2_1 = ".*?<\\/#{@_name}>"
|
2187
2186
|
|
2188
|
-
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @
|
2189
|
-
#@pattern_cc_2_2 = ".*?)<\\/#{@
|
2187
|
+
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_name << TAG_CLOSE
|
2188
|
+
#@pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
|
2190
2189
|
|
2191
2190
|
#内容あり要素検索
|
2192
2191
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
@@ -2206,23 +2205,23 @@ module Meteor
|
|
2206
2205
|
|
2207
2206
|
private :element_pattern_with_3_2
|
2208
2207
|
|
2209
|
-
def element_without_3(
|
2210
|
-
element_without_3_1(
|
2208
|
+
def element_without_3(name)
|
2209
|
+
element_without_3_1(name, TAG_SEARCH_2_3_2)
|
2211
2210
|
end
|
2212
2211
|
|
2213
2212
|
private :element_without_3
|
2214
2213
|
|
2215
|
-
def element_without_3_1(
|
2214
|
+
def element_without_3_1(name, closer)
|
2216
2215
|
|
2217
2216
|
#要素
|
2218
|
-
@elm_ = Meteor::Element.new(
|
2217
|
+
@elm_ = Meteor::Element.new(name)
|
2219
2218
|
#属性
|
2220
2219
|
@elm_.attributes = @res[1]
|
2221
2220
|
#全体
|
2222
2221
|
@elm_.document = @res[0]
|
2223
2222
|
#空要素検索用パターン
|
2224
|
-
@pattern_cc = '' << TAG_OPEN << @
|
2225
|
-
#@pattern_cc = "<#{@
|
2223
|
+
@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ << @_attr_value << closer
|
2224
|
+
#@pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}#{closer}"
|
2226
2225
|
@elm_.pattern = @pattern_cc
|
2227
2226
|
|
2228
2227
|
@elm_.parser = self
|
@@ -2332,9 +2331,9 @@ module Meteor
|
|
2332
2331
|
#puts @res.captures.length
|
2333
2332
|
case @res.captures.length
|
2334
2333
|
when FOUR
|
2335
|
-
@
|
2334
|
+
@_name = @res[1]
|
2336
2335
|
#要素
|
2337
|
-
@elm_ = Element.new(@
|
2336
|
+
@elm_ = Element.new(@_name)
|
2338
2337
|
#属性
|
2339
2338
|
@elm_.attributes = @res[2]
|
2340
2339
|
#内容
|
@@ -2342,10 +2341,10 @@ module Meteor
|
|
2342
2341
|
#全体
|
2343
2342
|
@elm_.document = @res[0]
|
2344
2343
|
#内容あり要素検索用パターン
|
2345
|
-
#@pattern_cc = ''<< TAG_OPEN << @
|
2346
|
-
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @
|
2347
|
-
#@pattern_cc << TAG_SEARCH_NC_1_2 << @
|
2348
|
-
@pattern_cc = "<#{@
|
2344
|
+
#@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
|
2345
|
+
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
|
2346
|
+
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
|
2347
|
+
@pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
|
2349
2348
|
|
2350
2349
|
@elm_.pattern = @pattern_cc
|
2351
2350
|
|
@@ -2354,9 +2353,9 @@ module Meteor
|
|
2354
2353
|
@elm_.parser = self
|
2355
2354
|
|
2356
2355
|
when FIVE,SEVEN
|
2357
|
-
@
|
2356
|
+
@_name = @res[3]
|
2358
2357
|
#要素
|
2359
|
-
@elm_ = Element.new(@
|
2358
|
+
@elm_ = Element.new(@_name)
|
2360
2359
|
#属性
|
2361
2360
|
@elm_.attributes = @res[4]
|
2362
2361
|
#内容
|
@@ -2364,10 +2363,10 @@ module Meteor
|
|
2364
2363
|
#全体
|
2365
2364
|
@elm_.document = @res[0]
|
2366
2365
|
#内容あり要素検索用パターン
|
2367
|
-
#@pattern_cc = ''<< TAG_OPEN << @
|
2368
|
-
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @
|
2369
|
-
#@pattern_cc << TAG_SEARCH_NC_1_2 << @
|
2370
|
-
@pattern_cc = "<#{@
|
2366
|
+
#@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
|
2367
|
+
#@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
|
2368
|
+
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
|
2369
|
+
@pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
|
2371
2370
|
|
2372
2371
|
@elm_.pattern = @pattern_cc
|
2373
2372
|
|
@@ -2378,9 +2377,9 @@ module Meteor
|
|
2378
2377
|
when THREE,SIX
|
2379
2378
|
#puts @res[1]
|
2380
2379
|
#puts @res[3]
|
2381
|
-
#@
|
2380
|
+
#@_name = @res[1]
|
2382
2381
|
#内容
|
2383
|
-
@elm_ = Element.new(@
|
2382
|
+
@elm_ = Element.new(@_name)
|
2384
2383
|
#属性
|
2385
2384
|
@elm_.attributes = @res[1].chop
|
2386
2385
|
#内容
|
@@ -2401,7 +2400,7 @@ module Meteor
|
|
2401
2400
|
|
2402
2401
|
def element_with_2_2
|
2403
2402
|
|
2404
|
-
#@pattern_cc_1 = '' << TAG_OPEN << @
|
2403
|
+
#@pattern_cc_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
2405
2404
|
#@pattern_cc_1 << @_attr_value << TAG_SEARCH_2_4_2
|
2406
2405
|
@pattern_cc_1 = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
|
2407
2406
|
|
@@ -2430,21 +2429,21 @@ module Meteor
|
|
2430
2429
|
|
2431
2430
|
def create_pattern_2(args_cnt)
|
2432
2431
|
|
2433
|
-
#puts @
|
2432
|
+
#puts @_name
|
2434
2433
|
|
2435
|
-
@pattern_cc_1b = '' << TAG_OPEN << @
|
2434
|
+
@pattern_cc_1b = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4
|
2436
2435
|
|
2437
|
-
#@pattern_cc_1_1 = '' << TAG_OPEN << @
|
2436
|
+
#@pattern_cc_1_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
2438
2437
|
#@pattern_cc_1_1 << @_attr_value << TAG_SEARCH_4_7
|
2439
|
-
@pattern_cc_1_1 = "<#{@
|
2438
|
+
@pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
2440
2439
|
|
2441
|
-
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @
|
2440
|
+
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_name << TAG_SEARCH_4_3
|
2442
2441
|
|
2443
|
-
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @
|
2442
|
+
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_name << TAG_CLOSE
|
2444
2443
|
|
2445
|
-
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @
|
2444
|
+
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_name << TAG_CLOSE
|
2446
2445
|
|
2447
|
-
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @
|
2446
|
+
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_name << TAG_CLOSE
|
2448
2447
|
|
2449
2448
|
@pattern_2 = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
|
2450
2449
|
@pattern_1b = Meteor::Core::Util::PatternCache.get(@pattern_cc_1b)
|
@@ -2466,7 +2465,7 @@ module Meteor
|
|
2466
2465
|
#全体
|
2467
2466
|
@elm_.document = @res[0]
|
2468
2467
|
#空要素検索用パターン
|
2469
|
-
@pattern_cc = '' << TAG_OPEN << @
|
2468
|
+
@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ << @_attr_value << closer
|
2470
2469
|
@elm_.pattern = @pattern_cc
|
2471
2470
|
|
2472
2471
|
@elm_.parser = self
|
@@ -2479,18 +2478,18 @@ module Meteor
|
|
2479
2478
|
|
2480
2479
|
#
|
2481
2480
|
# get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で検索し、要素を取得する)
|
2482
|
-
# @param [String] tag
|
2481
|
+
# @param [String] name tag name (タグ名)
|
2483
2482
|
# @param [String] attr_name1 attribute name1 (属性名1)
|
2484
2483
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
2485
2484
|
# @param [String] attr_name2 attribute name2 (属性名2)
|
2486
2485
|
# @param [String] attr_value2 attribute value2 (属性値2)
|
2487
2486
|
# @return [Meteor::Element] element (要素)
|
2488
2487
|
#
|
2489
|
-
def element_5(
|
2488
|
+
def element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
2490
2489
|
|
2491
|
-
element_quote_5(
|
2490
|
+
element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
2492
2491
|
|
2493
|
-
@pattern_cc_1 = "<#{@
|
2492
|
+
@pattern_cc_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)\\/>|<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
2494
2493
|
|
2495
2494
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
2496
2495
|
@res1 = @pattern.match(@root.document)
|
@@ -2508,30 +2507,30 @@ module Meteor
|
|
2508
2507
|
@res = @res1
|
2509
2508
|
#@pattern_cc = @pattern_cc_1
|
2510
2509
|
if @res[1]
|
2511
|
-
element_without_5(
|
2510
|
+
element_without_5(name)
|
2512
2511
|
else
|
2513
|
-
element_with_5_1(
|
2512
|
+
element_with_5_1(name)
|
2514
2513
|
end
|
2515
2514
|
elsif @res1.begin(0) > @res2.begin(0)
|
2516
2515
|
@res = @res2
|
2517
2516
|
#@pattern_cc = @pattern_cc_2
|
2518
|
-
element_with_5_1(
|
2517
|
+
element_with_5_1(name)
|
2519
2518
|
end
|
2520
2519
|
elsif @res1 && !@res2
|
2521
2520
|
@res = @res1
|
2522
2521
|
#@pattern_cc = @pattern_cc_1
|
2523
2522
|
if @res[1]
|
2524
|
-
element_without_5(
|
2523
|
+
element_without_5(name)
|
2525
2524
|
else
|
2526
|
-
element_with_5_1(
|
2525
|
+
element_with_5_1(name)
|
2527
2526
|
end
|
2528
2527
|
elsif @res2 && !@res1
|
2529
2528
|
@res = @res2
|
2530
2529
|
#@pattern_cc = @pattern_cc_2
|
2531
|
-
element_with_5_1(
|
2530
|
+
element_with_5_1(name)
|
2532
2531
|
else
|
2533
2532
|
if @error_check
|
2534
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
2533
|
+
puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
|
2535
2534
|
end
|
2536
2535
|
@elm_ = nil
|
2537
2536
|
end
|
@@ -2541,8 +2540,8 @@ module Meteor
|
|
2541
2540
|
|
2542
2541
|
private :element_5
|
2543
2542
|
|
2544
|
-
def element_quote_5(
|
2545
|
-
@
|
2543
|
+
def element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
2544
|
+
@_name = Regexp.quote(name)
|
2546
2545
|
@_attr_name1 = Regexp.quote(attr_name1)
|
2547
2546
|
@_attr_name2 = Regexp.quote(attr_name2)
|
2548
2547
|
@_attr_value1 = Regexp.quote(attr_value1)
|
@@ -2551,13 +2550,13 @@ module Meteor
|
|
2551
2550
|
|
2552
2551
|
private :element_quote_5
|
2553
2552
|
|
2554
|
-
def element_with_5_1(
|
2553
|
+
def element_with_5_1(name)
|
2555
2554
|
|
2556
2555
|
#puts @res.captures.length
|
2557
2556
|
case @res.captures.length
|
2558
2557
|
when FOUR
|
2559
2558
|
#要素
|
2560
|
-
@elm_ = Meteor::Element.new(
|
2559
|
+
@elm_ = Meteor::Element.new(name)
|
2561
2560
|
#属性
|
2562
2561
|
@elm_.attributes = @res[1]
|
2563
2562
|
#内容
|
@@ -2565,13 +2564,13 @@ module Meteor
|
|
2565
2564
|
#全体
|
2566
2565
|
@elm_.document = @res[0]
|
2567
2566
|
#内容あり要素検索用パターン
|
2568
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
2567
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
|
2569
2568
|
#@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_6 << @_attr_name2 << ATTR_EQ
|
2570
2569
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_7 << @_attr_name2 << ATTR_EQ
|
2571
2570
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_6 << @_attr_name1 << ATTR_EQ
|
2572
|
-
#@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @
|
2573
|
-
#@pattern_cc << TAG_SEARCH_NC_1_2 << @
|
2574
|
-
@pattern_cc = "<#{@
|
2571
|
+
#@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @_name
|
2572
|
+
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
|
2573
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
2575
2574
|
|
2576
2575
|
@elm_.pattern = @pattern_cc
|
2577
2576
|
#
|
@@ -2580,7 +2579,7 @@ module Meteor
|
|
2580
2579
|
@elm_.parser = self
|
2581
2580
|
when FIVE
|
2582
2581
|
#要素
|
2583
|
-
@elm_ = Meteor::Element.new(
|
2582
|
+
@elm_ = Meteor::Element.new(name)
|
2584
2583
|
#属性
|
2585
2584
|
@elm_.attributes = @res[2]
|
2586
2585
|
#内容
|
@@ -2588,13 +2587,13 @@ module Meteor
|
|
2588
2587
|
#全体
|
2589
2588
|
@elm_.document = @res[0]
|
2590
2589
|
#内容あり要素検索用パターン
|
2591
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
2590
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
|
2592
2591
|
#@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_6 << @_attr_name2 << ATTR_EQ
|
2593
2592
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_7 << @_attr_name2 << ATTR_EQ
|
2594
2593
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_6 << @_attr_name1 << ATTR_EQ
|
2595
|
-
#@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @
|
2596
|
-
#@pattern_cc << TAG_SEARCH_NC_1_2 << @
|
2597
|
-
@pattern_cc = "<#{@
|
2594
|
+
#@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @_name
|
2595
|
+
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
|
2596
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
2598
2597
|
|
2599
2598
|
@elm_.pattern = @pattern_cc
|
2600
2599
|
#
|
@@ -2604,7 +2603,7 @@ module Meteor
|
|
2604
2603
|
|
2605
2604
|
when THREE,SIX
|
2606
2605
|
#要素
|
2607
|
-
@elm_ = Meteor::Element.new(
|
2606
|
+
@elm_ = Meteor::Element.new(name)
|
2608
2607
|
#属性
|
2609
2608
|
@elm_.attributes = @res[1].chop
|
2610
2609
|
#要素
|
@@ -2641,38 +2640,38 @@ module Meteor
|
|
2641
2640
|
|
2642
2641
|
def element_pattern_with_5_2
|
2643
2642
|
|
2644
|
-
#@pattern_cc_1 = '' << TAG_OPEN << @
|
2643
|
+
#@pattern_cc_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
|
2645
2644
|
#@pattern_cc_1 << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
|
2646
2645
|
#@pattern_cc_1 << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
|
2647
2646
|
#@pattern_cc_1 << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
|
2648
2647
|
#@pattern_cc_1 << @_attr_value1 << TAG_SEARCH_2_4_2_2
|
2649
|
-
@pattern_cc_1 = "<#{@
|
2648
|
+
@pattern_cc_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))"
|
2650
2649
|
|
2651
|
-
@pattern_cc_1b = '' << TAG_OPEN << @
|
2652
|
-
#@pattern_cc_1b = "<#{@
|
2650
|
+
@pattern_cc_1b = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4
|
2651
|
+
#@pattern_cc_1b = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
|
2653
2652
|
|
2654
|
-
#@pattern_cc_1_1 = '' << TAG_OPEN << @
|
2653
|
+
#@pattern_cc_1_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
|
2655
2654
|
#@pattern_cc_1_1 << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
|
2656
2655
|
#@pattern_cc_1_1 << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
|
2657
2656
|
#@pattern_cc_1_1 << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
|
2658
2657
|
#@pattern_cc_1_1 << @_attr_value1 << TAG_SEARCH_4_7_2
|
2659
|
-
@pattern_cc_1_1 = "<#{@
|
2658
|
+
@pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
2660
2659
|
|
2661
|
-
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @
|
2660
|
+
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_name << TAG_SEARCH_4_3
|
2662
2661
|
|
2663
|
-
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @
|
2662
|
+
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_name << TAG_CLOSE
|
2664
2663
|
|
2665
|
-
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @
|
2664
|
+
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_name << TAG_CLOSE
|
2666
2665
|
|
2667
|
-
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @
|
2666
|
+
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_name << TAG_CLOSE
|
2668
2667
|
|
2669
|
-
#@pattern_cc_1_2 = ".*?<#{@
|
2668
|
+
#@pattern_cc_1_2 = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
|
2670
2669
|
#
|
2671
|
-
#@pattern_cc_2 = '' << "<\\/#{@
|
2670
|
+
#@pattern_cc_2 = '' << "<\\/#{@_name}>"
|
2672
2671
|
#
|
2673
|
-
#@pattern_cc_2_1 = ".*?<\\/#{@
|
2672
|
+
#@pattern_cc_2_1 = ".*?<\\/#{@_name}>"
|
2674
2673
|
#
|
2675
|
-
#@pattern_cc_2_2 = ".*?)<\\/#{@
|
2674
|
+
#@pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
|
2676
2675
|
|
2677
2676
|
#内容あり要素検索
|
2678
2677
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
@@ -2692,27 +2691,27 @@ module Meteor
|
|
2692
2691
|
|
2693
2692
|
private :element_pattern_with_5_2
|
2694
2693
|
|
2695
|
-
def element_without_5(
|
2696
|
-
element_without_5_1(
|
2694
|
+
def element_without_5(name)
|
2695
|
+
element_without_5_1(name, TAG_SEARCH_2_3_2_2)
|
2697
2696
|
end
|
2698
2697
|
|
2699
2698
|
private :element_without_5
|
2700
2699
|
|
2701
|
-
def element_without_5_1(
|
2700
|
+
def element_without_5_1(name, closer)
|
2702
2701
|
|
2703
2702
|
#要素
|
2704
|
-
@elm_ = Meteor::Element.new(
|
2703
|
+
@elm_ = Meteor::Element.new(name)
|
2705
2704
|
#属性
|
2706
2705
|
@elm_.attributes = @res[1]
|
2707
2706
|
#全体
|
2708
2707
|
@elm_.document = @res[0]
|
2709
2708
|
#空要素検索用パターン
|
2710
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
2709
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
|
2711
2710
|
#@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_6 << @_attr_name2 << ATTR_EQ
|
2712
2711
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_7 << @_attr_name2 << ATTR_EQ
|
2713
2712
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_6 << @_attr_name1 << ATTR_EQ
|
2714
2713
|
#@pattern_cc << @_attr_value1 << closer
|
2715
|
-
@pattern_cc = "<#{@
|
2714
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}"
|
2716
2715
|
|
2717
2716
|
@elm_.pattern = @pattern_cc
|
2718
2717
|
|
@@ -2908,7 +2907,7 @@ module Meteor
|
|
2908
2907
|
else
|
2909
2908
|
@position = @res.end(0)
|
2910
2909
|
|
2911
|
-
@
|
2910
|
+
@_name = @res[1]
|
2912
2911
|
|
2913
2912
|
create_pattern_2(args_cnt)
|
2914
2913
|
|
@@ -2956,22 +2955,22 @@ module Meteor
|
|
2956
2955
|
=end
|
2957
2956
|
|
2958
2957
|
# get elements (要素を取得する)
|
2959
|
-
# @overload elements(
|
2958
|
+
# @overload elements(name)
|
2960
2959
|
# get elements using tag name (要素のタグ名で要素を取得する)
|
2961
|
-
# @param [String,Symbol]
|
2960
|
+
# @param [String,Symbol] name tag name (タグ名)
|
2962
2961
|
# @return [Array<Meteor::Element>] element array(要素配列)
|
2963
|
-
# @overload elements(
|
2962
|
+
# @overload elements(name,attrs)
|
2964
2963
|
# get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
2965
|
-
# @param [String,Symbol]
|
2964
|
+
# @param [String,Symbol] name tag name (タグ名)
|
2966
2965
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
2967
2966
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
2968
2967
|
# @overload elements(attrs)
|
2969
2968
|
# get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
|
2970
2969
|
# @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
|
2971
2970
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
2972
|
-
# @overload elements(
|
2971
|
+
# @overload elements(name,attr_name,attr_value)
|
2973
2972
|
# get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
|
2974
|
-
# @param [String,Symbol] tag
|
2973
|
+
# @param [String,Symbol] name tag name (タグ名)
|
2975
2974
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
2976
2975
|
# @param [String] attr_value attribute value (属性値)
|
2977
2976
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
@@ -2980,9 +2979,9 @@ module Meteor
|
|
2980
2979
|
# @param [String,Symbol] attr_name attribute name (属性名)
|
2981
2980
|
# @param [String] attr_value attribute value (属性値)
|
2982
2981
|
# @return [Array<Meteor::Element>] element array (要素配列)
|
2983
|
-
# @overload elements(
|
2982
|
+
# @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
|
2984
2983
|
# get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
|
2985
|
-
# @param [String,Symbol]
|
2984
|
+
# @param [String,Symbol] name tag name (タグ名)
|
2986
2985
|
# @param [String,Symbol] attr_name1 attribute name1 (属性名1)
|
2987
2986
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
2988
2987
|
# @param [String,Symbol] attr_name2 attribute name2 (属性名2)
|
@@ -3077,21 +3076,21 @@ module Meteor
|
|
3077
3076
|
case args.size
|
3078
3077
|
when ONE
|
3079
3078
|
if @elm_.empty
|
3080
|
-
element_with_1(@elm_.
|
3079
|
+
element_with_1(@elm_.name)
|
3081
3080
|
else
|
3082
|
-
element_without_1(@elm_.
|
3081
|
+
element_without_1(@elm_.name)
|
3083
3082
|
end
|
3084
3083
|
when TWO,THREE
|
3085
3084
|
if @elm_.empty
|
3086
|
-
element_with_3_1(@elm_.
|
3085
|
+
element_with_3_1(@elm_.name)
|
3087
3086
|
else
|
3088
|
-
element_without_3(@elm_.
|
3087
|
+
element_without_3(@elm_.name)
|
3089
3088
|
end
|
3090
3089
|
when FOUR,FIVE
|
3091
3090
|
if @elm_.empty
|
3092
|
-
element_with_5_1(@elm_.
|
3091
|
+
element_with_5_1(@elm_.name)
|
3093
3092
|
else
|
3094
|
-
element_without_5(@elm_.
|
3093
|
+
element_without_5(@elm_.name)
|
3095
3094
|
end
|
3096
3095
|
end
|
3097
3096
|
|
@@ -3577,9 +3576,9 @@ module Meteor
|
|
3577
3576
|
|
3578
3577
|
#
|
3579
3578
|
# get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
|
3580
|
-
# @overload cxtag(
|
3579
|
+
# @overload cxtag(name,id)
|
3581
3580
|
# get cx(comment extension) tag using tag name and id attribute (要素のタグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
|
3582
|
-
# @param [String,Symbol]
|
3581
|
+
# @param [String,Symbol] name tag name (タグ名)
|
3583
3582
|
# @param [String] id id attribute value (ID属性値)
|
3584
3583
|
# @return [Meteor::Element] element (要素)
|
3585
3584
|
# @overload cxtag(id)
|
@@ -3606,20 +3605,20 @@ module Meteor
|
|
3606
3605
|
|
3607
3606
|
#
|
3608
3607
|
# get cx(comment extension) tag using tag name and id attribute (要素のタグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
|
3609
|
-
# @param [String]
|
3608
|
+
# @param [String] name tag name (タグ名)
|
3610
3609
|
# @param [String] id id attribute value (ID属性値)
|
3611
3610
|
# @return [Meteor::Element] element (要素)
|
3612
3611
|
#
|
3613
|
-
def cxtag_2(
|
3612
|
+
def cxtag_2(name, id)
|
3614
3613
|
|
3615
|
-
@
|
3614
|
+
@_name = Regexp.quote(name)
|
3616
3615
|
@_id = Regexp.quote(id)
|
3617
3616
|
|
3618
3617
|
#CXタグ検索用パターン
|
3619
|
-
#@pattern_cc = '' << SEARCH_CX_1 << @
|
3620
|
-
#@pattern_cc << id << SEARCH_CX_3 << @
|
3618
|
+
#@pattern_cc = '' << SEARCH_CX_1 << @_name << SEARCH_CX_2
|
3619
|
+
#@pattern_cc << id << SEARCH_CX_3 << @_name << SEARCH_CX_4 << @_name << SEARCH_CX_5
|
3621
3620
|
#@pattern_cc = "<!--\\s@#{tag}\\s([^<>]*id=\"#{id}\"[^<>]*)-->(((?!(<!--\\s\\/@#{tag})).)*)<!--\\s\\/@#{tag}\\s-->"
|
3622
|
-
@pattern_cc = "<!--\\s@#{@
|
3621
|
+
@pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s/@#{@_name})).)*)<!--\\s/@#{@_name}\\s-->"
|
3623
3622
|
|
3624
3623
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
3625
3624
|
#CXタグ検索
|
@@ -3627,7 +3626,7 @@ module Meteor
|
|
3627
3626
|
|
3628
3627
|
if @res
|
3629
3628
|
#要素
|
3630
|
-
@elm_ = Meteor::Element.new(
|
3629
|
+
@elm_ = Meteor::Element.new(name)
|
3631
3630
|
|
3632
3631
|
@elm_.cx = true
|
3633
3632
|
#属性
|
@@ -3741,20 +3740,20 @@ module Meteor
|
|
3741
3740
|
if self.element_hook
|
3742
3741
|
if self.element_hook.origin.mono
|
3743
3742
|
if self.element_hook.origin.cx
|
3744
|
-
#@root.hookDocument << SET_CX_1 << @root.element.
|
3743
|
+
#@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
|
3745
3744
|
#@root.hookDocument << @root.element.attributes << SET_CX_2
|
3746
3745
|
#@root.hookDocument << @root.element.mixed_content << SET_CX_3
|
3747
|
-
#@root.hookDocument << @root.element.
|
3748
|
-
self.document_hook << "<!-- @#{self.element_hook.
|
3746
|
+
#@root.hookDocument << @root.element.name << SET_CX_4
|
3747
|
+
self.document_hook << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
|
3749
3748
|
|
3750
|
-
#self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.
|
3749
|
+
#self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
|
3751
3750
|
else
|
3752
|
-
#@root.hookDocument << TAG_OPEN << @root.element.
|
3751
|
+
#@root.hookDocument << TAG_OPEN << @root.element.name
|
3753
3752
|
#@root.hookDocument << @root.element.attributes << TAG_CLOSE << @root.element.mixed_content
|
3754
|
-
#@root.hookDocument << TAG_OPEN3 << @root.element.
|
3755
|
-
self.document_hook << "<#{self.element_hook.
|
3753
|
+
#@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
|
3754
|
+
self.document_hook << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
|
3756
3755
|
|
3757
|
-
#self.document_hook << @root.kaigyo_code << "<#{self.element_hook.
|
3756
|
+
#self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
|
3758
3757
|
end
|
3759
3758
|
self.element_hook = Element.new!(self.element_hook.origin, self)
|
3760
3759
|
else
|
@@ -3762,20 +3761,20 @@ module Meteor
|
|
3762
3761
|
@_attributes = self.element_hook.attributes
|
3763
3762
|
|
3764
3763
|
if self.element_hook.origin.cx
|
3765
|
-
#@root.hookDocument << SET_CX_1 << @root.element.
|
3764
|
+
#@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
|
3766
3765
|
#@root.hookDocument << @_attributes << SET_CX_2
|
3767
3766
|
#@root.hookDocument << @root.document << SET_CX_3
|
3768
|
-
#@root.hookDocument << @root.element.
|
3769
|
-
self.document_hook << "<!-- @#{self.element_hook.
|
3767
|
+
#@root.hookDocument << @root.element.name << SET_CX_4
|
3768
|
+
self.document_hook << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
|
3770
3769
|
|
3771
|
-
#self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.
|
3770
|
+
#self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
|
3772
3771
|
else
|
3773
|
-
#@root.hookDocument << TAG_OPEN << @root.element.
|
3772
|
+
#@root.hookDocument << TAG_OPEN << @root.element.name
|
3774
3773
|
#@root.hookDocument << @_attributes << TAG_CLOSE << @root.document
|
3775
|
-
#@root.hookDocument << TAG_OPEN3 << @root.element.
|
3776
|
-
self.document_hook << "<#{self.element_hook.
|
3774
|
+
#@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
|
3775
|
+
self.document_hook << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
|
3777
3776
|
|
3778
|
-
#self.document_hook << @root.kaigyo_code << "<#{self.element_hook.
|
3777
|
+
#self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
|
3779
3778
|
end
|
3780
3779
|
self.element_hook = Element.new!(self.element_hook.origin, self)
|
3781
3780
|
end
|
@@ -4258,42 +4257,42 @@ module Meteor
|
|
4258
4257
|
|
4259
4258
|
#
|
4260
4259
|
# get element using tag name (要素のタグ名で検索し、要素を取得する)
|
4261
|
-
# @param [String]
|
4260
|
+
# @param [String] name tag name (タグ名)
|
4262
4261
|
# @return [Meteor::Element] element (要素)
|
4263
4262
|
#
|
4264
|
-
def element_1(
|
4265
|
-
@
|
4263
|
+
def element_1(name)
|
4264
|
+
@_name = Regexp.quote(name)
|
4266
4265
|
|
4267
4266
|
#空要素の場合(<->内容あり要素の場合)
|
4268
|
-
if is_match(@@match_tag,
|
4267
|
+
if is_match(@@match_tag, name)
|
4269
4268
|
#空要素検索用パターン
|
4270
|
-
@pattern_cc = '' << TAG_OPEN << @
|
4271
|
-
#@pattern_cc = "<#{@
|
4269
|
+
@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4_2
|
4270
|
+
#@pattern_cc = "<#{@_name}(|\\s[^<>]*)>"
|
4272
4271
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
4273
4272
|
@res = @pattern.match(@root.document)
|
4274
4273
|
if @res
|
4275
|
-
element_without_1(
|
4274
|
+
element_without_1(name)
|
4276
4275
|
else
|
4277
4276
|
if @error_check
|
4278
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
4277
|
+
puts Meteor::Exception::NoSuchElementException.new(name).message
|
4279
4278
|
end
|
4280
4279
|
@elm_ = nil
|
4281
4280
|
end
|
4282
4281
|
else
|
4283
4282
|
#内容あり要素検索用パターン
|
4284
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
4285
|
-
#@pattern_cc << TAG_SEARCH_1_2 << @
|
4286
|
-
@pattern_cc = "<#{
|
4283
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_1_1 << @_name
|
4284
|
+
#@pattern_cc << TAG_SEARCH_1_2 << @_name << TAG_CLOSE
|
4285
|
+
@pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{tag}[^<>]*>)).)*)<\\/#{@_name}>"
|
4287
4286
|
|
4288
4287
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
4289
4288
|
#内容あり要素検索
|
4290
4289
|
@res = @pattern.match(@root.document)
|
4291
4290
|
#内容あり要素の場合
|
4292
4291
|
if @res
|
4293
|
-
element_with_1(
|
4292
|
+
element_with_1(name)
|
4294
4293
|
else
|
4295
4294
|
if @error_check
|
4296
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
4295
|
+
puts Meteor::Exception::NoSuchElementException.new(name).message
|
4297
4296
|
end
|
4298
4297
|
@elm_ = nil
|
4299
4298
|
end
|
@@ -4304,8 +4303,8 @@ module Meteor
|
|
4304
4303
|
|
4305
4304
|
private :element_1
|
4306
4305
|
|
4307
|
-
def element_without_1(
|
4308
|
-
@elm_ = Meteor::Element.new(
|
4306
|
+
def element_without_1(name)
|
4307
|
+
@elm_ = Meteor::Element.new(name)
|
4309
4308
|
#属性
|
4310
4309
|
@elm_.attributes = @res[1]
|
4311
4310
|
#空要素検索用パターン
|
@@ -4320,53 +4319,53 @@ module Meteor
|
|
4320
4319
|
|
4321
4320
|
#
|
4322
4321
|
# get element using tag name and attribute(name="value") (要素のタグ名、属性(属性名="属性値")で検索し、要素を取得する)
|
4323
|
-
# @param [String]
|
4322
|
+
# @param [String] name tag name (タグ名)
|
4324
4323
|
# @param [String] attr_name attribute name (属性名)
|
4325
4324
|
# @param [String] attr_value attribute value (属性値)
|
4326
4325
|
# @return [Meteor::Element] element (要素)
|
4327
4326
|
#
|
4328
|
-
def element_3(
|
4327
|
+
def element_3(name, attr_name, attr_value)
|
4329
4328
|
|
4330
|
-
element_quote_3(
|
4329
|
+
element_quote_3(name, attr_name, attr_value)
|
4331
4330
|
|
4332
4331
|
#空要素の場合(<->内容あり要素の場合)
|
4333
|
-
if is_match(@@match_tag,
|
4332
|
+
if is_match(@@match_tag, name)
|
4334
4333
|
#空要素検索パターン
|
4335
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
4334
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
4336
4335
|
#@pattern_cc << @_attr_value << TAG_SEARCH_2_4_3
|
4337
|
-
@pattern_cc = "<#{@
|
4336
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>"
|
4338
4337
|
|
4339
4338
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
4340
4339
|
#空要素検索
|
4341
4340
|
@res = @pattern.match(@root.document)
|
4342
4341
|
if @res
|
4343
|
-
element_without_3(
|
4342
|
+
element_without_3(name)
|
4344
4343
|
else
|
4345
4344
|
if @error_check
|
4346
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
4345
|
+
puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
|
4347
4346
|
end
|
4348
4347
|
@elm_ = nil
|
4349
4348
|
end
|
4350
4349
|
else
|
4351
4350
|
#内容あり要素検索パターン
|
4352
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
4353
|
-
#@pattern_cc << @_attr_value << TAG_SEARCH_2_2 << @
|
4354
|
-
#@pattern_cc << TAG_SEARCH_1_2 << @
|
4355
|
-
@pattern_cc = "<#{@
|
4351
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
4352
|
+
#@pattern_cc << @_attr_value << TAG_SEARCH_2_2 << @_name
|
4353
|
+
#@pattern_cc << TAG_SEARCH_1_2 << @_name << TAG_CLOSE
|
4354
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
4356
4355
|
|
4357
4356
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
4358
4357
|
#内容あり要素検索
|
4359
4358
|
@res = @pattern.match(@root.document)
|
4360
4359
|
|
4361
|
-
if !@res && !is_match(@@match_tag_sng,
|
4360
|
+
if !@res && !is_match(@@match_tag_sng, name)
|
4362
4361
|
@res = element_with_3_2
|
4363
4362
|
end
|
4364
4363
|
|
4365
4364
|
if @res
|
4366
|
-
element_with_3_1(
|
4365
|
+
element_with_3_1(name)
|
4367
4366
|
else
|
4368
4367
|
if @error_check
|
4369
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
4368
|
+
puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
|
4370
4369
|
end
|
4371
4370
|
@elm_ = nil
|
4372
4371
|
end
|
@@ -4377,8 +4376,8 @@ module Meteor
|
|
4377
4376
|
|
4378
4377
|
private :element_3
|
4379
4378
|
|
4380
|
-
def element_without_3(
|
4381
|
-
element_without_3_1(
|
4379
|
+
def element_without_3(name)
|
4380
|
+
element_without_3_1(name, TAG_SEARCH_2_4_3)
|
4382
4381
|
end
|
4383
4382
|
|
4384
4383
|
private :element_without_3
|
@@ -4416,48 +4415,48 @@ module Meteor
|
|
4416
4415
|
|
4417
4416
|
#
|
4418
4417
|
# get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で検索し、要素を取得する)
|
4419
|
-
# @param [String]
|
4418
|
+
# @param [String] name tag name (タグ名)
|
4420
4419
|
# @param [String] attr_name1 attribute name1 (属性名1)
|
4421
4420
|
# @param [String] attr_value1 attribute value1 (属性値1)
|
4422
4421
|
# @param [String] attr_name2 attribute name2 (属性名2)
|
4423
4422
|
# @param [String] attr_value2 attribute value2 (属性値2)
|
4424
4423
|
# @return [Meteor::Element] element (要素)
|
4425
4424
|
#
|
4426
|
-
def element_5(
|
4425
|
+
def element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
4427
4426
|
|
4428
|
-
element_quote_5(
|
4427
|
+
element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
4429
4428
|
|
4430
4429
|
#空要素の場合(<->内容あり要素の場合)
|
4431
|
-
if is_match(@@match_tag,
|
4430
|
+
if is_match(@@match_tag, name)
|
4432
4431
|
#空要素検索パターン
|
4433
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
4432
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
|
4434
4433
|
#@pattern_cc << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
|
4435
4434
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
|
4436
4435
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
|
4437
4436
|
#@pattern_cc << @_attr_value1 << TAG_SEARCH_2_4_3_2
|
4438
|
-
@pattern_cc = "<#{@
|
4437
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>"
|
4439
4438
|
|
4440
4439
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
4441
4440
|
#空要素検索
|
4442
4441
|
@res = @pattern.match(@root.document)
|
4443
4442
|
|
4444
4443
|
if @res
|
4445
|
-
element_without_5(
|
4444
|
+
element_without_5(name)
|
4446
4445
|
else
|
4447
4446
|
if @error_check
|
4448
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
4447
|
+
puts Meteor::Exception::NoSuchElementException.new(name, attr_name1, attr_value1, attr_name2, attr_value2).message
|
4449
4448
|
end
|
4450
4449
|
@elm_ = nil
|
4451
4450
|
end
|
4452
4451
|
else
|
4453
4452
|
#内容あり要素検索パターン
|
4454
|
-
#@pattern_cc = '' << TAG_OPEN << @
|
4453
|
+
#@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
|
4455
4454
|
#@pattern_cc << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
|
4456
4455
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
|
4457
4456
|
#@pattern_cc << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
|
4458
|
-
#@pattern_cc << @_attr_value1 << TAG_SEARCH_2_2_2 << @
|
4459
|
-
#@pattern_cc << TAG_SEARCH_1_2 << @
|
4460
|
-
@pattern_cc = "<#{@
|
4457
|
+
#@pattern_cc << @_attr_value1 << TAG_SEARCH_2_2_2 << @_name
|
4458
|
+
#@pattern_cc << TAG_SEARCH_1_2 << @_name << TAG_CLOSE
|
4459
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
|
4461
4460
|
|
4462
4461
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
4463
4462
|
#内容あり要素検索
|
@@ -4468,10 +4467,10 @@ module Meteor
|
|
4468
4467
|
end
|
4469
4468
|
|
4470
4469
|
if @res
|
4471
|
-
element_with_5_1(
|
4470
|
+
element_with_5_1(name)
|
4472
4471
|
else
|
4473
4472
|
if @error_check
|
4474
|
-
puts Meteor::Exception::NoSuchElementException.new(
|
4473
|
+
puts Meteor::Exception::NoSuchElementException.new(name, attr_name1, attr_value1, attr_name2, attr_value2).message
|
4475
4474
|
end
|
4476
4475
|
@elm_ = nil
|
4477
4476
|
end
|
@@ -4482,8 +4481,8 @@ module Meteor
|
|
4482
4481
|
|
4483
4482
|
private :element_5
|
4484
4483
|
|
4485
|
-
def element_without_5(
|
4486
|
-
element_without_5_1(
|
4484
|
+
def element_without_5(name)
|
4485
|
+
element_without_5_1(name, TAG_SEARCH_2_4_3_2)
|
4487
4486
|
end
|
4488
4487
|
|
4489
4488
|
private :element_without_5
|
@@ -4527,15 +4526,15 @@ module Meteor
|
|
4527
4526
|
private :element_4
|
4528
4527
|
|
4529
4528
|
def edit_attrs_(elm, attr_name, attr_value)
|
4530
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
4529
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
4531
4530
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_selected_m, @@pattern_selected_r)
|
4532
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
4531
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
4533
4532
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_multiple_m, @@pattern_multiple_r)
|
4534
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
4533
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
4535
4534
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_disabled_m, @@pattern_disabled_r)
|
4536
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
4535
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
4537
4536
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_checked_m, @@pattern_checked_r)
|
4538
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
4537
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
4539
4538
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_readonly_m, @@pattern_readonly_r)
|
4540
4539
|
else
|
4541
4540
|
super(elm, attr_name, attr_value)
|
@@ -4573,15 +4572,15 @@ module Meteor
|
|
4573
4572
|
private :edit_document_1
|
4574
4573
|
|
4575
4574
|
def get_attr_value_(elm, attr_name)
|
4576
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
4575
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
4577
4576
|
get_attr_value_r(elm, @@pattern_selected_m)
|
4578
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
4577
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
4579
4578
|
get_attr_value_r(elm, @@pattern_multiple_m)
|
4580
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
4579
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
4581
4580
|
get_attr_value_r(elm, @@pattern_disabled_m)
|
4582
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
4581
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
4583
4582
|
get_attr_value_r(elm, @@pattern_checked_m)
|
4584
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
4583
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
4585
4584
|
get_attr_value_r(elm, @@pattern_readonly_m)
|
4586
4585
|
else
|
4587
4586
|
super(elm, attr_name)
|
@@ -4723,7 +4722,7 @@ module Meteor
|
|
4723
4722
|
def unescape_content(content, elm)
|
4724
4723
|
content_ = unescape(content)
|
4725
4724
|
|
4726
|
-
if elm.cx || !is_match(@@match_tag_2, elm.
|
4725
|
+
if elm.cx || !is_match(@@match_tag_2, elm.name)
|
4727
4726
|
if content.include?(BR_2)
|
4728
4727
|
#「<br>」->「¥r?¥n」
|
4729
4728
|
content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
|
@@ -4979,15 +4978,15 @@ module Meteor
|
|
4979
4978
|
|
4980
4979
|
def edit_attrs_(elm, attr_name, attr_value)
|
4981
4980
|
|
4982
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
4981
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
4983
4982
|
edit_attrs_5(elm, attr_value, @@pattern_selected_m, @@pattern_selected_r, SELECTED_U)
|
4984
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
4983
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
4985
4984
|
edit_attrs_5(elm, attr_value, @@pattern_multiple_m, @@pattern_multiple_r, MULTIPLE_U)
|
4986
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
4985
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
4987
4986
|
edit_attrs_5(elm, attr_value, @@pattern_disabled_m, @@pattern_disabled_r, DISABLED_U)
|
4988
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
4987
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
4989
4988
|
edit_attrs_5(elm, attr_value, @@pattern_checked_m, @@pattern_checked_r, CHECKED_U)
|
4990
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
4989
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
4991
4990
|
edit_attrs_5(elm, attr_value, @@pattern_readonly_m, @@pattern_readonly_r, READONLY_U)
|
4992
4991
|
else
|
4993
4992
|
super(elm, attr_name, attr_value)
|
@@ -5027,15 +5026,15 @@ module Meteor
|
|
5027
5026
|
private :edit_attrs_5
|
5028
5027
|
|
5029
5028
|
def get_attr_value_(elm, attr_name)
|
5030
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
5029
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
5031
5030
|
get_attr_value_r(elm, attr_name, @@pattern_selected_m1)
|
5032
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
5031
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
5033
5032
|
get_attr_value_r(elm, attr_name, @@pattern_multiple_m1)
|
5034
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
5033
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
5035
5034
|
get_attr_value_r(elm, attr_name, @@pattern_disabled_m1)
|
5036
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
5035
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
5037
5036
|
get_attr_value_r(elm, attr_name, @@pattern_checked_m1)
|
5038
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
5037
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
5039
5038
|
get_attr_value_r(elm, attr_name, @@pattern_readonly_m1)
|
5040
5039
|
else
|
5041
5040
|
super(elm, attr_name)
|
@@ -5163,7 +5162,7 @@ module Meteor
|
|
5163
5162
|
def unescape_content(content, elm)
|
5164
5163
|
content_ = unescape(content)
|
5165
5164
|
|
5166
|
-
if (elm.cx || !is_match(@@match_tag_2, elm.
|
5165
|
+
if (elm.cx || !is_match(@@match_tag_2, elm.name)) && content.include?(BR_2)
|
5167
5166
|
#「<br>」->「¥r?¥n」
|
5168
5167
|
content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
|
5169
5168
|
end
|
@@ -5278,17 +5277,17 @@ module Meteor
|
|
5278
5277
|
private :analyze_content_type
|
5279
5278
|
|
5280
5279
|
def edit_attrs_(elm, attr_name, attr_value)
|
5281
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
5280
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
5282
5281
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_selected_m, @@pattern_selected_r)
|
5283
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
5282
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
5284
5283
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_multiple_m, @@pattern_multiple_r)
|
5285
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
5284
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
5286
5285
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_disabled_m, @@pattern_disabled_r)
|
5287
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
5286
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
5288
5287
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_checked_m, @@pattern_checked_r)
|
5289
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
5288
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
5290
5289
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_readonly_m, @@pattern_readonly_r)
|
5291
|
-
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.
|
5290
|
+
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
|
5292
5291
|
edit_attrs_5(elm, attr_name, attr_value, @@pattern_required_m, @@pattern_required_r)
|
5293
5292
|
else
|
5294
5293
|
super(elm, attr_name, attr_value)
|
@@ -5298,17 +5297,17 @@ module Meteor
|
|
5298
5297
|
private :edit_attrs_
|
5299
5298
|
|
5300
5299
|
def get_attr_value_(elm, attr_name)
|
5301
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
5300
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
5302
5301
|
get_attr_value_r(elm, @@pattern_selected_m)
|
5303
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
5302
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
5304
5303
|
get_attr_value_r(elm, @@pattern_multiple_m)
|
5305
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
5304
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
5306
5305
|
get_attr_value_r(elm, @@pattern_disabled_m)
|
5307
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
5306
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
5308
5307
|
get_attr_value_r(elm, @@pattern_checked_m)
|
5309
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
5308
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
5310
5309
|
get_attr_value_r(elm, @@pattern_readonly_m)
|
5311
|
-
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.
|
5310
|
+
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
|
5312
5311
|
get_attr_value_r(elm, @@pattern_required_m)
|
5313
5312
|
else
|
5314
5313
|
super(elm, attr_name)
|
@@ -5419,17 +5418,17 @@ module Meteor
|
|
5419
5418
|
|
5420
5419
|
def edit_attrs_(elm, attr_name, attr_value)
|
5421
5420
|
|
5422
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
5421
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
5423
5422
|
edit_attrs_5(elm, attr_value, @@pattern_selected_m, @@pattern_selected_r, SELECTED_U)
|
5424
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
5423
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
5425
5424
|
edit_attrs_5(elm, attr_value, @@pattern_multiple_m, @@pattern_multiple_r, MULTIPLE_U)
|
5426
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
5425
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
5427
5426
|
edit_attrs_5(elm, attr_value, @@pattern_disabled_m, @@pattern_disabled_r, DISABLED_U)
|
5428
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
5427
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
5429
5428
|
edit_attrs_5(elm, attr_value, @@pattern_checked_m, @@pattern_checked_r, CHECKED_U)
|
5430
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
5429
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
5431
5430
|
edit_attrs_5(elm, attr_value, @@pattern_readonly_m, @@pattern_readonly_r, READONLY_U)
|
5432
|
-
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.
|
5431
|
+
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
|
5433
5432
|
edit_attrs_5(elm, attr_value, @@pattern_required_m, @@pattern_required_r, REQUIRED_U)
|
5434
5433
|
else
|
5435
5434
|
super(elm, attr_name, attr_value)
|
@@ -5440,17 +5439,17 @@ module Meteor
|
|
5440
5439
|
private :edit_attrs_
|
5441
5440
|
|
5442
5441
|
def get_attr_value_(elm, attr_name)
|
5443
|
-
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.
|
5442
|
+
if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
|
5444
5443
|
get_attr_value_r(elm, attr_name, @@pattern_selected_m1)
|
5445
|
-
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.
|
5444
|
+
elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
|
5446
5445
|
get_attr_value_r(elm, attr_name, @@pattern_multiple_m1)
|
5447
|
-
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.
|
5446
|
+
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
|
5448
5447
|
get_attr_value_r(elm, attr_name, @@pattern_disabled_m1)
|
5449
|
-
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.
|
5448
|
+
elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
|
5450
5449
|
get_attr_value_r(elm, attr_name, @@pattern_checked_m1)
|
5451
|
-
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.
|
5450
|
+
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
|
5452
5451
|
get_attr_value_r(elm, attr_name, @@pattern_readonly_m1)
|
5453
|
-
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.
|
5452
|
+
elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
|
5454
5453
|
get_attr_value_r(elm, attr_name, @@pattern_required_m1)
|
5455
5454
|
else
|
5456
5455
|
super(elm, attr_name)
|