meteor 0.9.12 → 0.9.13
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/ChangeLog +5 -1
- data/Gemfile.lock +2 -2
- data/README.md +5 -3
- data/demo/html.rb +41 -38
- data/demo/html4.rb +53 -50
- data/demo/ml/sample_html.html +5 -4
- data/demo/ml/sample_html4.html +4 -4
- data/demo/ml/sample_xhtml.html +6 -5
- data/demo/ml/sample_xhtml4.html +3 -3
- data/demo/xhtml.rb +39 -36
- data/demo/xhtml4.rb +37 -34
- data/demo/xml.rb +63 -63
- data/lib/meteor/attribute.rb +33 -0
- data/lib/meteor/attribute_map.rb +146 -0
- data/lib/meteor/core/kernel.rb +2182 -0
- data/lib/meteor/core/util/pattern_cache.rb +107 -0
- data/lib/meteor/element.rb +532 -0
- data/lib/meteor/element_factory.rb +68 -0
- data/lib/meteor/exception/no_such_element_exception.rb +84 -0
- data/lib/meteor/ml/html/parser_impl.rb +142 -0
- data/lib/meteor/ml/html4/parser_impl.rb +684 -0
- data/lib/meteor/ml/xhtml/parser_impl.rb +139 -0
- data/lib/meteor/ml/xhtml4/parser_impl.rb +398 -0
- data/lib/meteor/ml/xml/parser_impl.rb +160 -0
- data/lib/meteor/parser.rb +15 -0
- data/lib/meteor/parser_factory.rb +493 -0
- data/lib/meteor/root_element.rb +24 -0
- data/lib/meteor.rb +20 -5593
- data/meteor.gemspec +3 -3
- metadata +21 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88fad5c6e441dad9f62db837cb68812b78ad2b92ddebf69a07027e2c497fa880
|
|
4
|
+
data.tar.gz: 3eb96c0e72a512a3b41f9acf9014d46c80f1f206183d5ca785440fe520468126
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b368f523ca876c85b3f2e90d89af9f31fe3a828e15cbdcf4ba1c714454ac9e3075f03ae06c0b3240a10b9aa2a92597adb608c878da27b9859b1f7d74981a8e5
|
|
7
|
+
data.tar.gz: b1526787c25b9645d3e51ce914837b4919f0ccc1a116feb0a25fbac6e6eff88bbbba3c189aa38aae433511309b299ea1f1ffe21f413293dba98512c8ce2704c4
|
data/ChangeLog
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
== 0.9.13 / 2026-05-31 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
|
+
|
|
3
|
+
* Refactoring
|
|
4
|
+
|
|
1
5
|
== 0.9.12 / 2026-01-20 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
6
|
|
|
3
|
-
*
|
|
7
|
+
* Enable frozen_string_literal
|
|
4
8
|
|
|
5
9
|
== 0.9.8 / 2014-01-07 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
6
10
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Meteor
|
|
3
3
|
|
|
4
4
|
==================
|
|
5
|
-
A lightweight HTML & XML Parser
|
|
5
|
+
A lightweight (X)HTML & XML Parser
|
|
6
6
|
|
|
7
7
|
```shell
|
|
8
8
|
gem install meteor #gem installation
|
|
@@ -58,7 +58,9 @@ https://github.com/asip/meteor/tree/master/demo
|
|
|
58
58
|
Licensed under the LGPL V2.1.
|
|
59
59
|
|
|
60
60
|
## Author
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
Yasumasa Ashida (<ys.ashida@gmail.com>)
|
|
62
63
|
|
|
63
64
|
## Copyright
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
(c) 2008-present, Yasumasa Ashida
|
data/demo/html.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -* coding: UTF-8 -*-
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
|
-
#require 'rubygems'
|
|
5
|
+
# require 'rubygems'
|
|
6
6
|
require 'meteor'
|
|
7
7
|
|
|
8
8
|
Meteor::ElementFactory.link(:html,"ml/sample_html.html", 'UTF-8')
|
|
@@ -11,53 +11,53 @@ root = Meteor::ElementFactory.element('/ml/sample_html')
|
|
|
11
11
|
start_time = Time.new.to_f
|
|
12
12
|
|
|
13
13
|
elm_hello = root.element(id: 'hello')
|
|
14
|
-
elm_hello['class'] = 'red' #elm_hello.attr(class: 'red')
|
|
15
|
-
#elm_hello['class'] = nil #elm_hello.remove_attr('class')
|
|
14
|
+
elm_hello['class'] = 'red' # elm_hello.attr(class: 'red')
|
|
15
|
+
# elm_hello['class'] = nil # elm_hello.remove_attr('class')
|
|
16
16
|
|
|
17
17
|
elm_hello2 = root.element(id: 'hello2')
|
|
18
|
-
elm_hello2.content = 'Hello,Tester' #elm_hello2.content('Hello,Tester')
|
|
18
|
+
elm_hello2.content = 'Hello,Tester' # elm_hello2.content('Hello,Tester')
|
|
19
19
|
|
|
20
20
|
elm_text1 = root.element(id: 'text1')
|
|
21
|
-
elm_text1['value'] = 'めも' #elm_text1.attr(value: めも')
|
|
22
|
-
elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
|
|
23
|
-
elm_text1['required'] = true #elm_text1.attr(required: true)
|
|
24
|
-
|
|
25
|
-
#elm_text1['disabled'] = nil #elm_text1.remove_attr('disabled')
|
|
26
|
-
#map = elm_text1.attr_map
|
|
27
|
-
#map.names.each { |item|
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#}
|
|
31
|
-
|
|
32
|
-
#elm_radio1 = root.element('input', id: 'radio1', type: 'radio')
|
|
33
|
-
#elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
|
|
34
|
-
#puts elm_radio1.document
|
|
35
|
-
|
|
36
|
-
#elm_select1 = root.element('select', id: 'select1')
|
|
37
|
-
#elm_select1 = root.element('select')
|
|
38
|
-
#elm_select1['multiple'] = true #elm_select1.attr(multiple: true)
|
|
39
|
-
#puts elm_select1['multiple'] #puts elm_select1.attr('multiple')
|
|
40
|
-
|
|
41
|
-
#elm_option1 = root.element('option', id: 'option1')
|
|
42
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
|
43
|
-
#elm_option1['selected'] = nil #elm_option1.remove_attr('selected')
|
|
44
|
-
#puts elm_option1['selected'] #puts elm_option1.attr('selected')
|
|
45
|
-
#puts elm_text1['readonly'] #puts elm_text1.attr('readonly')
|
|
21
|
+
elm_text1['value'] = 'めも' # elm_text1.attr(value: めも')
|
|
22
|
+
elm_text1['disabled'] = true # elm_text1.attr(disabled: true)
|
|
23
|
+
elm_text1['required'] = true # elm_text1.attr(required: true)
|
|
24
|
+
|
|
25
|
+
# elm_text1['disabled'] = nil # elm_text1.remove_attr('disabled')
|
|
26
|
+
# map = elm_text1.attr_map
|
|
27
|
+
# map.names.each { |item|
|
|
28
|
+
# puts item
|
|
29
|
+
# puts map.fetch(item)
|
|
30
|
+
# }
|
|
31
|
+
|
|
32
|
+
# elm_radio1 = root.element('input', id: 'radio1', type: 'radio')
|
|
33
|
+
# elm_radio1['checked'] = true # elm_radio1.attr(checked: true)
|
|
34
|
+
# puts elm_radio1.document
|
|
35
|
+
|
|
36
|
+
# elm_select1 = root.element('select', id: 'select1')
|
|
37
|
+
# elm_select1 = root.element('select')
|
|
38
|
+
# elm_select1['multiple'] = true # elm_select1.attr(multiple: true)
|
|
39
|
+
# puts elm_select1['multiple'] # puts elm_select1.attr('multiple')
|
|
40
|
+
|
|
41
|
+
# elm_option1 = root.element('option', id: 'option1')
|
|
42
|
+
# elm_option1['selected'] = true # elm_option1.attr(selected: true)
|
|
43
|
+
# elm_option1['selected'] = nil # elm_option1.remove_attr('selected')
|
|
44
|
+
# puts elm_option1['selected'] # puts elm_option1.attr('selected')
|
|
45
|
+
# puts elm_text1['readonly'] # puts elm_text1.attr('readonly')
|
|
46
46
|
|
|
47
47
|
elm_select2 = root.element('select',id: 'select2')
|
|
48
48
|
elm_select2['multiple'] = true
|
|
49
49
|
elm_option2 = elm_select2.element('option',id: 'option2')
|
|
50
50
|
co_elm = elm_option2.element()
|
|
51
51
|
10.times { |i|
|
|
52
|
-
co_elm['value'] = i #co_elm.attr(value: i)
|
|
53
|
-
#'<' +
|
|
52
|
+
co_elm['value'] = i # co_elm.attr(value: i)
|
|
53
|
+
# '<' +
|
|
54
54
|
if i == 1 then
|
|
55
|
-
co_elm['selected'] = true #co_elm.attr(selected: true)
|
|
55
|
+
co_elm['selected'] = true # co_elm.attr(selected: true)
|
|
56
56
|
else
|
|
57
|
-
co_elm['selected'] = false #co_elm.attr(selected: false)
|
|
57
|
+
co_elm['selected'] = false # co_elm.attr(selected: false)
|
|
58
58
|
end
|
|
59
|
-
co_elm.content = i #co_elm.content(i)
|
|
60
|
-
co_elm['id'] = nil #co_elm.remove_attr('id')
|
|
59
|
+
co_elm.content = i # co_elm.content(i)
|
|
60
|
+
co_elm['id'] = nil # co_elm.remove_attr('id')
|
|
61
61
|
co_elm.flash
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -74,7 +74,7 @@ elm_dt3_ = elm_.element(id: 'cc')
|
|
|
74
74
|
elm_dt1.content = i
|
|
75
75
|
elm_dt2.content = i
|
|
76
76
|
elm_dt3.content = i
|
|
77
|
-
#"< \n" +
|
|
77
|
+
# "< \n" +
|
|
78
78
|
elm_.flash
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -85,8 +85,8 @@ end_time = Time.new.to_f
|
|
|
85
85
|
puts root.document
|
|
86
86
|
|
|
87
87
|
elms = root.elements('tr', id: 'loop')
|
|
88
|
-
#elms = root.elements('input', id: 'radio1', type: 'radio')
|
|
89
|
-
#elms = root.css('input[id=radio1][type=radio]')
|
|
88
|
+
# elms = root.elements('input', id: 'radio1', type: 'radio')
|
|
89
|
+
# elms = root.css('input[id=radio1][type=radio]')
|
|
90
90
|
elms.each{|elm|
|
|
91
91
|
puts '-------'
|
|
92
92
|
puts 'doc----'
|
|
@@ -97,4 +97,7 @@ elms.each{|elm|
|
|
|
97
97
|
puts elm.mixed_content
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
puts "charset:#{root.charset}"
|
|
101
|
+
puts "content-type:#{root.content_type}"
|
|
102
|
+
|
|
100
103
|
puts '' + (end_time - start_time).to_s + ' sec'
|
data/demo/html4.rb
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# -* coding: UTF-8 -*-
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
|
-
#require 'rubygems'
|
|
5
|
+
# require 'rubygems'
|
|
6
6
|
require 'meteor'
|
|
7
7
|
|
|
8
|
-
#Meteor::ElementFactory.link(:html4,'ml/sample_4.html', 'UTF-8')
|
|
8
|
+
# Meteor::ElementFactory.link(:html4,'ml/sample_4.html', 'UTF-8')
|
|
9
9
|
Meteor::ElementFactory.options= {type: :html4}
|
|
10
10
|
Meteor::ElementFactory.link('ml/sample_html4.html')
|
|
11
11
|
|
|
@@ -14,51 +14,51 @@ root = Meteor::ElementFactory.element('/ml/sample_html4')
|
|
|
14
14
|
start_time = Time.new.to_f
|
|
15
15
|
|
|
16
16
|
elm_hello = root.element(id: 'hello')
|
|
17
|
-
elm_hello['class'] = 'red' #elm_hello.attr(class: 'red')
|
|
18
|
-
#elm_hello['class'] = nil #elm_hello.remove_attr('class')
|
|
17
|
+
elm_hello['class'] = 'red' # elm_hello.attr(class: 'red')
|
|
18
|
+
# elm_hello['class'] = nil # elm_hello.remove_attr('class')
|
|
19
19
|
|
|
20
20
|
elm_hello2 = root.element(id: 'hello2')
|
|
21
|
-
elm_hello2.content = 'Hello,Tester' #elm_hello2.content('Hello,Tester')
|
|
21
|
+
elm_hello2.content = 'Hello,Tester' # elm_hello2.content('Hello,Tester')
|
|
22
22
|
|
|
23
|
-
#elm_hello3 = root.cxtag('hello3')
|
|
24
|
-
#elm_hello3.content = "Hello,Hello\ntt" #elm_hello3.content = "Hello,Hello"
|
|
25
|
-
#puts elm_hello3.pattern
|
|
26
|
-
#puts elm_hello3.mixed_content
|
|
27
|
-
#puts elm_hello3.document
|
|
28
|
-
#puts elm_hello3.content
|
|
29
|
-
#puts elm_hello3.mixed_content
|
|
23
|
+
# elm_hello3 = root.cxtag('hello3')
|
|
24
|
+
# elm_hello3.content = "Hello,Hello\ntt" # elm_hello3.content = "Hello,Hello"
|
|
25
|
+
# puts elm_hello3.pattern
|
|
26
|
+
# puts elm_hello3.mixed_content
|
|
27
|
+
# puts elm_hello3.document
|
|
28
|
+
# puts elm_hello3.content
|
|
29
|
+
# puts elm_hello3.mixed_content
|
|
30
30
|
|
|
31
31
|
elm_text1 = root.element('input', id: 'text1')
|
|
32
|
-
#elm_text1['value'] = 'めも' #elm_text1.attr(value: 'めも')
|
|
33
|
-
#elm_text1.attr = {value: 'メモ'}
|
|
34
|
-
#elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
|
|
32
|
+
# elm_text1['value'] = 'めも' # elm_text1.attr(value: 'めも')
|
|
33
|
+
# elm_text1.attr = {value: 'メモ'}
|
|
34
|
+
# elm_text1['disabled'] = true # elm_text1.attr(disabled: true)
|
|
35
35
|
elm_text1.attrs = {value: 'メモ', disabled: true, readonly: true}
|
|
36
|
-
#puts elm_text1.attrs
|
|
37
|
-
#elm_text1['disabled'] = nil #elm_text1.remove_attr('disabled')
|
|
38
|
-
#map = elm_text1.attr_map
|
|
39
|
-
#map.names.each { |item|
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#}
|
|
43
|
-
|
|
44
|
-
#elm_radio1 = root.element('input', id: 'radio1', type: 'radio')
|
|
45
|
-
##elm_radio1 = root.css('input[id=radio1][type=radio]')
|
|
46
|
-
##elm_radio1 = root.css('#radio1') #elm_radio1 = root.css('input#radio1')
|
|
47
|
-
##elm_radio1 = root.css('.test') #elm_radio1 = root.css('input.test')
|
|
48
|
-
##elm_radio1 = root.css('[id=radio1][type=radio]')
|
|
49
|
-
#elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
|
|
50
|
-
#puts elm_radio1.document
|
|
51
|
-
|
|
52
|
-
#elm_select1 = root.element('select', id: 'select1')
|
|
53
|
-
#elm_select1 = root.element('select')
|
|
54
|
-
#elm_select1['multiple'] = true #elm_select1.attr('multiple',true)
|
|
55
|
-
#puts elm_select1['multiple'] #puts elm_select1.attr('multiple')
|
|
56
|
-
|
|
57
|
-
#elm_option1 = root.element('option', id: 'option1')
|
|
58
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
|
59
|
-
#elm_option1['selected'] = nil #elm_option1.remove_attr('selected')
|
|
60
|
-
#puts elm_option1['selected'] #puts elm_option1.attr('selected')
|
|
61
|
-
#puts elm_text1['readonly'] #puts elm_text1.attr('readonly')
|
|
36
|
+
# puts elm_text1.attrs
|
|
37
|
+
# elm_text1['disabled'] = nil # elm_text1.remove_attr('disabled')
|
|
38
|
+
# map = elm_text1.attr_map
|
|
39
|
+
# map.names.each { |item|
|
|
40
|
+
# puts item
|
|
41
|
+
# puts map.fetch(item)
|
|
42
|
+
# }
|
|
43
|
+
|
|
44
|
+
# elm_radio1 = root.element('input', id: 'radio1', type: 'radio')
|
|
45
|
+
## elm_radio1 = root.css('input[id=radio1][type=radio]')
|
|
46
|
+
## elm_radio1 = root.css('# radio1') # elm_radio1 = root.css('input# radio1')
|
|
47
|
+
## elm_radio1 = root.css('.test') # elm_radio1 = root.css('input.test')
|
|
48
|
+
## elm_radio1 = root.css('[id=radio1][type=radio]')
|
|
49
|
+
# elm_radio1['checked'] = true # elm_radio1.attr(checked: true)
|
|
50
|
+
# puts elm_radio1.document
|
|
51
|
+
|
|
52
|
+
# elm_select1 = root.element('select', id: 'select1')
|
|
53
|
+
# elm_select1 = root.element('select')
|
|
54
|
+
# elm_select1['multiple'] = true # elm_select1.attr('multiple',true)
|
|
55
|
+
# puts elm_select1['multiple'] # puts elm_select1.attr('multiple')
|
|
56
|
+
|
|
57
|
+
# elm_option1 = root.element('option', id: 'option1')
|
|
58
|
+
# elm_option1['selected'] = true # elm_option1.attr(selected: true)
|
|
59
|
+
# elm_option1['selected'] = nil # elm_option1.remove_attr('selected')
|
|
60
|
+
# puts elm_option1['selected'] # puts elm_option1.attr('selected')
|
|
61
|
+
# puts elm_text1['readonly'] # puts elm_text1.attr('readonly')
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
elm_select2 = root.element('select', id: 'select2')
|
|
@@ -66,19 +66,19 @@ elm_select2['multiple'] = true
|
|
|
66
66
|
elm_option2 = elm_select2.element('option',id: 'option2')
|
|
67
67
|
co_elm = elm_option2.element()
|
|
68
68
|
10.times { |i|
|
|
69
|
-
co_elm['value'] = i #co_elm.attr(value: i)
|
|
70
|
-
#'<' +
|
|
69
|
+
co_elm['value'] = i # co_elm.attr(value: i)
|
|
70
|
+
# '<' +
|
|
71
71
|
if i == 1 then
|
|
72
|
-
co_elm['selected'] = true #co_elm.attr(selected: 'true')
|
|
72
|
+
co_elm['selected'] = true # co_elm.attr(selected: 'true')
|
|
73
73
|
else
|
|
74
|
-
co_elm['selected'] = false #co_elm.attr(selected: 'false')
|
|
74
|
+
co_elm['selected'] = false # co_elm.attr(selected: 'false')
|
|
75
75
|
end
|
|
76
|
-
co_elm.content = i #co_elm.content(i)
|
|
77
|
-
co_elm['id'] = nil #co_elm.remove_attr('id')
|
|
76
|
+
co_elm.content = i # co_elm.content(i)
|
|
77
|
+
co_elm['id'] = nil # co_elm.remove_attr('id')
|
|
78
78
|
co_elm.flash
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
elm_tr1 = root.element('tr',id: 'loop') #elm_tr1 = root.css('tr[id=loop]')
|
|
81
|
+
elm_tr1 = root.element('tr',id: 'loop') # elm_tr1 = root.css('tr[id=loop]')
|
|
82
82
|
elm_ = root.element(elm_tr1)
|
|
83
83
|
elm_dt1_ = elm_.element(id: 'aa')
|
|
84
84
|
elm_dt2_ = elm_.element(id: 'bb')
|
|
@@ -91,12 +91,12 @@ elm_dt3_ = elm_.element(id: 'cc')
|
|
|
91
91
|
elm_dt1.content = i
|
|
92
92
|
elm_dt2.content = i
|
|
93
93
|
elm_dt3.content = i
|
|
94
|
-
#"< \n" +
|
|
94
|
+
# "< \n" +
|
|
95
95
|
elm_.flash
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
elms = root.elements(id: 'sample')
|
|
99
|
-
#elms = root.css('div') #elms = root.css('div[class=test]')
|
|
99
|
+
# elms = root.css('div') # elms = root.css('div[class=test]')
|
|
100
100
|
|
|
101
101
|
elms.each_with_index{ |elm_,i|
|
|
102
102
|
elm_['style'] = i.to_s
|
|
@@ -108,4 +108,7 @@ end_time = Time.new.to_f
|
|
|
108
108
|
|
|
109
109
|
puts root.document
|
|
110
110
|
|
|
111
|
+
puts "charset:#{root.charset}"
|
|
112
|
+
puts "content-type:#{root.content_type}"
|
|
113
|
+
|
|
111
114
|
puts '' + (end_time - start_time).to_s + ' sec'
|
data/demo/ml/sample_html.html
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
1
2
|
<html lang="ja">
|
|
2
3
|
<head>
|
|
3
4
|
<title>HTMLテスト</title>
|
|
4
|
-
<meta
|
|
5
|
+
<meta charset="UTF-8"/>
|
|
5
6
|
</head>
|
|
6
7
|
|
|
7
8
|
<body>
|
|
@@ -11,13 +12,13 @@
|
|
|
11
12
|
<form>
|
|
12
13
|
<input id="text1" name="text1" type="text">
|
|
13
14
|
|
|
14
|
-
<input id="radio1" type="radio">
|
|
15
|
+
<input id="radio1" name="radio1" type="radio">
|
|
15
16
|
|
|
16
|
-
<select name="select1">
|
|
17
|
+
<select id="select1" name="select1">
|
|
17
18
|
<option id="option1">オプション</option>
|
|
18
19
|
</select>
|
|
19
20
|
|
|
20
|
-
<select id="select2">
|
|
21
|
+
<select id="select2" name="select2">
|
|
21
22
|
<option id="option2">オプション</option>
|
|
22
23
|
</select>
|
|
23
24
|
</form>
|
data/demo/ml/sample_html4.html
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
<div id="hello2">Hello,World</div>
|
|
10
10
|
<!-- @quark id="hello3" -->Hello,World<!-- /@quark -->
|
|
11
11
|
<form>
|
|
12
|
-
<input id="text1" type="text" >
|
|
12
|
+
<input id="text1" name="text1" type="text" >
|
|
13
13
|
|
|
14
|
-
<input id="radio1" type="radio" class="test">
|
|
14
|
+
<input id="radio1" name="radio1" type="radio" class="test">
|
|
15
15
|
|
|
16
|
-
<select id="select1">
|
|
16
|
+
<select id="select1" name="select1">
|
|
17
17
|
<option id="option1">オプション</option>
|
|
18
18
|
</select>
|
|
19
19
|
|
|
20
|
-
<select id="select2">
|
|
20
|
+
<select id="select2" name="select2">
|
|
21
21
|
<option id="option2">オプション</option>
|
|
22
22
|
</select>
|
|
23
23
|
</form>
|
data/demo/ml/sample_xhtml.html
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
1
2
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
3
|
<html lang="ja">
|
|
3
4
|
<head>
|
|
4
5
|
<title>HTMLテスト</title>
|
|
5
|
-
<meta
|
|
6
|
+
<meta charset="UTF-8"/>
|
|
6
7
|
</head>
|
|
7
8
|
|
|
8
9
|
<body>
|
|
@@ -10,15 +11,15 @@
|
|
|
10
11
|
<div id="hello2">Hello,World</div>
|
|
11
12
|
<!-- @quark id="hello3" -->Hello,World<!-- /@quark -->
|
|
12
13
|
<form>
|
|
13
|
-
<input id="text1" type="text" />
|
|
14
|
+
<input id="text1" name="text1" type="text" />
|
|
14
15
|
|
|
15
|
-
<input id="radio1" type="radio" />
|
|
16
|
+
<input id="radio1" name="radio1" type="radio" />
|
|
16
17
|
|
|
17
|
-
<select>
|
|
18
|
+
<select id="select1" name="select1">
|
|
18
19
|
<option id="option1">オプション</option>
|
|
19
20
|
</select>
|
|
20
21
|
|
|
21
|
-
<select id="select2">
|
|
22
|
+
<select id="select2" name="select2">
|
|
22
23
|
<option id="option2">オプション</option>
|
|
23
24
|
</select>
|
|
24
25
|
</form>
|
data/demo/ml/sample_xhtml4.html
CHANGED
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
<div id="hello2">Hello,World</div>
|
|
11
11
|
<!-- @quark id="hello3" -->Hello,World<!-- /@quark -->
|
|
12
12
|
<form>
|
|
13
|
-
<input id="text1" type="text" />
|
|
13
|
+
<input id="text1" name="text1" type="text" />
|
|
14
14
|
|
|
15
|
-
<input id="radio1" type="radio" />
|
|
15
|
+
<input id="radio1" name="radio1" type="radio" />
|
|
16
16
|
|
|
17
17
|
<select>
|
|
18
18
|
<option id="option1">オプション</option>
|
|
19
19
|
</select>
|
|
20
20
|
|
|
21
|
-
<select id="select2">
|
|
21
|
+
<select id="select2" name="select2">
|
|
22
22
|
<option id="option2">オプション</option>
|
|
23
23
|
</select>
|
|
24
24
|
</form>
|
data/demo/xhtml.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -* coding: UTF-8 -*-
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
|
-
#require 'rubygems'
|
|
5
|
+
# require 'rubygems'
|
|
6
6
|
require 'meteor'
|
|
7
7
|
|
|
8
8
|
Meteor::ElementFactory.link(:xhtml,'ml/sample_xhtml.html', 'UTF-8')
|
|
@@ -11,40 +11,40 @@ root = Meteor::ElementFactory.element('/ml/sample_xhtml')
|
|
|
11
11
|
startTime = Time.new.to_f
|
|
12
12
|
|
|
13
13
|
elm_hello = root.element(id: 'hello')
|
|
14
|
-
elm_hello['class'] = 'red' #elm_hello.attr(class: "red")
|
|
15
|
-
#elm_hello['class'] = nil #elm_hello.remove_attr('class')
|
|
16
|
-
#elm_hello.attr(class: nil)
|
|
14
|
+
elm_hello['class'] = 'red' # elm_hello.attr(class: "red")
|
|
15
|
+
# elm_hello['class'] = nil # elm_hello.remove_attr('class')
|
|
16
|
+
# elm_hello.attr(class: nil)
|
|
17
17
|
|
|
18
18
|
elm_hello2 = root.element(id: 'hello2')
|
|
19
|
-
elm_hello2.content = "Hello,Tester" #elm_hello2.content("Hello,Tester")
|
|
20
|
-
#elm_hello2.remove
|
|
19
|
+
elm_hello2.content = "Hello,Tester" # elm_hello2.content("Hello,Tester")
|
|
20
|
+
# elm_hello2.remove
|
|
21
21
|
|
|
22
|
-
#elm_hello3 = root.cxtag("hello3")
|
|
23
|
-
#elm_hello3.content = "Hello,Hello\ntt" #elm_hello3.content("Hello,Hello\ntt")
|
|
24
|
-
#puts elm_hello3.content
|
|
25
|
-
#puts elm_hello3.mixed_content
|
|
22
|
+
# elm_hello3 = root.cxtag("hello3")
|
|
23
|
+
# elm_hello3.content = "Hello,Hello\ntt" # elm_hello3.content("Hello,Hello\ntt")
|
|
24
|
+
# puts elm_hello3.content
|
|
25
|
+
# puts elm_hello3.mixed_content
|
|
26
26
|
|
|
27
27
|
elm_text1 = root.element(id: 'text1')
|
|
28
|
-
elm_text1['value'] = 'めも' #elm_text1.attr(value: 'めも')
|
|
29
|
-
elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
|
|
30
|
-
elm_text1['required'] = true #elm_text1.attr(required: true)
|
|
31
|
-
#map = elm_text1.attr_map
|
|
32
|
-
#map.names.each { |item|
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#}
|
|
36
|
-
|
|
37
|
-
#elm_radio1 = root.element("input",id: "radio1", type: "radio")
|
|
38
|
-
#elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
|
|
39
|
-
|
|
40
|
-
#elm_select1 = root.element("select",id: "select1")
|
|
41
|
-
#elm_select1 = root.element("select")
|
|
42
|
-
#elm_select1['multiple'] = true #elm_select1.attr(multiple: true)
|
|
43
|
-
#puts elm_select1['multiple'] #puts elm_select1.attr("multiple")
|
|
44
|
-
#elm_option1 = root.element("option",id: "option1")
|
|
45
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
|
46
|
-
#puts elm_option1['selected'] #puts elm_option1.attr("selected")
|
|
47
|
-
#puts elm_text1['readonly'] #puts elm_text1.attr("readonly")
|
|
28
|
+
elm_text1['value'] = 'めも' # elm_text1.attr(value: 'めも')
|
|
29
|
+
elm_text1['disabled'] = true # elm_text1.attr(disabled: true)
|
|
30
|
+
elm_text1['required'] = true # elm_text1.attr(required: true)
|
|
31
|
+
# map = elm_text1.attr_map
|
|
32
|
+
# map.names.each { |item|
|
|
33
|
+
# puts item
|
|
34
|
+
# puts map.fetch(item)
|
|
35
|
+
# }
|
|
36
|
+
|
|
37
|
+
# elm_radio1 = root.element("input",id: "radio1", type: "radio")
|
|
38
|
+
# elm_radio1['checked'] = true # elm_radio1.attr(checked: true)
|
|
39
|
+
|
|
40
|
+
# elm_select1 = root.element("select",id: "select1")
|
|
41
|
+
# elm_select1 = root.element("select")
|
|
42
|
+
# elm_select1['multiple'] = true # elm_select1.attr(multiple: true)
|
|
43
|
+
# puts elm_select1['multiple'] # puts elm_select1.attr("multiple")
|
|
44
|
+
# elm_option1 = root.element("option",id: "option1")
|
|
45
|
+
# elm_option1['selected'] = true # elm_option1.attr(selected: true)
|
|
46
|
+
# puts elm_option1['selected'] # puts elm_option1.attr("selected")
|
|
47
|
+
# puts elm_text1['readonly'] # puts elm_text1.attr("readonly")
|
|
48
48
|
|
|
49
49
|
elm_select2 = root.element("select",id: "select2")
|
|
50
50
|
elm_select2["multiple"] = true
|
|
@@ -52,13 +52,13 @@ elm_option2 = elm_select2.element("option",id: "option2")
|
|
|
52
52
|
co_elm = elm_option2.element()
|
|
53
53
|
10.times { |i|
|
|
54
54
|
if i == 1 then
|
|
55
|
-
co_elm['selected'] = true #co_elm.attr(selected: true)
|
|
55
|
+
co_elm['selected'] = true # co_elm.attr(selected: true)
|
|
56
56
|
else
|
|
57
|
-
co_elm['selected'] = false #co_elm.attr(selected: false)
|
|
57
|
+
co_elm['selected'] = false # co_elm.attr(selected: false)
|
|
58
58
|
end
|
|
59
|
-
co_elm['value'] = i #co_elm.attr(value: i)
|
|
60
|
-
co_elm['id'] = nil #co_elm.remove_attr("id")
|
|
61
|
-
co_elm.content = i #co_elm.content(i)
|
|
59
|
+
co_elm['value'] = i # co_elm.attr(value: i)
|
|
60
|
+
co_elm['id'] = nil # co_elm.remove_attr("id")
|
|
61
|
+
co_elm.content = i # co_elm.content(i)
|
|
62
62
|
co_elm.flash
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -72,7 +72,7 @@ elm_dt3_ = elm_.element(id: 'cc')
|
|
|
72
72
|
elm_dt1 = elm_dt1_.clone
|
|
73
73
|
elm_dt2 = elm_dt2_.clone
|
|
74
74
|
elm_dt3 = elm_dt3_.clone
|
|
75
|
-
elm_dt1.content = i #elm_dt1.content("<>\"' \n" << i.to_s)
|
|
75
|
+
elm_dt1.content = i # elm_dt1.content("<>\"' \n" << i.to_s)
|
|
76
76
|
elm_dt2.content = i
|
|
77
77
|
elm_dt3.content = i
|
|
78
78
|
elm_.flash
|
|
@@ -84,4 +84,7 @@ endTime = Time.new.to_f
|
|
|
84
84
|
|
|
85
85
|
puts root.document
|
|
86
86
|
|
|
87
|
+
puts "charset:#{root.charset}"
|
|
88
|
+
puts "content-type:#{root.content_type}"
|
|
89
|
+
|
|
87
90
|
puts '' + (endTime - startTime).to_s + ' sec'
|