meteor 0.9.8 → 0.9.8.1
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 +4 -1
- data/README.md +25 -5
- data/demo/demo_html.rb +8 -7
- data/demo/demo_html5.rb +3 -3
- data/demo/demo_xhtml.rb +3 -3
- data/demo/demo_xhtml5.rb +3 -3
- data/lib/meteor.rb +414 -405
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e08d7846e20f1e7fcb1aa755175cafcbb3a451f6
|
4
|
+
data.tar.gz: 2130feb4f92b95ef53cfd2e9cbb03f7aee73a408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf2618e5090b829294e39707bd9c237ed0bf913f41c9d46e330b7c42c0b0e8fac5a4040b04051672486a7796b7e230b58824bd56f7e478c4683c2e5475783e3c
|
7
|
+
data.tar.gz: 60d6f332459a50e624e21f70425b1e1f108366c091a1212ba9398a51bfeff5f337c99c1a79e83b4ff191c6cdf1b0b60471643e666619e5c3c11baf62b743622a
|
data/ChangeLog
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
== 0.9.8 / 2014-01-07 Yasumasa Ashida <ys.ashida@gmail.com>
|
2
2
|
|
3
|
-
|
3
|
+
* multi elements search support (addition of Meteor::Element#elements)
|
4
|
+
* purge of Ruby1.8 support codes
|
5
|
+
* change of Meteor::Element#find
|
6
|
+
* purge of Meteor::Hook module
|
4
7
|
|
5
8
|
== 0.9.0.1 / 2008-10-03 Yasumasa Ashida <ys.ashida@gmail.com>
|
6
9
|
|
data/README.md
CHANGED
@@ -12,26 +12,46 @@ Meteor
|
|
12
12
|
gem install meteor-*.gem
|
13
13
|
```
|
14
14
|
|
15
|
-
##Explanation
|
16
|
-
|
15
|
+
## Explanation
|
16
|
+
This libarary is lightweight (X)HTML(5) parser.
|
17
|
+
This can use as XML parser.
|
18
|
+
This may be false parser.
|
19
|
+
|
20
|
+
This libarary doesn't support all of XML spec.
|
21
|
+
This supports a range of xml spec
|
22
|
+
thought to be the need routinely.
|
17
23
|
|
18
24
|
軽量(簡易?)(X)HTML(5)パーサです。
|
19
25
|
XMLパーサとしても使用可能です。
|
20
26
|
パーサもどきかもしれません。
|
27
|
+
|
21
28
|
(X)HTML(5)、XMLの仕様の全てをサポートしてはいません、
|
22
29
|
日常的に必要と思われる範囲をサポートしています。
|
23
30
|
|
31
|
+
This doesn't convert the whole into objects but
|
32
|
+
converts only elements for the operation into objects.
|
33
|
+
(This library uses regular expression internally but user
|
34
|
+
don't need to concern yourself with internal logic.)
|
35
|
+
|
24
36
|
DOMのように全体をオブジェクトのツリー構造に変換するのではなく、
|
25
|
-
|
37
|
+
操作対象の要素のみをオブジェクトに変換します。
|
26
38
|
(内部では正規表現を使っていますが、ユーザがそれを意識する
|
27
39
|
必要は全くありません。)
|
28
40
|
|
41
|
+
## API
|
42
|
+
http://rubydoc.info/github/asip/meteor/master/frames
|
43
|
+
|
44
|
+
## Gem
|
45
|
+
https://rubygems.org/gems/meteor
|
46
|
+
|
47
|
+
## Examples
|
48
|
+
https://github.com/asip/meteor/tree/master/demo
|
29
49
|
|
30
50
|
## License
|
31
51
|
Licensed under the LGPL V2.1.
|
32
52
|
|
33
|
-
##Author
|
53
|
+
## Author
|
34
54
|
Yasumasa Ashida (ys.ashida@gmail.com)
|
35
55
|
|
36
|
-
##Copyright
|
56
|
+
## Copyright
|
37
57
|
(c) 2008-2014 Yasumasa Ashida
|
data/demo/demo_html.rb
CHANGED
@@ -5,12 +5,12 @@ require 'rubygems'
|
|
5
5
|
require 'meteor'
|
6
6
|
|
7
7
|
#pf = Meteor::ParserFactory.new
|
8
|
-
#pf.bind(
|
8
|
+
#pf.bind(:html,'sample.html', 'UTF-8')
|
9
9
|
|
10
10
|
#root = pf.element('sample')
|
11
11
|
|
12
|
-
Meteor::ElementFactory.options= {:type =>
|
13
|
-
#Meteor::ElementFactory.bind(
|
12
|
+
Meteor::ElementFactory.options= {:type => :html}
|
13
|
+
#Meteor::ElementFactory.bind(:html,'sample.html', 'UTF-8')
|
14
14
|
Meteor::ElementFactory.bind('sample.html')
|
15
15
|
|
16
16
|
root = Meteor::ElementFactory.element('sample')
|
@@ -43,7 +43,7 @@ elm_text1 = root.element('input','id'=>'text1')
|
|
43
43
|
#elm_text1.attr = {'value' => 'メモ'}
|
44
44
|
#elm_text1.attr('disabled'=>true)
|
45
45
|
#elm_text1['disabled'] = true
|
46
|
-
elm_text1.attrs = {
|
46
|
+
elm_text1.attrs = {value: 'メモ','disabled' => true, 'readonly' => true}
|
47
47
|
#puts elm_text1.attrs
|
48
48
|
#elm_text1.remove_attr('disabled')
|
49
49
|
#map = elm_text1.attr_map
|
@@ -79,6 +79,7 @@ elm_text1.attrs = {'value' => 'メモ','disabled' => true, 'readonly' => true}
|
|
79
79
|
##puts elm_option1.attr('selected')
|
80
80
|
#puts elm_option1['selected']
|
81
81
|
#puts elm_text1.attr('readonly')
|
82
|
+
#puts elm_text1['readonly']
|
82
83
|
|
83
84
|
#elm_select2 = ps.element('select','id'=>'select2')
|
84
85
|
#elm_select2['multiple'] = 'true'
|
@@ -97,10 +98,10 @@ elm_text1.attrs = {'value' => 'メモ','disabled' => true, 'readonly' => true}
|
|
97
98
|
# co_ps.flush
|
98
99
|
#}
|
99
100
|
|
100
|
-
elm_tr1 = root.element('tr',
|
101
|
+
elm_tr1 = root.element('tr',id: 'loop')
|
101
102
|
#elm_tr1 = ps.find('tr[id=loop]')
|
102
103
|
elm_ = root.element(elm_tr1)
|
103
|
-
elm_dt1_ = elm_.element(
|
104
|
+
elm_dt1_ = elm_.element(id: 'aa')
|
104
105
|
elm_dt2_ = elm_.element('id'=>'bb')
|
105
106
|
elm_dt3_ = elm_.element('id'=>'cc')
|
106
107
|
10.times do |i|
|
@@ -130,4 +131,4 @@ end_time = Time.new.to_f
|
|
130
131
|
|
131
132
|
puts root.document
|
132
133
|
|
133
|
-
puts '' + (end_time - start_time).to_s + ' sec'
|
134
|
+
puts '' + (end_time - start_time).to_s + ' sec'
|
data/demo/demo_html5.rb
CHANGED
@@ -5,11 +5,11 @@ require 'rubygems'
|
|
5
5
|
require 'meteor'
|
6
6
|
|
7
7
|
#pf = Meteor::ParserFactory.new
|
8
|
-
#pf.bind(
|
8
|
+
#pf.bind(:html5,'sample_5.html', 'UTF-8')
|
9
9
|
|
10
10
|
#root = pf.element('sample_5')
|
11
11
|
|
12
|
-
Meteor::ElementFactory.bind(
|
12
|
+
Meteor::ElementFactory.bind(:html5,"sample_5.html", 'UTF-8')
|
13
13
|
root = Meteor::ElementFactory.element('sample_5')
|
14
14
|
|
15
15
|
start_time = Time.new.to_f
|
@@ -99,4 +99,4 @@ end_time = Time.new.to_f
|
|
99
99
|
|
100
100
|
puts root.document
|
101
101
|
|
102
|
-
puts '' + (end_time - start_time).to_s + ' sec'
|
102
|
+
puts '' + (end_time - start_time).to_s + ' sec'
|
data/demo/demo_xhtml.rb
CHANGED
@@ -5,11 +5,11 @@ require 'rubygems'
|
|
5
5
|
require 'meteor'
|
6
6
|
|
7
7
|
#pf = Meteor::ParserFactory.new
|
8
|
-
#pf.bind(
|
8
|
+
#pf.bind(:html,"sample_x.html", "UTF-8")
|
9
9
|
|
10
10
|
#root = pf.element('sample_x')
|
11
11
|
|
12
|
-
Meteor::ElementFactory.bind(
|
12
|
+
Meteor::ElementFactory.bind(:html,'sample_x.html', 'UTF-8')
|
13
13
|
root = Meteor::ElementFactory.element('sample_x')
|
14
14
|
|
15
15
|
startTime = Time.new.to_f
|
@@ -99,4 +99,4 @@ endTime = Time.new.to_f
|
|
99
99
|
|
100
100
|
puts root.document
|
101
101
|
|
102
|
-
puts '' + (endTime - startTime).to_s + ' sec'
|
102
|
+
puts '' + (endTime - startTime).to_s + ' sec'
|
data/demo/demo_xhtml5.rb
CHANGED
@@ -5,11 +5,11 @@ require 'rubygems'
|
|
5
5
|
require 'meteor'
|
6
6
|
|
7
7
|
#pf = Meteor::ParserFactory.new
|
8
|
-
#pf.bind(
|
8
|
+
#pf.bind(:xhtml5,"sample_x5.html", "UTF-8")
|
9
9
|
|
10
10
|
#root = pf.element('sample_x5')
|
11
11
|
|
12
|
-
Meteor::ElementFactory.bind(
|
12
|
+
Meteor::ElementFactory.bind(:xhtml5,'sample_x5.html', 'UTF-8')
|
13
13
|
root = Meteor::ElementFactory.element('sample_x5')
|
14
14
|
|
15
15
|
startTime = Time.new.to_f
|
@@ -104,4 +104,4 @@ endTime = Time.new.to_f
|
|
104
104
|
|
105
105
|
puts root.document
|
106
106
|
|
107
|
-
puts '' + (endTime - startTime).to_s + ' sec'
|
107
|
+
puts '' + (endTime - startTime).to_s + ' sec'
|
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.1
|
22
22
|
#
|
23
23
|
|
24
24
|
module Meteor
|
25
25
|
|
26
|
-
VERSION = '0.9.8'
|
26
|
+
VERSION = '0.9.8.1'.freeze
|
27
27
|
|
28
28
|
#require 'fileutils'
|
29
29
|
|
@@ -51,6 +51,8 @@ module Meteor
|
|
51
51
|
# @return [String] attributes (属性群)
|
52
52
|
# @!attribute [rw] mixed_content
|
53
53
|
# @return [String] content (内容)
|
54
|
+
# @!attribute [rw] raw_content
|
55
|
+
# @return [false,true] entity ref flag of content (内容のエンティティ参照フラグ)
|
54
56
|
# @!attribute [rw] pattern
|
55
57
|
# @return [String] pattern (パターン)
|
56
58
|
# @!attribute [rw] document_sync
|
@@ -79,6 +81,7 @@ module Meteor
|
|
79
81
|
attr_accessor :tag
|
80
82
|
attr_accessor :attributes
|
81
83
|
attr_accessor :mixed_content
|
84
|
+
attr_accessor :raw_content
|
82
85
|
attr_accessor :pattern
|
83
86
|
attr_accessor :document_sync
|
84
87
|
attr_accessor :empty
|
@@ -479,10 +482,12 @@ module Meteor
|
|
479
482
|
# @param [String] content content of element (要素の内容)
|
480
483
|
# @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
|
481
484
|
# @return [Meteor::Element] element (要素)
|
485
|
+
# @deprecated
|
482
486
|
# @overload content(content)
|
483
487
|
# set content of element (要素の内容をセットする)
|
484
488
|
# @param [String] content content of element (要素の内容)
|
485
489
|
# @return [Meteor::Element] element (要素)
|
490
|
+
# @deprecated
|
486
491
|
# @overload content()
|
487
492
|
# get content of element (要素の内容を取得する)
|
488
493
|
# @return [String] content (内容)
|
@@ -706,7 +711,7 @@ module Meteor
|
|
706
711
|
|
707
712
|
#
|
708
713
|
# set a couple of attribute name and attribute value (属性名と属性値を対としてセットする)
|
709
|
-
#
|
714
|
+
#
|
710
715
|
# @param [String] name attribute name (属性名)
|
711
716
|
# @param [String] value attribute value (属性値)
|
712
717
|
#
|
@@ -716,7 +721,7 @@ module Meteor
|
|
716
721
|
|
717
722
|
#
|
718
723
|
# get attribute value using attribute name (属性名で属性値を取得する)
|
719
|
-
#
|
724
|
+
#
|
720
725
|
# @param [String] name attribute name (属性名)
|
721
726
|
# @return [String] attribute value (属性値)
|
722
727
|
#
|
@@ -771,7 +776,7 @@ module Meteor
|
|
771
776
|
# Parser Factory Class (パーサファクトリクラス)
|
772
777
|
#
|
773
778
|
# @!attribute [rw] type
|
774
|
-
# @return [FixNum] default type of parser (デフォルトのパーサ・タイプ)
|
779
|
+
# @return [FixNum,Symbol] default type of parser (デフォルトのパーサ・タイプ)
|
775
780
|
# @!attribute [rw] root
|
776
781
|
# @return [String] root root directory (基準ディレクトリ)
|
777
782
|
# @!attribute [rw] enc
|
@@ -809,7 +814,7 @@ module Meteor
|
|
809
814
|
# @param [String] root root directory (基準ディレクトリ)
|
810
815
|
# @param [String] enc default character encoding (デフォルトエンコーディング)
|
811
816
|
# @overload initialize(type, root, enc)
|
812
|
-
# @param [FixNum] type default type of parser (デフォルトのパーサ・タイプ)
|
817
|
+
# @param [FixNum,Symbol] type default type of parser (デフォルトのパーサ・タイプ)
|
813
818
|
# @param [String] root root directory (基準ディレクトリ)
|
814
819
|
# @param [String] enc default character encoding (デフォルト文字エンコーディング)
|
815
820
|
#
|
@@ -866,7 +871,7 @@ module Meteor
|
|
866
871
|
|
867
872
|
#
|
868
873
|
# イニシャライザ
|
869
|
-
# @param [FixNum] type default type of parser (デフォルトのパーサ・タイプ)
|
874
|
+
# @param [FixNum,Symbol] type default type of parser (デフォルトのパーサ・タイプ)
|
870
875
|
# @param [String] root root directory (基準ディレクトリ)
|
871
876
|
# @param [String] enc default character encoding (デフォルト文字エンコーディング)
|
872
877
|
#
|
@@ -886,8 +891,8 @@ module Meteor
|
|
886
891
|
# @option @deprecated opts [String] :base_dir root directory (基準ディレクトリ)
|
887
892
|
# @option opts [String] :enc default character encoding (デフォルト文字エンコーディング)
|
888
893
|
# @option @deprecated opts [String] :base_enc default character encoding (デフォルト文字エンコーディング)
|
889
|
-
# @option opts [FixNum] :type default type of parser (デフォルトのパーサ・タイプ)
|
890
|
-
# @option @deprecated opts [FixNum] :base_type default type of parser (デフォルトのパーサ・タイプ)
|
894
|
+
# @option opts [FixNum,Symbol] :type default type of parser (デフォルトのパーサ・タイプ)
|
895
|
+
# @option @deprecated opts [FixNum | Symbol] :base_type default type of parser (デフォルトのパーサ・タイプ)
|
891
896
|
#
|
892
897
|
def options=(opts)
|
893
898
|
if opts.kind_of?(Hash)
|
@@ -923,13 +928,13 @@ module Meteor
|
|
923
928
|
# @return [Meteor::Parser] parser (パーサ)
|
924
929
|
#@overload bind(type,relative_path,enc)
|
925
930
|
# generate parser (パーサを作成する)
|
926
|
-
# @param [Fixnum] type type of parser (パーサ・タイプ)
|
931
|
+
# @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
|
927
932
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
928
933
|
# @param [String] enc character encoding (文字エンコーディング)
|
929
934
|
# @return [Meteor::Parser] parser (パーサ)
|
930
935
|
#@overload bind(type,relative_path)
|
931
936
|
# generate parser (パーサを作成する)
|
932
|
-
# @param [Fixnum] type type of parser (パーサ・タイプ)
|
937
|
+
# @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
|
933
938
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
934
939
|
# @return [Meteor::Parser] parser (パーサ)
|
935
940
|
#
|
@@ -938,7 +943,7 @@ module Meteor
|
|
938
943
|
when 1
|
939
944
|
bind_1(args[0])
|
940
945
|
when 2
|
941
|
-
if args[0].kind_of?(Fixnum)
|
946
|
+
if args[0].kind_of?(Fixnum) || args[0].kind_of?(Symbol)
|
942
947
|
bind_2_n(args[0], args[1])
|
943
948
|
elsif args[0].kind_of?(String)
|
944
949
|
bind_2_s(args[0], args[1])
|
@@ -978,7 +983,7 @@ module Meteor
|
|
978
983
|
|
979
984
|
#
|
980
985
|
# generate parser (パーサを作成する)
|
981
|
-
# @param [Fixnum] type type of parser (パーサ・タイプ)
|
986
|
+
# @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
|
982
987
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
983
988
|
# @param [String] enc character encoding (文字エンコーディング)
|
984
989
|
# @return [Meteor::Parser] parser(パーサ)
|
@@ -988,7 +993,7 @@ module Meteor
|
|
988
993
|
relative_url = path_to_url(relative_path)
|
989
994
|
|
990
995
|
case type
|
991
|
-
when Parser::HTML
|
996
|
+
when Parser::HTML, :html
|
992
997
|
html = Meteor::Ml::Html::ParserImpl.new
|
993
998
|
html.read(File.expand_path(relative_path, @root), enc)
|
994
999
|
@cache[relative_url] = html
|
@@ -996,15 +1001,15 @@ module Meteor
|
|
996
1001
|
xhtml = Meteor::Ml::Xhtml::ParserImpl.new
|
997
1002
|
xhtml.read(File.expand_path(relative_path, @root), enc)
|
998
1003
|
@cache[relative_url] = xhtml
|
999
|
-
when Parser::HTML5
|
1004
|
+
when Parser::HTML5, :html5
|
1000
1005
|
html5 = Meteor::Ml::Html5::ParserImpl.new
|
1001
1006
|
html5.read(File.expand_path(relative_path, @root), enc)
|
1002
1007
|
@cache[relative_url] = html5
|
1003
|
-
when Parser::XHTML5
|
1008
|
+
when Parser::XHTML5, :xhtml5
|
1004
1009
|
xhtml5 = Meteor::Ml::Xhtml5::ParserImpl.new
|
1005
1010
|
xhtml5.read(File.expand_path(relative_path, @root), enc)
|
1006
1011
|
@cache[relative_url] = xhtml5
|
1007
|
-
when Parser::XML
|
1012
|
+
when Parser::XML, :xml
|
1008
1013
|
xml = Meteor::Ml::Xml::ParserImpl.new
|
1009
1014
|
xml.read(File.expand_path(relative_path, @root), enc)
|
1010
1015
|
@cache[relative_url] = xml
|
@@ -1015,7 +1020,7 @@ module Meteor
|
|
1015
1020
|
|
1016
1021
|
#
|
1017
1022
|
# generate parser (パーサを作成する)
|
1018
|
-
# @param [Fixnum] type type of parser(パーサ・タイプ)
|
1023
|
+
# @param [Fixnum,Symbol] type type of parser(パーサ・タイプ)
|
1019
1024
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
1020
1025
|
# @return [Meteor::Parser] parser (パーサ)
|
1021
1026
|
#
|
@@ -1024,15 +1029,15 @@ module Meteor
|
|
1024
1029
|
relative_url = path_to_url(relative_path)
|
1025
1030
|
|
1026
1031
|
case type
|
1027
|
-
when Parser::HTML
|
1032
|
+
when Parser::HTML, :html
|
1028
1033
|
ps = Meteor::Ml::Html::ParserImpl.new
|
1029
|
-
when Parser::XHTML
|
1034
|
+
when Parser::XHTML, :xhtml
|
1030
1035
|
ps = Meteor::Ml::Xhtml::ParserImpl.new
|
1031
|
-
when Parser::HTML5
|
1036
|
+
when Parser::HTML5, :html5
|
1032
1037
|
ps = Meteor::Ml::Html5::ParserImpl.new
|
1033
|
-
when Parser::XHTML5
|
1038
|
+
when Parser::XHTML5, :xhtml5
|
1034
1039
|
ps = Meteor::Ml::Xhtml5::ParserImpl.new
|
1035
|
-
when Parser::XML
|
1040
|
+
when Parser::XML, :xml
|
1036
1041
|
ps = Meteor::Ml::Xml::ParserImpl.new
|
1037
1042
|
end
|
1038
1043
|
|
@@ -1054,15 +1059,15 @@ module Meteor
|
|
1054
1059
|
relative_url = path_to_url(relative_path)
|
1055
1060
|
|
1056
1061
|
case @type
|
1057
|
-
when Parser::HTML
|
1062
|
+
when Parser::HTML, :html
|
1058
1063
|
ps = Meteor::Ml::Html::ParserImpl.new
|
1059
|
-
when Parser::XHTML
|
1064
|
+
when Parser::XHTML, :xhtml
|
1060
1065
|
ps = Meteor::Ml::Xhtml::ParserImpl.new
|
1061
|
-
when Parser::HTML5
|
1066
|
+
when Parser::HTML5, :html5
|
1062
1067
|
ps = Meteor::Ml::Html5::ParserImpl.new
|
1063
|
-
when Parser::XHTML5
|
1068
|
+
when Parser::XHTML5, :xhtml5
|
1064
1069
|
ps = Meteor::Ml::Xhtml5::ParserImpl.new
|
1065
|
-
when Parser::XML
|
1070
|
+
when Parser::XML, :xml
|
1066
1071
|
ps = Meteor::Ml::Xml::ParserImpl.new
|
1067
1072
|
end
|
1068
1073
|
|
@@ -1083,15 +1088,15 @@ module Meteor
|
|
1083
1088
|
relative_url = path_to_url(relative_path)
|
1084
1089
|
|
1085
1090
|
case @type
|
1086
|
-
when Parser::HTML
|
1091
|
+
when Parser::HTML, :html
|
1087
1092
|
ps = Meteor::Ml::Html::ParserImpl.new
|
1088
|
-
when Parser::XHTML
|
1093
|
+
when Parser::XHTML, :xhtml
|
1089
1094
|
ps = Meteor::Ml::Xhtml::ParserImpl.new
|
1090
|
-
when Parser::HTML5
|
1095
|
+
when Parser::HTML5, :html5
|
1091
1096
|
ps = Meteor::Ml::Html5::ParserImpl.new
|
1092
|
-
when Parser::XHTML5
|
1097
|
+
when Parser::XHTML5, :xhtml5
|
1093
1098
|
ps = Meteor::Ml::Xhtml5::ParserImpl.new
|
1094
|
-
when Parser::XML
|
1099
|
+
when Parser::XML, :xml
|
1095
1100
|
ps = Meteor::Ml::Xml::ParserImpl.new
|
1096
1101
|
else
|
1097
1102
|
raise ArgumentError
|
@@ -1139,17 +1144,17 @@ module Meteor
|
|
1139
1144
|
#
|
1140
1145
|
def parser_1(key)
|
1141
1146
|
@pif = @cache[key]
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1147
|
+
case @pif.doc_type
|
1148
|
+
when Meteor::Parser::HTML
|
1149
|
+
Meteor::Ml::Html::ParserImpl.new(@pif)
|
1150
|
+
when Meteor::Parser::XHTML
|
1151
|
+
Meteor::Ml::Xhtml::ParserImpl.new(@pif)
|
1152
|
+
when Meteor::Parser::HTML5
|
1153
|
+
Meteor::Ml::Html5::ParserImpl.new(@pif)
|
1154
|
+
when Meteor::Parser::XHTML5
|
1155
|
+
Meteor::Ml::Xhtml5::ParserImpl.new(@pif)
|
1156
|
+
when Meteor::Parser::XML
|
1157
|
+
Meteor::Ml::Xml::ParserImpl.new(@pif)
|
1153
1158
|
end
|
1154
1159
|
end
|
1155
1160
|
|
@@ -1190,22 +1195,22 @@ module Meteor
|
|
1190
1195
|
|
1191
1196
|
#
|
1192
1197
|
# generate parser (パーサを作成する)
|
1193
|
-
# @param [Fixnum] type type of parser (パーサ・タイプ)
|
1198
|
+
# @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
|
1194
1199
|
# @param [String] relative_url relative URL (相対URL)
|
1195
1200
|
# @param [String] doc document (ドキュメント)
|
1196
1201
|
# @return [Meteor::Parser] parser (パーサ)
|
1197
1202
|
#
|
1198
1203
|
def bind_str_3(type, relative_url, doc)
|
1199
1204
|
case type
|
1200
|
-
when Parser::HTML
|
1205
|
+
when Parser::HTML, :html
|
1201
1206
|
ps = Meteor::Ml::Html::ParserImpl.new
|
1202
|
-
when Parser::XHTML
|
1207
|
+
when Parser::XHTML, :xhtml
|
1203
1208
|
ps = Meteor::Ml::Xhtml::ParserImpl.new
|
1204
|
-
when Parser::HTML5
|
1209
|
+
when Parser::HTML5, :html5
|
1205
1210
|
ps = Meteor::Ml::Html5::ParserImpl.new
|
1206
|
-
when Parser::XHTML5
|
1211
|
+
when Parser::XHTML5, :xhtml5
|
1207
1212
|
ps = Meteor::Ml::Xhtml5::ParserImpl.new
|
1208
|
-
when Parser::XML
|
1213
|
+
when Parser::XML, :xml
|
1209
1214
|
ps = Meteor::Ml::Xml::ParserImpl.new
|
1210
1215
|
end
|
1211
1216
|
|
@@ -1224,15 +1229,15 @@ module Meteor
|
|
1224
1229
|
#
|
1225
1230
|
def bind_str_2(relative_url, doc)
|
1226
1231
|
case @type
|
1227
|
-
when Parser::HTML
|
1232
|
+
when Parser::HTML, :html
|
1228
1233
|
ps = Meteor::Ml::Html::ParserImpl.new
|
1229
|
-
when Parser::XHTML
|
1234
|
+
when Parser::XHTML, :xhtml
|
1230
1235
|
ps = Meteor::Ml::Xhtml::ParserImpl.new
|
1231
|
-
when Parser::HTML5
|
1236
|
+
when Parser::HTML5, :html5
|
1232
1237
|
ps = Meteor::Ml::Html5::ParserImpl.new
|
1233
|
-
when Parser::XHTML5
|
1238
|
+
when Parser::XHTML5, :xhtml5
|
1234
1239
|
ps = Meteor::Ml::Xhtml5::ParserImpl.new
|
1235
|
-
when Parser::XML
|
1240
|
+
when Parser::XML, :xml
|
1236
1241
|
ps = Meteor::Ml::Xml::ParserImpl.new
|
1237
1242
|
end
|
1238
1243
|
|
@@ -1429,115 +1434,115 @@ module Meteor
|
|
1429
1434
|
#
|
1430
1435
|
class Kernel < Meteor::Parser
|
1431
1436
|
|
1432
|
-
EMPTY = ''
|
1433
|
-
SPACE = ' '
|
1434
|
-
DOUBLE_QUATATION = '"'
|
1435
|
-
TAG_OPEN = '<'
|
1436
|
-
TAG_OPEN3 = '</'
|
1437
|
-
#TAG_OPEN4 = '<\\\\/'
|
1438
|
-
TAG_CLOSE = '>'
|
1439
|
-
#TAG_CLOSE2 = '\\/>'
|
1440
|
-
TAG_CLOSE3 = '/>'
|
1441
|
-
ATTR_EQ = '="'
|
1437
|
+
EMPTY = ''.freeze
|
1438
|
+
SPACE = ' '.freeze
|
1439
|
+
DOUBLE_QUATATION = '"'.freeze
|
1440
|
+
TAG_OPEN = '<'.freeze
|
1441
|
+
TAG_OPEN3 = '</'.freeze
|
1442
|
+
#TAG_OPEN4 = '<\\\\/'.freeze
|
1443
|
+
TAG_CLOSE = '>'.freeze
|
1444
|
+
#TAG_CLOSE2 = '\\/>'.freeze
|
1445
|
+
TAG_CLOSE3 = '/>'.freeze
|
1446
|
+
ATTR_EQ = '="'.freeze
|
1442
1447
|
#element
|
1443
|
-
TAG_SEARCH_1_1 = '(|\\s[^<>]*)>(((?!('
|
1444
|
-
TAG_SEARCH_1_2 = '[^<>]*>)).)*)<\\/'
|
1445
|
-
TAG_SEARCH_1_3 = '(|\\s[^<>]*)\\/>'
|
1446
|
-
TAG_SEARCH_1_4 = '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
1447
|
-
TAG_SEARCH_1_4_2 = '(|\\s[^<>]*)>'
|
1448
|
-
|
1449
|
-
TAG_SEARCH_NC_1_1 = '(?:|\\s[^<>]*)>((?!('
|
1450
|
-
TAG_SEARCH_NC_1_2 = '[^<>]*>)).)*<\\/'
|
1451
|
-
TAG_SEARCH_NC_1_3 = '(?:|\\s[^<>]*)\\/>'
|
1452
|
-
TAG_SEARCH_NC_1_4 = '(?:\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
1453
|
-
TAG_SEARCH_NC_1_4_2 = '(?:|\\s[^<>]*)>'
|
1454
|
-
|
1455
|
-
TAG_SEARCH_2_1 = '(\\s[^<>]*'
|
1456
|
-
TAG_SEARCH_2_1_2 = '(\\s[^<>]*(?:'
|
1457
|
-
TAG_SEARCH_2_2 = '"[^<>]*)>(((?!('
|
1458
|
-
TAG_SEARCH_2_2_2 = '")[^<>]*)>(((?!('
|
1459
|
-
TAG_SEARCH_2_3 = '"[^<>]*)'
|
1460
|
-
TAG_SEARCH_2_3_2 = '"[^<>]*)\\/>'
|
1461
|
-
TAG_SEARCH_2_3_2_2 = '")[^<>]*)\\/>'
|
1462
|
-
TAG_SEARCH_2_4 = '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
1463
|
-
TAG_SEARCH_2_4_2 = '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
|
1464
|
-
TAG_SEARCH_2_4_2_2 = '")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))'
|
1465
|
-
TAG_SEARCH_2_4_2_3 = '"'
|
1466
|
-
TAG_SEARCH_2_4_3 = '"[^<>]*)>'
|
1467
|
-
TAG_SEARCH_2_4_3_2 = '")[^<>]*)>'
|
1468
|
-
TAG_SEARCH_2_4_4 = '"[^<>]*>'
|
1469
|
-
|
1470
|
-
TAG_SEARCH_2_6 = '"[^<>]*'
|
1471
|
-
TAG_SEARCH_2_7 = '"|'
|
1472
|
-
|
1473
|
-
TAG_SEARCH_NC_2_1 = '\\s[^<>]*'
|
1474
|
-
TAG_SEARCH_NC_2_1_2 = '\\s[^<>]*(?:'
|
1475
|
-
TAG_SEARCH_NC_2_2 = '"[^<>]*>((?!('
|
1476
|
-
TAG_SEARCH_NC_2_2_2 = '")[^<>]*>((?!('
|
1477
|
-
TAG_SEARCH_NC_2_3 = '"[^<>]*)'
|
1478
|
-
TAG_SEARCH_NC_2_3_2 = '"[^<>]*\\/>'
|
1479
|
-
TAG_SEARCH_NC_2_3_2_2 = '")[^<>]*\\/>'
|
1480
|
-
TAG_SEARCH_NC_2_4 = '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
1481
|
-
TAG_SEARCH_NC_2_4_2 = '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
1482
|
-
TAG_SEARCH_NC_2_4_2_2 = '")(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
1483
|
-
TAG_SEARCH_NC_2_4_2_3 = '"'
|
1484
|
-
TAG_SEARCH_NC_2_4_3 = '"[^<>]*>'
|
1485
|
-
TAG_SEARCH_NC_2_4_3_2 = '")[^<>]*>'
|
1486
|
-
TAG_SEARCH_NC_2_4_4 = '"[^<>]*>'
|
1487
|
-
TAG_SEARCH_NC_2_6 = '"[^<>]*'
|
1488
|
-
TAG_SEARCH_NC_2_7 = '"|'
|
1489
|
-
|
1490
|
-
TAG_SEARCH_3_1 = '<([^<>"]*)\\s[^<>]*'
|
1491
|
-
TAG_SEARCH_3_1_2 = '<([^<>"]*)\\s([^<>]*'
|
1492
|
-
TAG_SEARCH_3_1_2_2 = '<([^<>"]*)\\s([^<>]*('
|
1493
|
-
|
1494
|
-
TAG_SEARCH_3_2 = '"[^<>]*\\/>'
|
1495
|
-
TAG_SEARCH_3_2_2 = '"[^<>]*)\\/>'
|
1496
|
-
TAG_SEARCH_3_2_2_2 = '")[^<>]*)\\/>'
|
1497
|
-
|
1498
|
-
TAG_SEARCH_4_1 = '(\\s[^<>\\/]*)>('
|
1499
|
-
TAG_SEARCH_4_2 = '.*?<'
|
1500
|
-
TAG_SEARCH_4_3 = '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
1501
|
-
TAG_SEARCH_4_4 = '<\\/'
|
1502
|
-
TAG_SEARCH_4_5 = '.*?<\/'
|
1503
|
-
TAG_SEARCH_4_6 = '.*?)<\/'
|
1504
|
-
TAG_SEARCH_4_7 = '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
|
1505
|
-
TAG_SEARCH_4_7_2 = '")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
|
1506
|
-
|
1507
|
-
TAG_SEARCH_NC_3_1 = '<[^<>"]*\\s[^<>]*'
|
1508
|
-
TAG_SEARCH_NC_3_1_2 = '<([^<>"]*)\\s(?:[^<>]*'
|
1509
|
-
TAG_SEARCH_NC_3_1_2_2 = '<([^<>"]*)\\s(?:[^<>]*('
|
1510
|
-
TAG_SEARCH_NC_3_2 = '"[^<>]*\\/>'
|
1511
|
-
TAG_SEARCH_NC_3_2_2 = '"[^<>]*)\\/>'
|
1512
|
-
TAG_SEARCH_NC_3_2_2_2 = '")[^<>]*)\\/>'
|
1513
|
-
#TAG_SEARCH_NC_4_1 = "(?:\\s[^<>\\/]*)>("
|
1514
|
-
#TAG_SEARCH_NC_4_2 = ".*?<"
|
1515
|
-
#TAG_SEARCH_NC_4_3 = "(?:\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
|
1516
|
-
#TAG_SEARCH_NC_4_4 = "<\\/"
|
1517
|
-
#TAG_SEARCH_NC_4_5 = ".*?<\/"
|
1518
|
-
#TAG_SEARCH_NC_4_6 = ".*?<\/"
|
1519
|
-
#TAG_SEARCH_NC_4_7 = "\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
1520
|
-
#TAG_SEARCH_NC_4_7_2 = "\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
1448
|
+
TAG_SEARCH_1_1 = '(|\\s[^<>]*)>(((?!('.freeze
|
1449
|
+
TAG_SEARCH_1_2 = '[^<>]*>)).)*)<\\/'.freeze
|
1450
|
+
TAG_SEARCH_1_3 = '(|\\s[^<>]*)\\/>'.freeze
|
1451
|
+
TAG_SEARCH_1_4 = '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'.freeze
|
1452
|
+
TAG_SEARCH_1_4_2 = '(|\\s[^<>]*)>'.freeze
|
1453
|
+
|
1454
|
+
TAG_SEARCH_NC_1_1 = '(?:|\\s[^<>]*)>((?!('.freeze
|
1455
|
+
TAG_SEARCH_NC_1_2 = '[^<>]*>)).)*<\\/'.freeze
|
1456
|
+
TAG_SEARCH_NC_1_3 = '(?:|\\s[^<>]*)\\/>'.freeze
|
1457
|
+
TAG_SEARCH_NC_1_4 = '(?:\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'.freeze
|
1458
|
+
TAG_SEARCH_NC_1_4_2 = '(?:|\\s[^<>]*)>'.freeze
|
1459
|
+
|
1460
|
+
TAG_SEARCH_2_1 = '(\\s[^<>]*'.freeze
|
1461
|
+
TAG_SEARCH_2_1_2 = '(\\s[^<>]*(?:'.freeze
|
1462
|
+
TAG_SEARCH_2_2 = '"[^<>]*)>(((?!('.freeze
|
1463
|
+
TAG_SEARCH_2_2_2 = '")[^<>]*)>(((?!('.freeze
|
1464
|
+
TAG_SEARCH_2_3 = '"[^<>]*)'.freeze
|
1465
|
+
TAG_SEARCH_2_3_2 = '"[^<>]*)\\/>'.freeze
|
1466
|
+
TAG_SEARCH_2_3_2_2 = '")[^<>]*)\\/>'.freeze
|
1467
|
+
TAG_SEARCH_2_4 = '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'.freeze
|
1468
|
+
TAG_SEARCH_2_4_2 = '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'.freeze
|
1469
|
+
TAG_SEARCH_2_4_2_2 = '")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))'.freeze
|
1470
|
+
TAG_SEARCH_2_4_2_3 = '"'.freeze
|
1471
|
+
TAG_SEARCH_2_4_3 = '"[^<>]*)>'.freeze
|
1472
|
+
TAG_SEARCH_2_4_3_2 = '")[^<>]*)>'.freeze
|
1473
|
+
TAG_SEARCH_2_4_4 = '"[^<>]*>'.freeze
|
1474
|
+
|
1475
|
+
TAG_SEARCH_2_6 = '"[^<>]*'.freeze
|
1476
|
+
TAG_SEARCH_2_7 = '"|'.freeze
|
1477
|
+
|
1478
|
+
TAG_SEARCH_NC_2_1 = '\\s[^<>]*'.freeze
|
1479
|
+
TAG_SEARCH_NC_2_1_2 = '\\s[^<>]*(?:'.freeze
|
1480
|
+
TAG_SEARCH_NC_2_2 = '"[^<>]*>((?!('.freeze
|
1481
|
+
TAG_SEARCH_NC_2_2_2 = '")[^<>]*>((?!('.freeze
|
1482
|
+
TAG_SEARCH_NC_2_3 = '"[^<>]*)'.freeze
|
1483
|
+
TAG_SEARCH_NC_2_3_2 = '"[^<>]*\\/>'.freeze
|
1484
|
+
TAG_SEARCH_NC_2_3_2_2 = '")[^<>]*\\/>'.freeze
|
1485
|
+
TAG_SEARCH_NC_2_4 = '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'.freeze
|
1486
|
+
TAG_SEARCH_NC_2_4_2 = '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'.freeze
|
1487
|
+
TAG_SEARCH_NC_2_4_2_2 = '")(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'.freeze
|
1488
|
+
TAG_SEARCH_NC_2_4_2_3 = '"'.freeze
|
1489
|
+
TAG_SEARCH_NC_2_4_3 = '"[^<>]*>'.freeze
|
1490
|
+
TAG_SEARCH_NC_2_4_3_2 = '")[^<>]*>'.freeze
|
1491
|
+
TAG_SEARCH_NC_2_4_4 = '"[^<>]*>'.freeze
|
1492
|
+
TAG_SEARCH_NC_2_6 = '"[^<>]*'.freeze
|
1493
|
+
TAG_SEARCH_NC_2_7 = '"|'.freeze
|
1494
|
+
|
1495
|
+
TAG_SEARCH_3_1 = '<([^<>"]*)\\s[^<>]*'.freeze
|
1496
|
+
TAG_SEARCH_3_1_2 = '<([^<>"]*)\\s([^<>]*'.freeze
|
1497
|
+
TAG_SEARCH_3_1_2_2 = '<([^<>"]*)\\s([^<>]*('.freeze
|
1498
|
+
|
1499
|
+
TAG_SEARCH_3_2 = '"[^<>]*\\/>'.freeze
|
1500
|
+
TAG_SEARCH_3_2_2 = '"[^<>]*)\\/>'.freeze
|
1501
|
+
TAG_SEARCH_3_2_2_2 = '")[^<>]*)\\/>'.freeze
|
1502
|
+
|
1503
|
+
TAG_SEARCH_4_1 = '(\\s[^<>\\/]*)>('.freeze
|
1504
|
+
TAG_SEARCH_4_2 = '.*?<'.freeze
|
1505
|
+
TAG_SEARCH_4_3 = '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'.freeze
|
1506
|
+
TAG_SEARCH_4_4 = '<\\/'.freeze
|
1507
|
+
TAG_SEARCH_4_5 = '.*?<\/'.freeze
|
1508
|
+
TAG_SEARCH_4_6 = '.*?)<\/'.freeze
|
1509
|
+
TAG_SEARCH_4_7 = '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('.freeze
|
1510
|
+
TAG_SEARCH_4_7_2 = '")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('.freeze
|
1511
|
+
|
1512
|
+
TAG_SEARCH_NC_3_1 = '<[^<>"]*\\s[^<>]*'.freeze
|
1513
|
+
TAG_SEARCH_NC_3_1_2 = '<([^<>"]*)\\s(?:[^<>]*'.freeze
|
1514
|
+
TAG_SEARCH_NC_3_1_2_2 = '<([^<>"]*)\\s(?:[^<>]*('.freeze
|
1515
|
+
TAG_SEARCH_NC_3_2 = '"[^<>]*\\/>'.freeze
|
1516
|
+
TAG_SEARCH_NC_3_2_2 = '"[^<>]*)\\/>'.freeze
|
1517
|
+
TAG_SEARCH_NC_3_2_2_2 = '")[^<>]*)\\/>'.freeze
|
1518
|
+
#TAG_SEARCH_NC_4_1 = "(?:\\s[^<>\\/]*)>(".freeze
|
1519
|
+
#TAG_SEARCH_NC_4_2 = ".*?<".freeze
|
1520
|
+
#TAG_SEARCH_NC_4_3 = "(?:\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))".freeze
|
1521
|
+
#TAG_SEARCH_NC_4_4 = "<\\/".freeze
|
1522
|
+
#TAG_SEARCH_NC_4_5 = ".*?<\/".freeze
|
1523
|
+
#TAG_SEARCH_NC_4_6 = ".*?<\/".freeze
|
1524
|
+
#TAG_SEARCH_NC_4_7 = "\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(".freeze
|
1525
|
+
#TAG_SEARCH_NC_4_7_2 = "\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(".freeze
|
1521
1526
|
|
1522
1527
|
#find
|
1523
1528
|
# E
|
1524
|
-
PATTERN_FIND_1 = '^([^,\\[\\]#\\.]+)$'
|
1529
|
+
PATTERN_FIND_1 = '^([^,\\[\\]#\\.]+)$'.freeze
|
1525
1530
|
# #id_attribute_value
|
1526
|
-
PATTERN_FIND_2_1 = '^#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
1531
|
+
PATTERN_FIND_2_1 = '^#([^\\.,\\[\\]#][^,\\[\\]#]*)$'.freeze
|
1527
1532
|
# .class_attribute_value
|
1528
|
-
PATTERN_FIND_2_2 = '^\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
1533
|
+
PATTERN_FIND_2_2 = '^\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'.freeze
|
1529
1534
|
# [attribute_name=attribute_value]
|
1530
|
-
PATTERN_FIND_2_3 = '^\\[([^\\[\\],]+)=([^\\[\\],]+)\\]$'
|
1535
|
+
PATTERN_FIND_2_3 = '^\\[([^\\[\\],]+)=([^\\[\\],]+)\\]$'.freeze
|
1531
1536
|
# E[attribute_name=attribute_value]
|
1532
|
-
PATTERN_FIND_3_1 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,\\[\\]]+)=([^,\\[\\]]+)\\]$'
|
1537
|
+
PATTERN_FIND_3_1 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,\\[\\]]+)=([^,\\[\\]]+)\\]$'.freeze
|
1533
1538
|
# E#id_attribute_value
|
1534
|
-
PATTERN_FIND_3_2 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
1539
|
+
PATTERN_FIND_3_2 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)#([^\\.,\\[\\]#][^,\\[\\]#]*)$'.freeze
|
1535
1540
|
# E.class_attribute_value
|
1536
|
-
PATTERN_FIND_3_3 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
1541
|
+
PATTERN_FIND_3_3 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'.freeze
|
1537
1542
|
# [attribute_name1=attribute_value1][attribute_name2=attribute_value2]
|
1538
1543
|
PATTERN_FIND_4 = '^\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
|
1539
1544
|
# E[attribute_name1=attribute_value1][attribute_name2=attribute_value2]
|
1540
|
-
PATTERN_FIND_5 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
|
1545
|
+
PATTERN_FIND_5 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'.freeze
|
1541
1546
|
|
1542
1547
|
@@pattern_find_1 = Regexp.new(PATTERN_FIND_1)
|
1543
1548
|
@@pattern_find_2_1 = Regexp.new(PATTERN_FIND_2_1)
|
@@ -1550,98 +1555,98 @@ module Meteor
|
|
1550
1555
|
@@pattern_find_5 = Regexp.new(PATTERN_FIND_5)
|
1551
1556
|
|
1552
1557
|
#setAttribute
|
1553
|
-
SET_ATTR_1 = '="[^"]*"'
|
1558
|
+
SET_ATTR_1 = '="[^"]*"'.freeze
|
1554
1559
|
#getAttributeValue
|
1555
|
-
GET_ATTR_1 = '="([^"]*)"'
|
1560
|
+
GET_ATTR_1 = '="([^"]*)"'.freeze
|
1556
1561
|
#attributeMap
|
1557
|
-
GET_ATTRS_MAP = '([^\\s]*)="([^\"]*)"'
|
1562
|
+
GET_ATTRS_MAP = '([^\\s]*)="([^\"]*)"'.freeze
|
1558
1563
|
#removeAttribute
|
1559
|
-
ERASE_ATTR_1 = '="[^"]*"\\s?'
|
1564
|
+
ERASE_ATTR_1 = '="[^"]*"\\s?'.freeze
|
1560
1565
|
|
1561
1566
|
#cxtag
|
1562
|
-
#SEARCH_CX_1 = '<!--\\s@'
|
1563
|
-
#SEARCH_CX_2 = '\\s([^<>]*id="'
|
1564
|
-
#SEARCH_CX_3 = '\"[^<>]*)-->(((?!(<!--\\s\\/@'
|
1565
|
-
#SEARCH_CX_4 = ')).)*)<!--\\s\\/@'
|
1566
|
-
#SEARCH_CX_5 = '\\s-->'
|
1567
|
-
#SEARCH_CX_6 = '<!--\\s@([^<>]*)\\s[^<>]*id="'
|
1568
|
-
|
1569
|
-
SEARCH_CX_1 = '<!--\\s@'
|
1567
|
+
#SEARCH_CX_1 = '<!--\\s@'.freeze
|
1568
|
+
#SEARCH_CX_2 = '\\s([^<>]*id="'.freeze
|
1569
|
+
#SEARCH_CX_3 = '\"[^<>]*)-->(((?!(<!--\\s\\/@'.freeze
|
1570
|
+
#SEARCH_CX_4 = ')).)*)<!--\\s\\/@'.freeze
|
1571
|
+
#SEARCH_CX_5 = '\\s-->'.freeze
|
1572
|
+
#SEARCH_CX_6 = '<!--\\s@([^<>]*)\\s[^<>]*id="'.freeze
|
1573
|
+
|
1574
|
+
SEARCH_CX_1 = '<!--\\s@'.freeze
|
1570
1575
|
#SEARCH_CX_1 = "<!--\\s@"
|
1571
|
-
SEARCH_CX_2 = '\\s([^<>]*id="'
|
1572
|
-
#SEARCH_CX_2 = "\\s([^<>]*id=\""
|
1573
|
-
SEARCH_CX_3 = '"[^<>]*)-->(((?!(<!--\\s/@'
|
1574
|
-
#SEARCH_CX_3 = "\"[^<>]*)-->(((?!(<!--\\s/@"
|
1575
|
-
SEARCH_CX_4 = ')).)*)<!--\\s/@'
|
1576
|
-
#SEARCH_CX_4 = ")).)*)<!--\\s/@"
|
1577
|
-
SEARCH_CX_5 = '\\s-->'
|
1578
|
-
#SEARCH_CX_5 = "\\s-->"
|
1579
|
-
SEARCH_CX_6 = '<!--\\s@([^<>]*)\\s[^<>]*id="'
|
1580
|
-
#SEARCH_CX_6 = "<!--\\s@([^<>]*)\\s[^<>]*id=\""
|
1576
|
+
SEARCH_CX_2 = '\\s([^<>]*id="'.freeze
|
1577
|
+
#SEARCH_CX_2 = "\\s([^<>]*id=\"".freeze
|
1578
|
+
SEARCH_CX_3 = '"[^<>]*)-->(((?!(<!--\\s/@'.freeze
|
1579
|
+
#SEARCH_CX_3 = "\"[^<>]*)-->(((?!(<!--\\s/@".freeze
|
1580
|
+
SEARCH_CX_4 = ')).)*)<!--\\s/@'.freeze
|
1581
|
+
#SEARCH_CX_4 = ")).)*)<!--\\s/@".freeze
|
1582
|
+
SEARCH_CX_5 = '\\s-->'.freeze
|
1583
|
+
#SEARCH_CX_5 = "\\s-->".freeze
|
1584
|
+
SEARCH_CX_6 = '<!--\\s@([^<>]*)\\s[^<>]*id="'.freeze
|
1585
|
+
#SEARCH_CX_6 = "<!--\\s@([^<>]*)\\s[^<>]*id=\"".freeze
|
1581
1586
|
|
1582
1587
|
#setElementToCXTag
|
1583
|
-
SET_CX_1 = '<!-- @'
|
1584
|
-
SET_CX_2 = '-->'
|
1585
|
-
SET_CX_3 = '<!-- /@'
|
1586
|
-
SET_CX_4 = ' -->'
|
1588
|
+
SET_CX_1 = '<!-- @'.freeze
|
1589
|
+
SET_CX_2 = '-->'.freeze
|
1590
|
+
SET_CX_3 = '<!-- /@'.freeze
|
1591
|
+
SET_CX_4 = ' -->'.freeze
|
1587
1592
|
|
1588
1593
|
#setMonoInfo
|
1589
|
-
SET_MONO_1 = '\\A[^<>]*\\Z'
|
1594
|
+
SET_MONO_1 = '\\A[^<>]*\\Z'.freeze
|
1590
1595
|
|
1591
1596
|
@@pattern_set_mono1 = Regexp.new(SET_MONO_1)
|
1592
1597
|
|
1593
1598
|
#clean
|
1594
|
-
CLEAN_1 = '<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->'
|
1595
|
-
CLEAN_2 = '<!--\\s\\/@[^<>]*(\\s)*-->'
|
1599
|
+
CLEAN_1 = '<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->'.freeze
|
1600
|
+
CLEAN_2 = '<!--\\s\\/@[^<>]*(\\s)*-->'.freeze
|
1596
1601
|
#escape
|
1597
|
-
AND_1 = '&'
|
1598
|
-
AND_2 = '&'
|
1599
|
-
AND_3 = 'amp'
|
1600
|
-
LT_1 = '<'
|
1601
|
-
LT_2 = '<'
|
1602
|
-
LT_3 = 'lt'
|
1603
|
-
GT_1 = '>'
|
1604
|
-
GT_2 = '>'
|
1605
|
-
GT_3 = 'gt'
|
1606
|
-
QO_2 = '"'
|
1607
|
-
QO_3 = 'quot'
|
1608
|
-
AP_1 = '\''
|
1609
|
-
AP_2 = '''
|
1610
|
-
AP_3 = 'apos'
|
1611
|
-
#EN_1 = "\\\\"
|
1612
|
-
EN_1 = "\\"
|
1613
|
-
#EN_2 = "\\\\\\\\"
|
1614
|
-
#DOL_1 = "\\\$"
|
1615
|
-
#DOL_2 = "\\\\\\$"
|
1616
|
-
#PLUS_1 = "\\\+"
|
1617
|
-
#PLUS_2 = "\\\\\\+"
|
1618
|
-
|
1619
|
-
ESCAPE_ENTITY_REF = ''
|
1620
|
-
|
1621
|
-
#SUB_REGEX1 = (\\\\*)\\\\([0-9]+)'
|
1622
|
-
#SUB_REGEX2 = '\\1\\1\\\\\\\\\\2'
|
1623
|
-
#SUB_REGEX3 = '\\1\\1\\1\\1\\\\\\\\\\\\\\\\\\2'
|
1624
|
-
|
1625
|
-
#BRAC_OPEN_1 = "\\\("
|
1626
|
-
#BRAC_OPEN_2 = "\\\\\\("
|
1627
|
-
#BRAC_CLOSE_1 = "\\\)"
|
1628
|
-
#BRAC_CLOSE_2 = "\\\\\\)"
|
1629
|
-
#SBRAC_OPEN_1 = "\\\["
|
1630
|
-
#SBRAC_OPEN_2 = "\\\\\\["
|
1631
|
-
#SBRAC_CLOSE_1 = "\\\]"
|
1632
|
-
#SBRAC_CLOSE_2 = "\\\\\\]"
|
1633
|
-
#CBRAC_OPEN_1 = "\\\{"
|
1634
|
-
#CBRAC_OPEN_2 = "\\\\\\{"
|
1635
|
-
#CBRAC_CLOSE_1 = "\\\}"
|
1636
|
-
#CBRAC_CLOSE_2 = "\\\\\\}"
|
1637
|
-
#COMMA_1 = "\\\."
|
1638
|
-
#COMMA_2 = "\\\\\\."
|
1639
|
-
#VLINE_1 = "\\\|"
|
1640
|
-
#VLINE_2 = "\\\\\\|"
|
1641
|
-
#QMARK_1 = "\\\?"
|
1642
|
-
#QMARK_2 = "\\\\\\?"
|
1643
|
-
#ASTERISK_1 = "\\\*"
|
1644
|
-
#ASTERISK_2 = "\\\\\\*"
|
1602
|
+
AND_1 = '&'.freeze
|
1603
|
+
AND_2 = '&'.freeze
|
1604
|
+
AND_3 = 'amp'.freeze
|
1605
|
+
LT_1 = '<'.freeze
|
1606
|
+
LT_2 = '<'.freeze
|
1607
|
+
LT_3 = 'lt'.freeze
|
1608
|
+
GT_1 = '>'.freeze
|
1609
|
+
GT_2 = '>'.freeze
|
1610
|
+
GT_3 = 'gt'.freeze
|
1611
|
+
QO_2 = '"'.freeze
|
1612
|
+
QO_3 = 'quot'.freeze
|
1613
|
+
AP_1 = '\''.freeze
|
1614
|
+
AP_2 = '''.freeze
|
1615
|
+
AP_3 = 'apos'.freeze
|
1616
|
+
#EN_1 = "\\\\".freeze
|
1617
|
+
EN_1 = "\\".freeze
|
1618
|
+
#EN_2 = "\\\\\\\\".freeze
|
1619
|
+
#DOL_1 = "\\\$".freeze
|
1620
|
+
#DOL_2 = "\\\\\\$".freeze
|
1621
|
+
#PLUS_1 = "\\\+".freeze
|
1622
|
+
#PLUS_2 = "\\\\\\+".freeze
|
1623
|
+
|
1624
|
+
ESCAPE_ENTITY_REF = ''.freeze
|
1625
|
+
|
1626
|
+
#SUB_REGEX1 = (\\\\*)\\\\([0-9]+)'.freeze
|
1627
|
+
#SUB_REGEX2 = '\\1\\1\\\\\\\\\\2'.freeze
|
1628
|
+
#SUB_REGEX3 = '\\1\\1\\1\\1\\\\\\\\\\\\\\\\\\2'.freeze
|
1629
|
+
|
1630
|
+
#BRAC_OPEN_1 = "\\\(".freeze
|
1631
|
+
#BRAC_OPEN_2 = "\\\\\\(".freeze
|
1632
|
+
#BRAC_CLOSE_1 = "\\\)".freeze
|
1633
|
+
#BRAC_CLOSE_2 = "\\\\\\)".freeze
|
1634
|
+
#SBRAC_OPEN_1 = "\\\[".freeze
|
1635
|
+
#SBRAC_OPEN_2 = "\\\\\\[".freeze
|
1636
|
+
#SBRAC_CLOSE_1 = "\\\]".freeze
|
1637
|
+
#SBRAC_CLOSE_2 = "\\\\\\]".freeze
|
1638
|
+
#CBRAC_OPEN_1 = "\\\{".freeze
|
1639
|
+
#CBRAC_OPEN_2 = "\\\\\\{".freeze
|
1640
|
+
#CBRAC_CLOSE_1 = "\\\}".freeze
|
1641
|
+
#CBRAC_CLOSE_2 = "\\\\\\}".freeze
|
1642
|
+
#COMMA_1 = "\\\.".freeze
|
1643
|
+
#COMMA_2 = "\\\\\\.".freeze
|
1644
|
+
#VLINE_1 = "\\\|".freeze
|
1645
|
+
#VLINE_2 = "\\\\\\|".freeze
|
1646
|
+
#QMARK_1 = "\\\?".freeze
|
1647
|
+
#QMARK_2 = "\\\\\\?".freeze
|
1648
|
+
#ASTERISK_1 = "\\\*".freeze
|
1649
|
+
#ASTERISK_2 = "\\\\\\*".freeze
|
1645
1650
|
|
1646
1651
|
#@@pattern_en = Regexp.new(EN_1)
|
1647
1652
|
#@@pattern_dol = Regexp.new(DOL_1)
|
@@ -1664,12 +1669,12 @@ module Meteor
|
|
1664
1669
|
@@pattern_clean1 = Regexp.new(CLEAN_1)
|
1665
1670
|
@@pattern_clean2 = Regexp.new(CLEAN_2)
|
1666
1671
|
|
1667
|
-
MODE_UTF8 = 'r:UTF-8'
|
1668
|
-
MODE_BF = 'r:'
|
1669
|
-
MODE_AF = ':utf-8'
|
1672
|
+
MODE_UTF8 = 'r:UTF-8'.freeze
|
1673
|
+
MODE_BF = 'r:'.freeze
|
1674
|
+
MODE_AF = ':utf-8'.freeze
|
1670
1675
|
|
1671
|
-
CSS_ID = 'id'
|
1672
|
-
CSS_CLASS = 'class'
|
1676
|
+
CSS_ID = 'id'.freeze
|
1677
|
+
CSS_CLASS = 'class'.freeze
|
1673
1678
|
|
1674
1679
|
attr_accessor :element_cache
|
1675
1680
|
attr_accessor :doc_type
|
@@ -3153,18 +3158,18 @@ module Meteor
|
|
3153
3158
|
# @return [String] attribute value (属性値)
|
3154
3159
|
#
|
3155
3160
|
def attr(elm, attr,*args)
|
3156
|
-
if attr.kind_of?(String)
|
3161
|
+
if attr.kind_of?(String) || attr.kind_of?(Symbol)
|
3157
3162
|
case args.length
|
3158
3163
|
when ZERO
|
3159
|
-
get_attr_value(elm, attr)
|
3164
|
+
get_attr_value(elm, attr.to_s)
|
3160
3165
|
when ONE
|
3161
3166
|
elm.document_sync = true
|
3162
|
-
set_attribute_3(elm, attr,args[0])
|
3167
|
+
set_attribute_3(elm, attr.to_s,args[0])
|
3163
3168
|
end
|
3164
3169
|
|
3165
3170
|
elsif attr.kind_of?(Hash) && attr.size == 1
|
3166
3171
|
elm.document_sync = true
|
3167
|
-
set_attribute_3(elm, attr.keys[0], attr.values[0])
|
3172
|
+
set_attribute_3(elm, attr.keys[0].to_s, attr.values[0])
|
3168
3173
|
#elsif attrs.kind_of?(Hash) && attrs.size >= 1
|
3169
3174
|
# elm.document_sync = true
|
3170
3175
|
# attrs.each{|name,value|
|
@@ -3271,7 +3276,7 @@ module Meteor
|
|
3271
3276
|
if args[0].kind_of?(Hash)
|
3272
3277
|
if args[0].size == 1
|
3273
3278
|
elm.document_sync = true
|
3274
|
-
set_attribute_3(elm, args[0].keys[0], args[0].values[0])
|
3279
|
+
set_attribute_3(elm, args[0].keys[0].to_s, args[0].values[0])
|
3275
3280
|
elsif args[0].size >= 1
|
3276
3281
|
set_attrs(elm, args[0])
|
3277
3282
|
else
|
@@ -3312,7 +3317,7 @@ module Meteor
|
|
3312
3317
|
if !elm.cx
|
3313
3318
|
elm.document_sync = true
|
3314
3319
|
attr_map.each do |name, value|
|
3315
|
-
set_attribute_3(elm, name, value)
|
3320
|
+
set_attribute_3(elm, name.to_s, value)
|
3316
3321
|
end
|
3317
3322
|
end
|
3318
3323
|
elm
|
@@ -3373,9 +3378,9 @@ module Meteor
|
|
3373
3378
|
if !elm.cx
|
3374
3379
|
attr_map.map.each do |name, attr|
|
3375
3380
|
if attr_map.changed(name)
|
3376
|
-
edit_attrs_(elm, name, attr.value)
|
3381
|
+
edit_attrs_(elm, name.to_s, attr.value)
|
3377
3382
|
elsif attr_map.removed(name)
|
3378
|
-
remove_attrs_(elm, name)
|
3383
|
+
remove_attrs_(elm, name.to_s)
|
3379
3384
|
end
|
3380
3385
|
end
|
3381
3386
|
end
|
@@ -3391,6 +3396,7 @@ module Meteor
|
|
3391
3396
|
# @param [String] content content of element (要素の内容)
|
3392
3397
|
# @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
|
3393
3398
|
# @return [Meteor::Element] element (要素)
|
3399
|
+
# @deprecated
|
3394
3400
|
# @overload content(elm,content)
|
3395
3401
|
# set content of element (要素の内容をセットする)
|
3396
3402
|
# @param [Meteor::Element] elm element (要素)
|
@@ -3433,7 +3439,7 @@ module Meteor
|
|
3433
3439
|
#
|
3434
3440
|
def set_content_3(elm, content, entity_ref=true)
|
3435
3441
|
|
3436
|
-
if entity_ref
|
3442
|
+
if entity_ref || !elm.raw_content
|
3437
3443
|
escape_content(content, elm)
|
3438
3444
|
end
|
3439
3445
|
elm.mixed_content = content
|
@@ -3450,7 +3456,10 @@ module Meteor
|
|
3450
3456
|
#
|
3451
3457
|
def set_content_2(elm, content)
|
3452
3458
|
#set_content_3(elm, content)
|
3453
|
-
elm.
|
3459
|
+
unless elm.raw_content
|
3460
|
+
escape_content(content, elm)
|
3461
|
+
end
|
3462
|
+
elm.mixed_content = content
|
3454
3463
|
elm
|
3455
3464
|
end
|
3456
3465
|
|
@@ -3484,7 +3493,7 @@ module Meteor
|
|
3484
3493
|
def remove_attr(elm, attr_name)
|
3485
3494
|
if !elm.cx
|
3486
3495
|
elm.document_sync = true
|
3487
|
-
remove_attrs_(elm, attr_name)
|
3496
|
+
remove_attrs_(elm, attr_name.to_s)
|
3488
3497
|
end
|
3489
3498
|
|
3490
3499
|
elm
|
@@ -3526,12 +3535,12 @@ module Meteor
|
|
3526
3535
|
def cxtag(*args)
|
3527
3536
|
case args.length
|
3528
3537
|
when ONE
|
3529
|
-
cxtag_1(args[0])
|
3538
|
+
cxtag_1(args[0].to_s)
|
3530
3539
|
if @elm_
|
3531
3540
|
@element_cache.store(@elm_.object_id, @elm_)
|
3532
3541
|
end
|
3533
3542
|
when TWO
|
3534
|
-
cxtag_2(args[0], args[1])
|
3543
|
+
cxtag_2(args[0].to_s, args[1].to_s)
|
3535
3544
|
if @elm_
|
3536
3545
|
@element_cache.store(@elm_.object_id, @elm_)
|
3537
3546
|
end
|
@@ -3729,7 +3738,7 @@ module Meteor
|
|
3729
3738
|
|
3730
3739
|
#
|
3731
3740
|
# mirror element (要素を射影する)
|
3732
|
-
#
|
3741
|
+
#
|
3733
3742
|
# @param [Meteor::Element] elm element (要素)
|
3734
3743
|
# @return [Meteor::Element] element (要素)
|
3735
3744
|
#
|
@@ -3952,41 +3961,41 @@ module Meteor
|
|
3952
3961
|
|
3953
3962
|
#KAIGYO_CODE = "\r?\n|\r"
|
3954
3963
|
#KAIGYO_CODE = "\r\n|\n|\r"
|
3955
|
-
KAIGYO_CODE = ["\r\n", "\n", "\r"]
|
3956
|
-
NBSP_2 = ' '
|
3957
|
-
NBSP_3 = 'nbsp'
|
3958
|
-
BR_1 = "\r?\n|\r"
|
3959
|
-
BR_2 = '<br>'
|
3964
|
+
KAIGYO_CODE = ["\r\n".freeze, "\n".freeze, "\r".freeze]
|
3965
|
+
NBSP_2 = ' '.freeze
|
3966
|
+
NBSP_3 = 'nbsp'.freeze
|
3967
|
+
BR_1 = "\r?\n|\r".freeze
|
3968
|
+
BR_2 = '<br>'.freeze
|
3960
3969
|
|
3961
|
-
META = 'META'
|
3962
|
-
META_S = 'meta'
|
3970
|
+
META = 'META'.freeze
|
3971
|
+
META_S = 'meta'.freeze
|
3963
3972
|
|
3964
3973
|
#MATCH_TAG = "br|hr|img|input|meta|base"
|
3965
|
-
@@match_tag = ['br', 'hr', 'img', 'input', 'meta', 'base'] #[Array] 内容のない要素
|
3974
|
+
@@match_tag = ['br'.freeze, 'hr'.freeze, 'img'.freeze, 'input'.freeze, 'meta'.freeze, 'base'.freeze] #[Array] 内容のない要素
|
3966
3975
|
#@@match_tag_2 = "textarea|option|pre"
|
3967
|
-
@@match_tag_2 =['textarea', 'option', 'pre'] #[Array] 改行を<br>に変換する必要のない要素
|
3976
|
+
@@match_tag_2 =['textarea'.freeze, 'option'.freeze, 'pre'.freeze] #[Array] 改行を<br>に変換する必要のない要素
|
3968
3977
|
|
3969
|
-
@@match_tag_sng = ['texarea', 'select', 'option', 'form', 'fieldset'] #[Array] 入れ子にできない要素
|
3978
|
+
@@match_tag_sng = ['texarea'.freeze, 'select'.freeze, 'option'.freeze, 'form'.freeze, 'fieldset'.freeze] #[Array] 入れ子にできない要素
|
3970
3979
|
|
3971
|
-
HTTP_EQUIV = 'http-equiv'
|
3972
|
-
CONTENT_TYPE = 'Content-Type'
|
3973
|
-
CONTENT = 'content'
|
3980
|
+
HTTP_EQUIV = 'http-equiv'.freeze
|
3981
|
+
CONTENT_TYPE = 'Content-Type'.freeze
|
3982
|
+
CONTENT = 'content'.freeze
|
3974
3983
|
|
3975
|
-
@@attr_logic = ['disabled', 'readonly', 'checked', 'selected', 'multiple'] #[Array] 論理値で指定する属性
|
3976
|
-
OPTION = 'option'
|
3977
|
-
SELECTED = 'selected'
|
3978
|
-
INPUT = 'input'
|
3979
|
-
CHECKED = 'checked'
|
3980
|
-
RADIO = 'radio'
|
3984
|
+
@@attr_logic = ['disabled'.freeze, 'readonly'.freeze, 'checked'.freeze, 'selected'.freeze, 'multiple'.freeze] #[Array] 論理値で指定する属性
|
3985
|
+
OPTION = 'option'.freeze
|
3986
|
+
SELECTED = 'selected'.freeze
|
3987
|
+
INPUT = 'input'.freeze
|
3988
|
+
CHECKED = 'checked'.freeze
|
3989
|
+
RADIO = 'radio'.freeze
|
3981
3990
|
#DISABLE_ELEMENT = "input|textarea|select|optgroup"
|
3982
|
-
DISABLE_ELEMENT = ['input', 'textarea', 'select', 'optgroup'] #[Array] disabled属性のある要素
|
3983
|
-
DISABLED = 'disabled'
|
3991
|
+
DISABLE_ELEMENT = ['input'.freeze, 'textarea'.freeze, 'select'.freeze, 'optgroup'.freeze] #[Array] disabled属性のある要素
|
3992
|
+
DISABLED = 'disabled'.freeze
|
3984
3993
|
#READONLY_TYPE = "text|password"
|
3985
|
-
READONLY_TYPE = ['text', 'password'] #[Array] readonly属性のあるinput要素のタイプ
|
3986
|
-
TEXTAREA = 'textarea'
|
3987
|
-
READONLY='readonly'
|
3988
|
-
SELECT = 'select'
|
3989
|
-
MULTIPLE = 'multiple'
|
3994
|
+
READONLY_TYPE = ['text'.freeze, 'password'.freeze] #[Array] readonly属性のあるinput要素のタイプ
|
3995
|
+
TEXTAREA = 'textarea'.freeze
|
3996
|
+
READONLY='readonly'.freeze
|
3997
|
+
SELECT = 'select'.freeze
|
3998
|
+
MULTIPLE = 'multiple'.freeze
|
3990
3999
|
|
3991
4000
|
#@@pattern_option = Regexp.new(OPTION)
|
3992
4001
|
#@@pattern_selected = Regexp.new(SELECTED)
|
@@ -4001,33 +4010,33 @@ module Meteor
|
|
4001
4010
|
#@@pattern_select = Regexp.new(SELECT)
|
4002
4011
|
#@@pattern_multiple = Regexp.new(MULTIPLE)
|
4003
4012
|
|
4004
|
-
SELECTED_M = '\\sselected\\s|\\sselected$|\\sSELECTED\\s|\\sSELECTED$'
|
4013
|
+
SELECTED_M = '\\sselected\\s|\\sselected$|\\sSELECTED\\s|\\sSELECTED$'.freeze
|
4005
4014
|
#SELECTED_M = [' selected ',' selected',' SELECTED ',' SELECTED']
|
4006
|
-
SELECTED_R = 'selected\\s|selected$|SELECTED\\s|SELECTED$'
|
4007
|
-
CHECKED_M = '\\schecked\\s|\\schecked$|\\sCHECKED\\s|\\sCHECKED$'
|
4015
|
+
SELECTED_R = 'selected\\s|selected$|SELECTED\\s|SELECTED$'.freeze
|
4016
|
+
CHECKED_M = '\\schecked\\s|\\schecked$|\\sCHECKED\\s|\\sCHECKED$'.freeze
|
4008
4017
|
#CHECKED_M = [' checked ',' checked',' CHECKED ',' CHECKED']
|
4009
|
-
CHECKED_R = 'checked\\s|checked$|CHECKED\\s|CHECKED$'
|
4010
|
-
DISABLED_M = '\\sdisabled\\s|\\sdisabled$|\\sDISABLED\\s|\\sDISABLED$'
|
4018
|
+
CHECKED_R = 'checked\\s|checked$|CHECKED\\s|CHECKED$'.freeze
|
4019
|
+
DISABLED_M = '\\sdisabled\\s|\\sdisabled$|\\sDISABLED\\s|\\sDISABLED$'.freeze
|
4011
4020
|
#DISABLED_M = [' disabled ',' disiabled',' DISABLED ',' DISABLED']
|
4012
|
-
DISABLED_R = 'disabled\\s|disabled$|DISABLED\\s|DISABLED$'
|
4013
|
-
READONLY_M = '\\sreadonly\\s|\\sreadonly$|\\sREADONLY\\s|\\sREADONLY$'
|
4021
|
+
DISABLED_R = 'disabled\\s|disabled$|DISABLED\\s|DISABLED$'.freeze
|
4022
|
+
READONLY_M = '\\sreadonly\\s|\\sreadonly$|\\sREADONLY\\s|\\sREADONLY$'.freeze
|
4014
4023
|
#READONLY_M = [' readonly ',' readonly',' READONLY ',' READONLY']
|
4015
|
-
READONLY_R = 'readonly\\s|readonly$|READONLY\\s|READONLY$'
|
4016
|
-
MULTIPLE_M = '\\smultiple\\s|\\smultiple$|\\sMULTIPLE\\s|\\sMULTIPLE$'
|
4024
|
+
READONLY_R = 'readonly\\s|readonly$|READONLY\\s|READONLY$'.freeze
|
4025
|
+
MULTIPLE_M = '\\smultiple\\s|\\smultiple$|\\sMULTIPLE\\s|\\sMULTIPLE$'.freeze
|
4017
4026
|
#MULTIPLE_M = [' multiple ',' multiple',' MULTIPLE ',' MULTIPLE']
|
4018
|
-
MULTIPLE_R = 'multiple\\s|multiple$|MULTIPLE\\s|MULTIPLE$'
|
4027
|
+
MULTIPLE_R = 'multiple\\s|multiple$|MULTIPLE\\s|MULTIPLE$'.freeze
|
4019
4028
|
|
4020
|
-
TRUE = 'true'
|
4021
|
-
FALSE = 'false'
|
4029
|
+
TRUE = 'true'.freeze
|
4030
|
+
FALSE = 'false'.freeze
|
4022
4031
|
|
4023
4032
|
#@@pattern_true = Regexp.new(TRUE)
|
4024
4033
|
#@@pattern_false = Regexp.new(FALSE)
|
4025
4034
|
|
4026
|
-
TYPE_L = 'type'
|
4027
|
-
TYPE_U = 'TYPE'
|
4035
|
+
TYPE_L = 'type'.freeze
|
4036
|
+
TYPE_U = 'TYPE'.freeze
|
4028
4037
|
|
4029
|
-
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt|nbsp);'
|
4030
|
-
GET_ATTRS_MAP2='\\s(disabled|readonly|checked|selected|multiple)'
|
4038
|
+
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt|nbsp);'.freeze
|
4039
|
+
GET_ATTRS_MAP2='\\s(disabled|readonly|checked|selected|multiple)'.freeze
|
4031
4040
|
|
4032
4041
|
@@pattern_selected_m = Regexp.new(SELECTED_M)
|
4033
4042
|
@@pattern_selected_r = Regexp.new(SELECTED_R)
|
@@ -4047,28 +4056,28 @@ module Meteor
|
|
4047
4056
|
#@@pattern_@@match_tag2 = Regexp.new(@@match_tag_2)
|
4048
4057
|
|
4049
4058
|
TABLE_FOR_ESCAPE_ = {
|
4050
|
-
'&' => '&',
|
4051
|
-
'"' => '"',
|
4052
|
-
'\'' => ''',
|
4053
|
-
'<' => '<',
|
4054
|
-
'>' => '>',
|
4055
|
-
' ' => ' ',
|
4059
|
+
'&' => '&'.freeze,
|
4060
|
+
'"' => '"'.freeze,
|
4061
|
+
'\'' => '''.freeze,
|
4062
|
+
'<' => '<'.freeze,
|
4063
|
+
'>' => '>'.freeze,
|
4064
|
+
' ' => ' '.freeze,
|
4056
4065
|
}
|
4057
4066
|
|
4058
4067
|
TABLE_FOR_ESCAPE_CONTENT_ = {
|
4059
|
-
'&' => '&',
|
4060
|
-
'"' => '"',
|
4061
|
-
'\'' => ''',
|
4062
|
-
'<' => '<',
|
4063
|
-
'>' => '>',
|
4064
|
-
' ' => ' ',
|
4065
|
-
"\r\n" => '<br>',
|
4066
|
-
"\r" => '<br>',
|
4067
|
-
"\n" => '<br>',
|
4068
|
+
'&' => '&'.freeze,
|
4069
|
+
'"' => '"'.freeze,
|
4070
|
+
'\'' => '''.freeze,
|
4071
|
+
'<' => '<'.freeze,
|
4072
|
+
'>' => '>'.freeze,
|
4073
|
+
' ' => ' '.freeze,
|
4074
|
+
"\r\n" => '<br>'.freeze,
|
4075
|
+
"\r" => '<br>'.freeze,
|
4076
|
+
"\n" => '<br>'.freeze,
|
4068
4077
|
}
|
4069
4078
|
|
4070
|
-
PATTERN_ESCAPE = "[&\"'<> ]"
|
4071
|
-
PATTERN_ESCAPE_CONTENT = "[&\"'<> \\n]"
|
4079
|
+
PATTERN_ESCAPE = "[&\"'<> ]".freeze
|
4080
|
+
PATTERN_ESCAPE_CONTENT = "[&\"'<> \\n]".freeze
|
4072
4081
|
|
4073
4082
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
4074
4083
|
@@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
|
@@ -4652,35 +4661,35 @@ module Meteor
|
|
4652
4661
|
#
|
4653
4662
|
class ParserImpl < Meteor::Core::Kernel
|
4654
4663
|
|
4655
|
-
#KAIGYO_CODE = "\r?\n|\r"
|
4656
|
-
KAIGYO_CODE = ["\r\n", "\n", "\r"]
|
4657
|
-
NBSP_2 = ' '
|
4658
|
-
NBSP_3 = 'nbsp'
|
4659
|
-
BR_1 = "\r?\n|\r"
|
4660
|
-
BR_2 = '<br/>'
|
4661
|
-
BR_3 = '<br\\/>'
|
4664
|
+
#KAIGYO_CODE = "\r?\n|\r".freeze
|
4665
|
+
KAIGYO_CODE = ["\r\n".freeze, "\n".freeze, "\r".freeze]
|
4666
|
+
NBSP_2 = ' '.freeze
|
4667
|
+
NBSP_3 = 'nbsp'.freeze
|
4668
|
+
BR_1 = "\r?\n|\r".freeze
|
4669
|
+
BR_2 = '<br/>'.freeze
|
4670
|
+
BR_3 = '<br\\/>'.freeze
|
4662
4671
|
|
4663
|
-
META = 'META'
|
4664
|
-
META_S = 'meta'
|
4672
|
+
META = 'META'.freeze
|
4673
|
+
META_S = 'meta'.freeze
|
4665
4674
|
|
4666
4675
|
#@@match_tag_2 = "textarea|option|pre"
|
4667
|
-
@@match_tag_2 = ['textarea', 'option', 'pre'] #[Array] 改行を<br/>に変換する必要のない要素
|
4668
|
-
|
4669
|
-
@@attr_logic = ['disabled', 'readonly', 'checked', 'selected', 'multiple'] #[Array] 論理値で指定する属性
|
4670
|
-
OPTION = 'option'
|
4671
|
-
SELECTED = 'selected'
|
4672
|
-
INPUT = 'input'
|
4673
|
-
CHECKED = 'checked'
|
4674
|
-
RADIO = 'radio'
|
4676
|
+
@@match_tag_2 = ['textarea'.freeze, 'option'.freeze, 'pre'.freeze] #[Array] 改行を<br/>に変換する必要のない要素
|
4677
|
+
|
4678
|
+
@@attr_logic = ['disabled'.freeze, 'readonly'.freeze, 'checked'.freeze, 'selected'.freeze, 'multiple'.freeze] #[Array] 論理値で指定する属性
|
4679
|
+
OPTION = 'option'.freeze
|
4680
|
+
SELECTED = 'selected'.freeze
|
4681
|
+
INPUT = 'input'.freeze
|
4682
|
+
CHECKED = 'checked'.freeze
|
4683
|
+
RADIO = 'radio'.freeze
|
4675
4684
|
#DISABLE_ELEMENT = "input|textarea|select|optgroup"
|
4676
|
-
DISABLE_ELEMENT = ['input', 'textarea', 'select', 'optgroup'] #[Array] disabled属性のある要素
|
4677
|
-
DISABLED = 'disabled'
|
4685
|
+
DISABLE_ELEMENT = ['input'.freeze, 'textarea'.freeze, 'select'.freeze, 'optgroup'.freeze] #[Array] disabled属性のある要素
|
4686
|
+
DISABLED = 'disabled'.freeze
|
4678
4687
|
#READONLY_TYPE = "text|password"
|
4679
|
-
READONLY_TYPE = ['text', 'password'] #[Array] readonly属性のあるinput要素のタイプ
|
4680
|
-
TEXTAREA = 'textarea'
|
4681
|
-
READONLY='readonly'
|
4682
|
-
SELECT = 'select'
|
4683
|
-
MULTIPLE = 'multiple'
|
4688
|
+
READONLY_TYPE = ['text'.freeze, 'password'.freeze] #[Array] readonly属性のあるinput要素のタイプ
|
4689
|
+
TEXTAREA = 'textarea'.freeze
|
4690
|
+
READONLY='readonly'.freeze
|
4691
|
+
SELECT = 'select'.freeze
|
4692
|
+
MULTIPLE = 'multiple'.freeze
|
4684
4693
|
|
4685
4694
|
#@@pattern_option = Regexp.new(OPTION)
|
4686
4695
|
#@@pattern_selected = Regexp.new(SELECTED)
|
@@ -4695,38 +4704,38 @@ module Meteor
|
|
4695
4704
|
#@@pattern_select = Regexp.new(SELECT)
|
4696
4705
|
#@@pattern_multiple = Regexp.new(MULTIPLE)
|
4697
4706
|
|
4698
|
-
SELECTED_M = '\\sselected="[^"]*"\\s|\\sselected="[^"]*"$'
|
4699
|
-
SELECTED_M1 = '\\sselected="([^"]*)"\\s|\\sselected="([^"]*)"$'
|
4700
|
-
SELECTED_R = 'selected="[^"]*"'
|
4701
|
-
SELECTED_U = 'selected="selected"'
|
4702
|
-
CHECKED_M = '\\schecked="[^"]*"\\s|\\schecked="[^"]*"$'
|
4703
|
-
CHECKED_M1 = '\\schecked="([^"]*)"\\s|\\schecked="([^"]*)"$'
|
4704
|
-
CHECKED_R = 'checked="[^"]*"'
|
4705
|
-
CHECKED_U = 'checked="checked"'
|
4706
|
-
DISABLED_M = '\\sdisabled="[^"]*"\\s|\\sdisabled="[^"]*"$'
|
4707
|
-
DISABLED_M1 = '\\sdisabled="([^"]*)"\\s|\\sdisabled="([^"]*)"$'
|
4708
|
-
DISABLED_R = 'disabled="[^"]*"'
|
4709
|
-
DISABLED_U = 'disabled="disabled"'
|
4710
|
-
READONLY_M = '\\sreadonly="[^"]*"\\s|\\sreadonly="[^"]*"$'
|
4711
|
-
READONLY_M1 = '\\sreadonly="([^"]*)"\\s|\\sreadonly="([^"]*)"$'
|
4712
|
-
READONLY_R = 'readonly="[^"]*"'
|
4713
|
-
READONLY_U = 'readonly="readonly"'
|
4714
|
-
MULTIPLE_M = '\\smultiple="[^"]*"\\s|\\smultiple="[^"]*"$'
|
4715
|
-
MULTIPLE_M1 = '\\smultiple="([^"]*)"\\s|\\smultiple="([^"]*)"$'
|
4716
|
-
MULTIPLE_R = 'multiple="[^"]*"'
|
4717
|
-
MULTIPLE_U = 'multiple="multiple"'
|
4718
|
-
|
4719
|
-
HTTP_EQUIV = 'http-equiv'
|
4720
|
-
CONTENT_TYPE = 'Content-Type'
|
4721
|
-
CONTENT = 'content'
|
4722
|
-
|
4723
|
-
TRUE = 'true'
|
4724
|
-
FALSE = 'false'
|
4725
|
-
|
4726
|
-
TYPE_L = 'type'
|
4727
|
-
TYPE_U = 'TYPE'
|
4728
|
-
|
4729
|
-
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt|nbsp);'
|
4707
|
+
SELECTED_M = '\\sselected="[^"]*"\\s|\\sselected="[^"]*"$'.freeze
|
4708
|
+
SELECTED_M1 = '\\sselected="([^"]*)"\\s|\\sselected="([^"]*)"$'.freeze
|
4709
|
+
SELECTED_R = 'selected="[^"]*"'.freeze
|
4710
|
+
SELECTED_U = 'selected="selected"'.freeze
|
4711
|
+
CHECKED_M = '\\schecked="[^"]*"\\s|\\schecked="[^"]*"$'.freeze
|
4712
|
+
CHECKED_M1 = '\\schecked="([^"]*)"\\s|\\schecked="([^"]*)"$'.freeze
|
4713
|
+
CHECKED_R = 'checked="[^"]*"'.freeze
|
4714
|
+
CHECKED_U = 'checked="checked"'.freeze
|
4715
|
+
DISABLED_M = '\\sdisabled="[^"]*"\\s|\\sdisabled="[^"]*"$'.freeze
|
4716
|
+
DISABLED_M1 = '\\sdisabled="([^"]*)"\\s|\\sdisabled="([^"]*)"$'.freeze
|
4717
|
+
DISABLED_R = 'disabled="[^"]*"'.freeze
|
4718
|
+
DISABLED_U = 'disabled="disabled"'.freeze
|
4719
|
+
READONLY_M = '\\sreadonly="[^"]*"\\s|\\sreadonly="[^"]*"$'.freeze
|
4720
|
+
READONLY_M1 = '\\sreadonly="([^"]*)"\\s|\\sreadonly="([^"]*)"$'.freeze
|
4721
|
+
READONLY_R = 'readonly="[^"]*"'.freeze
|
4722
|
+
READONLY_U = 'readonly="readonly"'.freeze
|
4723
|
+
MULTIPLE_M = '\\smultiple="[^"]*"\\s|\\smultiple="[^"]*"$'.freeze
|
4724
|
+
MULTIPLE_M1 = '\\smultiple="([^"]*)"\\s|\\smultiple="([^"]*)"$'.freeze
|
4725
|
+
MULTIPLE_R = 'multiple="[^"]*"'.freeze
|
4726
|
+
MULTIPLE_U = 'multiple="multiple"'.freeze
|
4727
|
+
|
4728
|
+
HTTP_EQUIV = 'http-equiv'.freeze
|
4729
|
+
CONTENT_TYPE = 'Content-Type'.freeze
|
4730
|
+
CONTENT = 'content'.freeze
|
4731
|
+
|
4732
|
+
TRUE = 'true'.freeze
|
4733
|
+
FALSE = 'false'.freeze
|
4734
|
+
|
4735
|
+
TYPE_L = 'type'.freeze
|
4736
|
+
TYPE_U = 'TYPE'.freeze
|
4737
|
+
|
4738
|
+
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt|nbsp);'.freeze
|
4730
4739
|
|
4731
4740
|
@@pattern_selected_m = Regexp.new(SELECTED_M)
|
4732
4741
|
@@pattern_selected_m1 = Regexp.new(SELECTED_M1)
|
@@ -4752,28 +4761,28 @@ module Meteor
|
|
4752
4761
|
#@@pattern_@@match_tag2 = Regexp.new(@@match_tag_2)
|
4753
4762
|
|
4754
4763
|
TABLE_FOR_ESCAPE_ = {
|
4755
|
-
'&' => '&',
|
4756
|
-
'"' => '"',
|
4757
|
-
'\'' => ''',
|
4758
|
-
'<' => '<',
|
4759
|
-
'>' => '>',
|
4760
|
-
' ' => ' ',
|
4764
|
+
'&' => '&'.freeze,
|
4765
|
+
'"' => '"'.freeze,
|
4766
|
+
'\'' => '''.freeze,
|
4767
|
+
'<' => '<'.freeze,
|
4768
|
+
'>' => '>'.freeze,
|
4769
|
+
' ' => ' '.freeze,
|
4761
4770
|
}
|
4762
4771
|
|
4763
4772
|
TABLE_FOR_ESCAPE_CONTENT_ = {
|
4764
|
-
'&' => '&',
|
4765
|
-
'"' => '"',
|
4766
|
-
'\'' => ''',
|
4767
|
-
'<' => '<',
|
4768
|
-
'>' => '>',
|
4769
|
-
' ' => ' ',
|
4770
|
-
"\r\n" => '<br/>',
|
4771
|
-
"\r" => '<br/>',
|
4772
|
-
"\n" => '<br/>',
|
4773
|
+
'&' => '&'.freeze,
|
4774
|
+
'"' => '"'.freeze,
|
4775
|
+
'\'' => '''.freeze,
|
4776
|
+
'<' => '<'.freeze,
|
4777
|
+
'>' => '>'.freeze,
|
4778
|
+
' ' => ' '.freeze,
|
4779
|
+
"\r\n" => '<br/>'.freeze,
|
4780
|
+
"\r" => '<br/>'.freeze,
|
4781
|
+
"\n" => '<br/>'.freeze,
|
4773
4782
|
}
|
4774
4783
|
|
4775
|
-
PATTERN_ESCAPE = '[&"\'<> ]'
|
4776
|
-
PATTERN_ESCAPE_CONTENT = '[&"\'<> \\n]'
|
4784
|
+
PATTERN_ESCAPE = '[&"\'<> ]'.freeze
|
4785
|
+
PATTERN_ESCAPE_CONTENT = '[&"\'<> \\n]'.freeze
|
4777
4786
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
4778
4787
|
@@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
|
4779
4788
|
|
@@ -5086,23 +5095,23 @@ module Meteor
|
|
5086
5095
|
#
|
5087
5096
|
class ParserImpl < Meteor::Ml::Html::ParserImpl
|
5088
5097
|
|
5089
|
-
CHARSET = 'charset'
|
5090
|
-
UTF8 = 'utf-8'
|
5098
|
+
CHARSET = 'charset'.freeze
|
5099
|
+
UTF8 = 'utf-8'.freeze
|
5091
5100
|
|
5092
|
-
MATCH_TAG = ['br', 'hr', 'img', 'input', 'meta', 'base', 'embed', 'command', 'keygen'] #[Array] 内容のない要素
|
5101
|
+
MATCH_TAG = ['br'.freeze, 'hr'.freeze, 'img'.freeze, 'input'.freeze, 'meta'.freeze, 'base'.freeze, 'embed'.freeze, 'command'.freeze, 'keygen'.freeze] #[Array] 内容のない要素
|
5093
5102
|
|
5094
|
-
MATCH_TAG_SNG = ['texarea', 'select', 'option', 'form', 'fieldset', 'figure', 'figcaption', 'video', 'audio', 'progress', 'meter', 'time', 'ruby', 'rt', 'rp', 'datalist', 'output'] #[Array] 入れ子にできない要素
|
5103
|
+
MATCH_TAG_SNG = ['texarea'.freeze, 'select'.freeze, 'option'.freeze, 'form'.freeze, 'fieldset'.freeze, 'figure'.freeze, 'figcaption'.freeze, 'video'.freeze, 'audio'.freeze, 'progress'.freeze, 'meter'.freeze, 'time'.freeze, 'ruby'.freeze, 'rt'.freeze, 'rp'.freeze, 'datalist'.freeze, 'output'.freeze] #[Array] 入れ子にできない要素
|
5095
5104
|
|
5096
|
-
ATTR_LOGIC = ['disabled', 'readonly', 'checked', 'selected', 'multiple', 'required'] #[Array] 論理値で指定する属性
|
5105
|
+
ATTR_LOGIC = ['disabled'.freeze, 'readonly'.freeze, 'checked'.freeze, 'selected'.freeze, 'multiple'.freeze, 'required'.freeze] #[Array] 論理値で指定する属性
|
5097
5106
|
|
5098
|
-
DISABLE_ELEMENT = ['input', 'textarea', 'select', 'optgroup', 'fieldset'] #[Array] disabled属性のある要素
|
5107
|
+
DISABLE_ELEMENT = ['input'.freeze, 'textarea'.freeze, 'select'.freeze, 'optgroup'.freeze, 'fieldset'.freeze] #[Array] disabled属性のある要素
|
5099
5108
|
|
5100
5109
|
REQUIRE_ELEMENT = ['input', 'textarea'] #[Array] required属性のある要素
|
5101
5110
|
REQUIRED = 'required'
|
5102
5111
|
|
5103
|
-
REQUIRED_M = '\\srequired\\s|\\srequired$|\\sREQUIRED\\s|\\sREQUIRED$'
|
5112
|
+
REQUIRED_M = '\\srequired\\s|\\srequired$|\\sREQUIRED\\s|\\sREQUIRED$'.freeze
|
5104
5113
|
#REQUIRED_M = [' required ',' required',' REQUIRED ',' REQUIRED']
|
5105
|
-
REQUIRED_R = 'required\\s|required$|REQUIRED\\s|REQUIRED$'
|
5114
|
+
REQUIRED_R = 'required\\s|required$|REQUIRED\\s|REQUIRED$'.freeze
|
5106
5115
|
|
5107
5116
|
@@pattern_required_m = Regexp.new(REQUIRED_M)
|
5108
5117
|
@@pattern_required_r = Regexp.new(REQUIRED_R)
|
@@ -5226,20 +5235,20 @@ module Meteor
|
|
5226
5235
|
#
|
5227
5236
|
class ParserImpl < Meteor::Ml::Xhtml::ParserImpl
|
5228
5237
|
|
5229
|
-
CHARSET = 'charset'
|
5230
|
-
UTF8 = 'utf-8'
|
5238
|
+
CHARSET = 'charset'.freeze
|
5239
|
+
UTF8 = 'utf-8'.freeze
|
5231
5240
|
|
5232
|
-
ATTR_LOGIC = ['disabled', 'readonly', 'checked', 'selected', 'multiple', 'required'] #[Array] 論理値で指定する属性
|
5241
|
+
ATTR_LOGIC = ['disabled'.freeze, 'readonly'.freeze, 'checked'.freeze, 'selected'.freeze, 'multiple'.freeze, 'required'.freeze] #[Array] 論理値で指定する属性
|
5233
5242
|
|
5234
|
-
DISABLE_ELEMENT = ['input', 'textarea', 'select', 'optgroup', 'fieldset'] #[Array] disabled属性のある要素
|
5243
|
+
DISABLE_ELEMENT = ['input'.freeze, 'textarea'.freeze, 'select'.freeze, 'optgroup'.freeze, 'fieldset'.freeze] #[Array] disabled属性のある要素
|
5235
5244
|
|
5236
|
-
REQUIRE_ELEMENT = ['input', 'textarea'] #[Array] required属性のある要素
|
5237
|
-
REQUIRED = 'required'
|
5245
|
+
REQUIRE_ELEMENT = ['input'.freeze, 'textarea'.freeze] #[Array] required属性のある要素
|
5246
|
+
REQUIRED = 'required'.freeze
|
5238
5247
|
|
5239
|
-
REQUIRED_M = '\\srequired="[^"]*"\\s|\\srequired="[^"]*"$'
|
5240
|
-
REQUIRED_M1 = '\\srequired="([^"]*)"\\s|\\srequired="([^"]*)"$'
|
5241
|
-
REQUIRED_R = 'required="[^"]*"'
|
5242
|
-
REQUIRED_U = 'required="required"'
|
5248
|
+
REQUIRED_M = '\\srequired="[^"]*"\\s|\\srequired="[^"]*"$'.freeze
|
5249
|
+
REQUIRED_M1 = '\\srequired="([^"]*)"\\s|\\srequired="([^"]*)"$'.freeze
|
5250
|
+
REQUIRED_R = 'required="[^"]*"'.freeze
|
5251
|
+
REQUIRED_U = 'required="required"'.freeze
|
5243
5252
|
|
5244
5253
|
@@pattern_required_m = Regexp.new(REQUIRED_M)
|
5245
5254
|
@@pattern_required_m1 = Regexp.new(REQUIRED_M1)
|
@@ -5364,18 +5373,18 @@ module Meteor
|
|
5364
5373
|
#
|
5365
5374
|
class ParserImpl < Meteor::Core::Kernel
|
5366
5375
|
|
5367
|
-
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt);'
|
5376
|
+
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt);'.freeze
|
5368
5377
|
|
5369
5378
|
@@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
|
5370
5379
|
|
5371
5380
|
TABLE_FOR_ESCAPE_ = {
|
5372
|
-
'&' => '&',
|
5373
|
-
'"' => '"',
|
5374
|
-
'\'' => ''',
|
5375
|
-
'<' => '<',
|
5376
|
-
'>' => '>',
|
5381
|
+
'&' => '&'.freeze,
|
5382
|
+
'"' => '"'.freeze,
|
5383
|
+
'\'' => '''.freeze,
|
5384
|
+
'<' => '<'.freeze,
|
5385
|
+
'>' => '>'.freeze,
|
5377
5386
|
}
|
5378
|
-
PATTERN_ESCAPE = '[&\"\'<>]'
|
5387
|
+
PATTERN_ESCAPE = '[&\"\'<>]'.freeze
|
5379
5388
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
5380
5389
|
|
5381
5390
|
#
|
@@ -5479,4 +5488,4 @@ module Meteor
|
|
5479
5488
|
end
|
5480
5489
|
end
|
5481
5490
|
|
5482
|
-
end
|
5491
|
+
end
|