asip-meteor 0.9.2.4 → 0.9.2.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.
- data/lib/meteor.rb +544 -531
- metadata +2 -2
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.2.
|
21
|
+
# @version 0.9.2.5
|
22
22
|
#
|
23
23
|
|
24
24
|
module Meteor
|
25
25
|
|
26
|
-
VERSION = "0.9.2.
|
26
|
+
VERSION = "0.9.2.5"
|
27
27
|
|
28
28
|
RUBY_VERSION_1_9_0 = '1.9.0'
|
29
29
|
|
@@ -53,30 +53,30 @@ module Meteor
|
|
53
53
|
#
|
54
54
|
def initialize(*args)
|
55
55
|
case args.length
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
when ONE
|
57
|
+
if args[0].kind_of?(String) then
|
58
|
+
initialize_s(args[0])
|
59
|
+
elsif args[0].kind_of?(Meteor::Element)
|
60
|
+
initialize_e(args[0])
|
61
|
+
else
|
62
|
+
raise ArgumentError
|
63
|
+
end
|
64
|
+
when TWO
|
65
|
+
@name = args[0].name
|
66
|
+
@attributes = String.new(args[0].attributes)
|
67
|
+
@mixed_content = String.new(args[0].mixed_content)
|
68
|
+
@pattern = String.new(args[0].pattern)
|
69
|
+
@document = String.new(args[0].document)
|
70
|
+
@empty = args[0].empty
|
71
|
+
@cx = args[0].cx
|
72
|
+
@mono = args[0].mono
|
73
|
+
@parser = args[1]
|
74
|
+
#@arguments = AttributeMap.new(args[0].arguments)
|
75
|
+
#@usable = false
|
76
|
+
@origin = args[0]
|
77
|
+
args[0].copy = self
|
61
78
|
else
|
62
79
|
raise ArgumentError
|
63
|
-
end
|
64
|
-
when TWO
|
65
|
-
@name = args[0].name
|
66
|
-
@attributes = String.new(args[0].attributes)
|
67
|
-
@mixed_content = String.new(args[0].mixed_content)
|
68
|
-
@pattern = String.new(args[0].pattern)
|
69
|
-
@document = String.new(args[0].document)
|
70
|
-
@empty = args[0].empty
|
71
|
-
@cx = args[0].cx
|
72
|
-
@mono = args[0].mono
|
73
|
-
@parser = args[1]
|
74
|
-
@arguments = AttributeMap.new(args[0].arguments)
|
75
|
-
#@usable = false
|
76
|
-
@origin = args[0]
|
77
|
-
args[0].copy = self
|
78
|
-
else
|
79
|
-
raise ArgumentError
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -95,7 +95,7 @@ module Meteor
|
|
95
95
|
#@cx = false
|
96
96
|
#@mono = false
|
97
97
|
#@parent = false
|
98
|
-
|
98
|
+
#@arguments = AttributeMap.new
|
99
99
|
@usable = true
|
100
100
|
end
|
101
101
|
private :initialize_s
|
@@ -113,7 +113,7 @@ module Meteor
|
|
113
113
|
@empty = elm.empty
|
114
114
|
@cx = elm.cx
|
115
115
|
@mono = elm.mono
|
116
|
-
|
116
|
+
#@arguments = AttributeMap.new(elm.arguments)
|
117
117
|
@origin = elm
|
118
118
|
#else
|
119
119
|
# @name = elm.origin.name
|
@@ -129,7 +129,7 @@ module Meteor
|
|
129
129
|
@parser = elm.parser
|
130
130
|
@usable = true
|
131
131
|
end
|
132
|
-
private :initialize_e
|
132
|
+
private :initialize_e
|
133
133
|
|
134
134
|
attr_accessor :name #要素名
|
135
135
|
attr_accessor :attributes #属性群
|
@@ -141,7 +141,7 @@ module Meteor
|
|
141
141
|
attr_accessor :mono #子要素存在フラグ
|
142
142
|
attr_accessor :parser #パーサ
|
143
143
|
attr_accessor :type_value #タイプ属性
|
144
|
-
attr_accessor :arguments #パターン変更用属性マップ
|
144
|
+
#attr_accessor :arguments #パターン変更用属性マップ
|
145
145
|
attr_accessor :usable #有効・無効フラグ
|
146
146
|
attr_accessor :origin #原本ポインタ
|
147
147
|
attr_accessor :copy #複製ポインタ
|
@@ -152,56 +152,56 @@ module Meteor
|
|
152
152
|
#
|
153
153
|
def self.new!(*args)
|
154
154
|
case args.length
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
155
|
+
when ONE
|
156
|
+
#self.new_1!(args[0])
|
157
|
+
args[0].clone
|
158
|
+
when TWO
|
159
|
+
@obj = args[1].root_element.element
|
160
|
+
if @obj then
|
161
|
+
@obj.attributes = String.new(args[0].attributes)
|
162
|
+
@obj.mixed_content = String.new(args[0].mixed_content)
|
163
|
+
@obj.pattern = String.new(args[0].pattern)
|
164
|
+
@obj.document = String.new(args[0].document)
|
165
|
+
#@obj.arguments = AttributeMap.new(args[0].arguments)
|
166
|
+
@obj
|
167
|
+
else
|
168
|
+
@obj = self.new(args[0],args[1])
|
169
|
+
args[1].root_element.element = @obj
|
170
|
+
@obj
|
171
|
+
end
|
172
172
|
end
|
173
|
-
end
|
173
|
+
end
|
174
174
|
|
175
175
|
#
|
176
176
|
# 複製する
|
177
177
|
#
|
178
178
|
def clone
|
179
|
-
obj = self.parser.
|
179
|
+
obj = self.parser.element_cache[self.object_id]
|
180
180
|
if obj then
|
181
181
|
obj.attributes = String.new(self.attributes)
|
182
182
|
obj.mixed_content = String.new(self.mixed_content)
|
183
183
|
obj.pattern = String.new(self.pattern)
|
184
184
|
obj.document = String.new(self.document)
|
185
|
-
obj.arguments = AttributeMap.new(self.arguments)
|
185
|
+
#obj.arguments = AttributeMap.new(self.arguments)
|
186
186
|
obj.usable = true
|
187
187
|
obj
|
188
188
|
else
|
189
189
|
obj = self.new(self)
|
190
|
-
self.parser.
|
190
|
+
self.parser.element_cache[self.object_id] = obj
|
191
191
|
obj
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
195
|
+
#
|
196
|
+
# 子要素を取得する
|
197
|
+
#
|
198
|
+
# @param [Array] args 引数配列
|
199
|
+
# @return [Element] 子要素
|
200
|
+
#
|
201
|
+
def child(*args)
|
202
|
+
@parser.element(*args)
|
203
|
+
end
|
204
|
+
|
205
205
|
#
|
206
206
|
# CX(コメント拡張)タグを取得する
|
207
207
|
#
|
@@ -278,7 +278,7 @@ module Meteor
|
|
278
278
|
content()
|
279
279
|
end
|
280
280
|
end
|
281
|
-
|
281
|
+
|
282
282
|
#
|
283
283
|
# 属性を削除する
|
284
284
|
#
|
@@ -287,17 +287,17 @@ module Meteor
|
|
287
287
|
def remove_attribute(*args)
|
288
288
|
@parser.remove_attribute(self,*args)
|
289
289
|
end
|
290
|
-
|
290
|
+
|
291
291
|
#
|
292
292
|
# 要素を削除する
|
293
293
|
#
|
294
294
|
def remove
|
295
295
|
@parser.remove_element(self)
|
296
296
|
end
|
297
|
-
|
297
|
+
|
298
298
|
def flush
|
299
299
|
@parser.flush
|
300
|
-
end
|
300
|
+
end
|
301
301
|
|
302
302
|
#
|
303
303
|
# フッククラスの処理を実行する
|
@@ -306,7 +306,7 @@ module Meteor
|
|
306
306
|
def execute(*args)
|
307
307
|
@parser.execute(self,*args)
|
308
308
|
end
|
309
|
-
|
309
|
+
|
310
310
|
end
|
311
311
|
|
312
312
|
#
|
@@ -338,7 +338,7 @@ module Meteor
|
|
338
338
|
attr_accessor :character_encoding
|
339
339
|
attr_accessor :document
|
340
340
|
attr_accessor :hook_document
|
341
|
-
attr_accessor :element
|
341
|
+
attr_accessor :element
|
342
342
|
end
|
343
343
|
|
344
344
|
#
|
@@ -348,15 +348,15 @@ module Meteor
|
|
348
348
|
|
349
349
|
def initialize(*args)
|
350
350
|
case args.length
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
351
|
+
when ZERO
|
352
|
+
initialize_0
|
353
|
+
when ONE
|
354
|
+
initialize_1(args[0])
|
355
|
+
else
|
356
|
+
raise ArgumentError
|
357
357
|
end
|
358
358
|
end
|
359
|
-
|
359
|
+
|
360
360
|
#
|
361
361
|
# イニシャライザ
|
362
362
|
#
|
@@ -448,7 +448,7 @@ module Meteor
|
|
448
448
|
@map[name].changed = false
|
449
449
|
end
|
450
450
|
end
|
451
|
-
|
451
|
+
|
452
452
|
#
|
453
453
|
# 属性名で属性の変更状況を取得する
|
454
454
|
#
|
@@ -513,7 +513,7 @@ module Meteor
|
|
513
513
|
attr_accessor :name
|
514
514
|
attr_accessor :value
|
515
515
|
attr_accessor :changed
|
516
|
-
attr_accessor :removed
|
516
|
+
attr_accessor :removed
|
517
517
|
|
518
518
|
end
|
519
519
|
|
@@ -539,12 +539,12 @@ module Meteor
|
|
539
539
|
#
|
540
540
|
def self.build(*args)
|
541
541
|
case args.length
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
542
|
+
when THREE
|
543
|
+
build_3(args[0],args[1],args[2])
|
544
|
+
when TWO
|
545
|
+
build_2(args[0],args[1])
|
546
|
+
else
|
547
|
+
raise ArgumentError
|
548
548
|
end
|
549
549
|
end
|
550
550
|
|
@@ -560,24 +560,24 @@ module Meteor
|
|
560
560
|
psf = ParserFactory.new
|
561
561
|
|
562
562
|
case type
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
563
|
+
when Parser::HTML then
|
564
|
+
html = Meteor::Core::Html::ParserImpl.new()
|
565
|
+
html.read(path, encoding)
|
566
|
+
psf.parser = html
|
567
|
+
when Parser::XHTML then
|
568
|
+
xhtml = Meteor::Core::Xhtml::ParserImpl.new()
|
569
|
+
xhtml.read(path, encoding)
|
570
|
+
psf.parser = xhtml
|
571
|
+
when Parser::XML then
|
572
|
+
xml = Meteor::Core::Xml::ParserImpl.new()
|
573
|
+
xml.read(path, encoding)
|
574
|
+
psf.parser = xml
|
575
575
|
end
|
576
|
-
|
576
|
+
|
577
577
|
psf
|
578
578
|
end
|
579
579
|
#protected :build_3
|
580
|
-
|
580
|
+
|
581
581
|
#
|
582
582
|
# パーサファクトリを生成する
|
583
583
|
#
|
@@ -589,24 +589,24 @@ module Meteor
|
|
589
589
|
psf = ParserFactory.new
|
590
590
|
|
591
591
|
case type
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
592
|
+
when Parser::HTML then
|
593
|
+
html = Meteor::Core::Html::ParserImpl.new()
|
594
|
+
html.parse(document)
|
595
|
+
psf.parser = html
|
596
|
+
when Parser::XHTML then
|
597
|
+
xhtml = Meteor::Core::Xhtml::ParserImpl.new()
|
598
|
+
xhtml.parse(document)
|
599
|
+
psf.parser = xhtml
|
600
|
+
when Parser::XML then
|
601
|
+
xml = Meteor::Core::Xml::ParserImpl.new()
|
602
|
+
xml.parse(document)
|
603
|
+
psf.parser = xml
|
604
604
|
end
|
605
605
|
|
606
606
|
psf
|
607
607
|
end
|
608
608
|
#protected :build_2
|
609
|
-
|
609
|
+
|
610
610
|
#
|
611
611
|
# パーサをセットする
|
612
612
|
#
|
@@ -651,7 +651,7 @@ module Meteor
|
|
651
651
|
#内容あり要素の場合
|
652
652
|
if elm.empty then
|
653
653
|
elm2 = elm.child(elm)
|
654
|
-
execute(elm2)
|
654
|
+
execute(elm2)
|
655
655
|
end
|
656
656
|
end
|
657
657
|
|
@@ -681,7 +681,7 @@ module Meteor
|
|
681
681
|
end
|
682
682
|
execute(elm2, item)
|
683
683
|
elm2.flush
|
684
|
-
end
|
684
|
+
end
|
685
685
|
end
|
686
686
|
end
|
687
687
|
|
@@ -692,7 +692,7 @@ module Meteor
|
|
692
692
|
def execute(elm,item)
|
693
693
|
end
|
694
694
|
private :execute
|
695
|
-
|
695
|
+
|
696
696
|
end
|
697
697
|
end
|
698
698
|
|
@@ -722,13 +722,13 @@ module Meteor
|
|
722
722
|
#TAG_SEARCH_1_4 = "([^<>\\/]*)>"
|
723
723
|
TAG_SEARCH_1_4 = '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
724
724
|
TAG_SEARCH_1_4_2 = '(\\s[^<>]*)>'
|
725
|
-
|
725
|
+
|
726
726
|
TAG_SEARCH_NC_1_1 = '\\s?[^<>]*>((?!('
|
727
727
|
TAG_SEARCH_NC_1_2 = '[^<>]*>)).)*<\\/'
|
728
728
|
TAG_SEARCH_NC_1_3 = '\\s?[^<>]*\\/>'
|
729
729
|
TAG_SEARCH_NC_1_4 = '(?:\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
|
730
730
|
TAG_SEARCH_NC_1_4_2 = '\\s[^<>]*>'
|
731
|
-
|
731
|
+
|
732
732
|
#TAG_SEARCH_2_1 = "\\s([^<>]*"
|
733
733
|
TAG_SEARCH_2_1 = '(\\s[^<>]*'
|
734
734
|
TAG_SEARCH_2_1_2 = '(\\s[^<>]*(?:'
|
@@ -767,7 +767,7 @@ module Meteor
|
|
767
767
|
TAG_SEARCH_NC_2_4_4 = '"[^<>]*>'
|
768
768
|
TAG_SEARCH_NC_2_6 = '"[^<>]*'
|
769
769
|
TAG_SEARCH_NC_2_7 = '"|'
|
770
|
-
|
770
|
+
|
771
771
|
TAG_SEARCH_3_1 = '<([^<>"]*)\\s[^<>]*'
|
772
772
|
TAG_SEARCH_3_1_2 = '<([^<>"]*)\\s([^<>]*'
|
773
773
|
TAG_SEARCH_3_1_2_2 = '<([^<>"]*)\\s([^<>]*('
|
@@ -801,7 +801,7 @@ module Meteor
|
|
801
801
|
#TAG_SEARCH_NC_4_6 = ".*?<\/"
|
802
802
|
#TAG_SEARCH_NC_4_7 = "\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
803
803
|
#TAG_SEARCH_NC_4_7_2 = "\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
804
|
-
|
804
|
+
|
805
805
|
#setAttribute
|
806
806
|
SET_ATTR_1 = '="[^"]*"'
|
807
807
|
#getAttributeValue
|
@@ -853,13 +853,13 @@ module Meteor
|
|
853
853
|
#DOL_2 = "\\\\\\$"
|
854
854
|
#PLUS_1 = "\\\+"
|
855
855
|
#PLUS_2 = "\\\\\\+"
|
856
|
-
|
856
|
+
|
857
857
|
ESCAPE_ENTITY_REF = ''
|
858
|
-
|
858
|
+
|
859
859
|
#SUB_REGEX1 = (\\\\*)\\\\([0-9]+)'
|
860
860
|
#SUB_REGEX2 = '\\1\\1\\\\\\\\\\2'
|
861
861
|
#SUB_REGEX3 = '\\1\\1\\1\\1\\\\\\\\\\\\\\\\\\2'
|
862
|
-
|
862
|
+
|
863
863
|
@@pattern_get_attrs_map = Regexp.new(GET_ATTRS_MAP)
|
864
864
|
|
865
865
|
#BRAC_OPEN_1 = "\\\("
|
@@ -896,9 +896,9 @@ module Meteor
|
|
896
896
|
#@@pattern_vline = Regexp.new(VLINE_1)
|
897
897
|
#@@pattern_qmark = Regexp.new(QMARK_1)
|
898
898
|
#@@pattern_asterisk = Regexp.new(ASTERISK_1)
|
899
|
-
|
899
|
+
|
900
900
|
#@@pattern_sub_regex1 = Regexp.new(SUB_REGEX1)
|
901
|
-
|
901
|
+
|
902
902
|
@@pattern_clean1 = Regexp.new(CLEAN_1)
|
903
903
|
@@pattern_clean2 = Regexp.new(CLEAN_2)
|
904
904
|
|
@@ -916,9 +916,9 @@ module Meteor
|
|
916
916
|
#ルート要素
|
917
917
|
@root = RootElement.new
|
918
918
|
if RUBY_VERSION >= RUBY_VERSION_1_9_0 then
|
919
|
-
@
|
919
|
+
@element_cache = Hash.new()
|
920
920
|
else
|
921
|
-
@
|
921
|
+
@element_cache = Meteor::Core::Util::OrderHash.new
|
922
922
|
end
|
923
923
|
#@res = nil
|
924
924
|
#@_attributes = nil
|
@@ -968,8 +968,8 @@ module Meteor
|
|
968
968
|
def document
|
969
969
|
@root.document
|
970
970
|
end
|
971
|
-
|
972
|
-
attr_accessor :
|
971
|
+
|
972
|
+
attr_accessor :element_cache
|
973
973
|
|
974
974
|
#
|
975
975
|
# 文字エンコーディングをセットする
|
@@ -1039,20 +1039,20 @@ module Meteor
|
|
1039
1039
|
|
1040
1040
|
def get_encoding()
|
1041
1041
|
case @character_encoding
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1042
|
+
when 'UTF-8'
|
1043
|
+
Kconv::UTF8
|
1044
|
+
when 'ISO-2022-JP'
|
1045
|
+
Kconv::JIS
|
1046
|
+
when 'Shift_JIS'
|
1047
|
+
Kconv::SJIS
|
1048
|
+
when 'EUC-JP'
|
1049
|
+
Kconv::EUC
|
1050
|
+
when 'ASCII'
|
1051
|
+
Kconv::ASCII
|
1052
1052
|
#when "UTF-16"
|
1053
1053
|
# return KConv::UTF16
|
1054
|
-
|
1055
|
-
|
1054
|
+
else
|
1055
|
+
Kconv::UTF8
|
1056
1056
|
end
|
1057
1057
|
end
|
1058
1058
|
private :get_encoding
|
@@ -1065,31 +1065,41 @@ module Meteor
|
|
1065
1065
|
#
|
1066
1066
|
def element(*args)
|
1067
1067
|
case args.length
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1068
|
+
when ONE
|
1069
|
+
if args[0].kind_of?(String) then
|
1070
|
+
element_1(args[0])
|
1071
|
+
if @elm_ then
|
1072
|
+
@element_cache.store(@elm_.object_id,@elm_)
|
1073
|
+
end
|
1074
|
+
elsif args[0].kind_of?(Meteor::Element) then
|
1075
|
+
shadow(args[0])
|
1076
|
+
else
|
1077
|
+
raise ArgumentError
|
1078
|
+
end
|
1079
|
+
when TWO
|
1080
|
+
element_2(args[0],args[1])
|
1081
|
+
if @elm_ then
|
1082
|
+
@element_cache.store(@elm_.object_id,@elm_)
|
1083
|
+
end
|
1084
|
+
when THREE
|
1085
|
+
element_3(args[0],args[1],args[2])
|
1086
|
+
if @elm_ then
|
1087
|
+
@element_cache.store(@elm_.object_id,@elm_)
|
1088
|
+
end
|
1089
|
+
when FOUR
|
1090
|
+
element_4(args[0],args[1],args[2],args[3])
|
1091
|
+
if @elm_ then
|
1092
|
+
@element_cache.store(@elm_.object_id,@elm_)
|
1093
|
+
end
|
1094
|
+
when FIVE
|
1095
|
+
element_5(args[0],args[1],args[2],args[3],args[4])
|
1096
|
+
if @elm_ then
|
1097
|
+
@element_cache.store(@elm_.object_id,@elm_)
|
1098
|
+
end
|
1074
1099
|
else
|
1100
|
+
@elm_ = nil
|
1075
1101
|
raise ArgumentError
|
1076
|
-
end
|
1077
|
-
when TWO
|
1078
|
-
element_2(args[0],args[1])
|
1079
|
-
@e_cache.store(@elm_.object_id,@elm_)
|
1080
|
-
when THREE
|
1081
|
-
element_3(args[0],args[1],args[2])
|
1082
|
-
@e_cache.store(@elm_.object_id,@elm_)
|
1083
|
-
when FOUR
|
1084
|
-
element_4(args[0],args[1],args[2],args[3])
|
1085
|
-
@e_cache.store(@elm_.object_id,@elm_)
|
1086
|
-
when FIVE
|
1087
|
-
element_5(args[0],args[1],args[2],args[3],args[4])
|
1088
|
-
@e_cache.store(@elm_.object_id,@elm_)
|
1089
|
-
else
|
1090
|
-
raise ArgumentError
|
1091
1102
|
end
|
1092
|
-
@elm_
|
1093
1103
|
end
|
1094
1104
|
|
1095
1105
|
#
|
@@ -1101,14 +1111,14 @@ module Meteor
|
|
1101
1111
|
def element_1(elm_name)
|
1102
1112
|
|
1103
1113
|
@_elm_name = escape_regex(elm_name)
|
1104
|
-
|
1114
|
+
|
1105
1115
|
#空要素検索用パターン
|
1106
1116
|
@pattern_cc_1 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_1_3
|
1107
1117
|
|
1108
1118
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
1109
1119
|
#空要素検索
|
1110
1120
|
@res1 = @pattern.match(@root.document)
|
1111
|
-
|
1121
|
+
|
1112
1122
|
#内容あり要素検索用パターン
|
1113
1123
|
#@pattern_cc_2 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_1_1 << elm_name
|
1114
1124
|
#@pattern_cc_2 << TAG_SEARCH_1_2 << @_elm_name << TAG_CLOSE
|
@@ -1118,7 +1128,7 @@ module Meteor
|
|
1118
1128
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
|
1119
1129
|
#内容あり要素検索
|
1120
1130
|
@res2 = @pattern.match(@root.document)
|
1121
|
-
|
1131
|
+
|
1122
1132
|
if @res1 && @res2 then
|
1123
1133
|
if @res1.end(0) < @res2.end(0) then
|
1124
1134
|
@res = @res1
|
@@ -1141,7 +1151,7 @@ module Meteor
|
|
1141
1151
|
@elm_ = nil
|
1142
1152
|
#raise NoSuchElementException.new(elm_name);
|
1143
1153
|
end
|
1144
|
-
|
1154
|
+
|
1145
1155
|
@elm_
|
1146
1156
|
end
|
1147
1157
|
private :element_1
|
@@ -1155,16 +1165,16 @@ module Meteor
|
|
1155
1165
|
@elm_.mixed_content = @res[2]
|
1156
1166
|
#全体
|
1157
1167
|
@elm_.document = @res[0]
|
1158
|
-
|
1168
|
+
|
1159
1169
|
#@pattern_cc = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_NC_1_1 << elm_name
|
1160
1170
|
#@pattern_cc << TAG_SEARCH_NC_1_2 << @_elm_name << TAG_CLOSE
|
1161
1171
|
@pattern_cc = "<#{@_elm_name}\\s?[^<>]*>((?!(#{@_elm_name}[^<>]*>)).)*<\\/#{@_elm_name}>"
|
1162
1172
|
|
1163
1173
|
#内容あり要素検索用パターン
|
1164
1174
|
@elm_.pattern = @pattern_cc
|
1165
|
-
|
1175
|
+
|
1166
1176
|
@elm_.empty = true
|
1167
|
-
|
1177
|
+
|
1168
1178
|
@elm_.parser = self
|
1169
1179
|
|
1170
1180
|
@elm_
|
@@ -1181,9 +1191,9 @@ module Meteor
|
|
1181
1191
|
#空要素検索用パターン
|
1182
1192
|
@pattern_cc = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_NC_1_3
|
1183
1193
|
@elm_.pattern = @pattern_cc
|
1184
|
-
|
1194
|
+
|
1185
1195
|
@elm_.empty = false
|
1186
|
-
|
1196
|
+
|
1187
1197
|
@elm_.parser = self
|
1188
1198
|
|
1189
1199
|
@elm_
|
@@ -1212,7 +1222,7 @@ module Meteor
|
|
1212
1222
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
1213
1223
|
#空要素検索
|
1214
1224
|
@res1 = @pattern.match(@root.document)
|
1215
|
-
|
1225
|
+
|
1216
1226
|
#内容あり要素検索パターン
|
1217
1227
|
#@pattern_cc_2 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
1218
1228
|
#@pattern_cc_2 << @_attr_value << TAG_SEARCH_2_2 << @_elm_name
|
@@ -1222,12 +1232,12 @@ module Meteor
|
|
1222
1232
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
|
1223
1233
|
#内容あり要素検索
|
1224
1234
|
@res2 = @pattern.match(@root.document)
|
1225
|
-
|
1235
|
+
|
1226
1236
|
if !@res2 then
|
1227
1237
|
@res2 = element_with_3_2(elm_name)
|
1228
1238
|
@pattern_cc_2 = @pattern_cc
|
1229
1239
|
end
|
1230
|
-
|
1240
|
+
|
1231
1241
|
if @res1 && @res2 then
|
1232
1242
|
if @res1.begin(0) < @res2.begin(0) then
|
1233
1243
|
@res = @res1
|
@@ -1250,18 +1260,18 @@ module Meteor
|
|
1250
1260
|
@elm_ = nil
|
1251
1261
|
#raise NoSuchElementException.new(elm_name,attr_name,attr_value);
|
1252
1262
|
end
|
1253
|
-
|
1254
|
-
if @elm_ then
|
1255
|
-
|
1256
|
-
|
1257
|
-
end
|
1258
|
-
|
1263
|
+
|
1264
|
+
#if @elm_ then
|
1265
|
+
# @elm_.arguments.store(attr_name, attr_value)
|
1266
|
+
# @elm_.arguments.recordable = true
|
1267
|
+
#end
|
1268
|
+
|
1259
1269
|
@elm_
|
1260
1270
|
end
|
1261
1271
|
private :element_3
|
1262
1272
|
|
1263
1273
|
def element_with_3_1(elm_name)
|
1264
|
-
|
1274
|
+
|
1265
1275
|
if @res.captures.length == FOUR then
|
1266
1276
|
#要素
|
1267
1277
|
@elm_ = Element.new(elm_name)
|
@@ -1278,11 +1288,11 @@ module Meteor
|
|
1278
1288
|
@pattern_cc = "<#{@_elm_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_elm_name}[^<>]*>)).)*<\\/#{@_elm_name}>"
|
1279
1289
|
|
1280
1290
|
@elm_.pattern = @pattern_cc
|
1281
|
-
|
1291
|
+
|
1282
1292
|
@elm_.empty = true
|
1283
|
-
|
1293
|
+
|
1284
1294
|
@elm_.parser = self
|
1285
|
-
|
1295
|
+
|
1286
1296
|
elsif @res.captures.length == SIX then
|
1287
1297
|
#内容
|
1288
1298
|
@elm_ = Element.new(elm_name)
|
@@ -1294,15 +1304,15 @@ module Meteor
|
|
1294
1304
|
@elm_.document = @res[0]
|
1295
1305
|
#内容あり要素検索用パターン
|
1296
1306
|
@elm_.pattern = @pattern_cc
|
1297
|
-
|
1307
|
+
|
1298
1308
|
@elm_.empty = true
|
1299
|
-
|
1309
|
+
|
1300
1310
|
@elm_.parser = self
|
1301
1311
|
end
|
1302
1312
|
@elm_
|
1303
1313
|
end
|
1304
1314
|
private :element_with_3_1
|
1305
|
-
|
1315
|
+
|
1306
1316
|
def element_with_3_2(elm_name)
|
1307
1317
|
|
1308
1318
|
#@pattern_cc_1 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
@@ -1310,52 +1320,52 @@ module Meteor
|
|
1310
1320
|
@pattern_cc_1 = "<#{@_elm_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
|
1311
1321
|
|
1312
1322
|
@pattern_cc_1b = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_1_4
|
1313
|
-
|
1323
|
+
|
1314
1324
|
#@pattern_cc_1_1 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
|
1315
1325
|
#@pattern_cc_1_1 << @_attr_value << TAG_SEARCH_4_7
|
1316
1326
|
@pattern_cc_1_1 = "<#{@_elm_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
1317
|
-
|
1327
|
+
|
1318
1328
|
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_elm_name << TAG_SEARCH_4_3
|
1319
|
-
|
1329
|
+
|
1320
1330
|
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_elm_name << TAG_CLOSE
|
1321
|
-
|
1331
|
+
|
1322
1332
|
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_elm_name << TAG_CLOSE
|
1323
|
-
|
1333
|
+
|
1324
1334
|
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_elm_name << TAG_CLOSE
|
1325
|
-
|
1335
|
+
|
1326
1336
|
#内容あり要素検索
|
1327
1337
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
1328
|
-
|
1338
|
+
|
1329
1339
|
@sbuf = '';
|
1330
|
-
|
1340
|
+
|
1331
1341
|
@pattern_2 = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
|
1332
1342
|
@pattern_1b = Meteor::Core::Util::PatternCache.get(@pattern_cc_1b);
|
1333
1343
|
|
1334
1344
|
@cnt = 0
|
1335
1345
|
|
1336
1346
|
create_element_pattern
|
1337
|
-
|
1347
|
+
|
1338
1348
|
@pattern_cc = @sbuf
|
1339
|
-
|
1349
|
+
|
1340
1350
|
if @sbuf.length == ZERO || @cnt != ZERO then
|
1341
1351
|
# raise NoSuchElementException.new(elm_name,attr_name,attr_value);
|
1342
1352
|
return nil;
|
1343
1353
|
end
|
1344
|
-
|
1354
|
+
|
1345
1355
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
1346
1356
|
@res = @pattern.match(@root.document)
|
1347
|
-
|
1357
|
+
|
1348
1358
|
@res
|
1349
1359
|
end
|
1350
1360
|
private :element_with_3_2
|
1351
|
-
|
1361
|
+
|
1352
1362
|
def element_without_3(elm_name)
|
1353
1363
|
element_without_3_1(elm_name,TAG_SEARCH_NC_2_3_2)
|
1354
1364
|
end
|
1355
1365
|
private :element_without_3
|
1356
|
-
|
1366
|
+
|
1357
1367
|
def element_without_3_1(elm_name,closer)
|
1358
|
-
|
1368
|
+
|
1359
1369
|
#要素
|
1360
1370
|
@elm_ = Element.new(elm_name)
|
1361
1371
|
#属性
|
@@ -1366,13 +1376,13 @@ module Meteor
|
|
1366
1376
|
@pattern_cc = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
|
1367
1377
|
@pattern_cc << @_attr_value << closer
|
1368
1378
|
@elm_.pattern = @pattern_cc
|
1369
|
-
|
1379
|
+
|
1370
1380
|
@elm_.parser = self
|
1371
1381
|
|
1372
1382
|
@elm_
|
1373
1383
|
end
|
1374
1384
|
private :element_without_3_1
|
1375
|
-
|
1385
|
+
|
1376
1386
|
#
|
1377
1387
|
# 属性(属性名="属性値")で検索し、要素を取得する
|
1378
1388
|
#
|
@@ -1381,28 +1391,28 @@ module Meteor
|
|
1381
1391
|
# @return [Meteor::Element] 要素
|
1382
1392
|
#
|
1383
1393
|
def element_2(attr_name,attr_value)
|
1384
|
-
|
1394
|
+
|
1385
1395
|
@_attr_name = escape_regex(attr_name)
|
1386
1396
|
@_attr_value = escape_regex(attr_value)
|
1387
|
-
|
1397
|
+
|
1388
1398
|
##@pattern_cc = '' << TAG_SEARCH_3_1 << @_attr_name << ATTR_EQ << @_attr_value << TAG_SEARCH_2_4
|
1389
1399
|
#@pattern_cc = '' << TAG_SEARCH_3_1 << @_attr_name << ATTR_EQ << @_attr_value << TAG_SEARCH_2_4_2_3
|
1390
1400
|
@pattern_cc = "<([^<>\"]*)\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\""
|
1391
1401
|
|
1392
1402
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
1393
|
-
|
1403
|
+
|
1394
1404
|
@res = @pattern.match(@root.document)
|
1395
|
-
|
1405
|
+
|
1396
1406
|
if @res then
|
1397
1407
|
element_3(@res[1], attr_name, attr_value)
|
1398
1408
|
else
|
1399
1409
|
@elm_ = nil
|
1400
1410
|
end
|
1401
|
-
|
1411
|
+
|
1402
1412
|
@elm_
|
1403
1413
|
end
|
1404
1414
|
private :element_2
|
1405
|
-
|
1415
|
+
|
1406
1416
|
#
|
1407
1417
|
# 要素名と属性1・属性2で検索し、要素を取得する
|
1408
1418
|
#
|
@@ -1432,7 +1442,7 @@ module Meteor
|
|
1432
1442
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
1433
1443
|
#空要素検索
|
1434
1444
|
@res1 = @pattern.match(@root.document)
|
1435
|
-
|
1445
|
+
|
1436
1446
|
#内容あり要素検索パターン
|
1437
1447
|
#@pattern_cc_2 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
|
1438
1448
|
#@pattern_cc_2 << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
|
@@ -1445,12 +1455,12 @@ module Meteor
|
|
1445
1455
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
|
1446
1456
|
#内容あり要素検索
|
1447
1457
|
@res2 = @pattern.match(@root.document)
|
1448
|
-
|
1458
|
+
|
1449
1459
|
if !@res2 then
|
1450
1460
|
@res2 = element_with_5_2(elm_name)
|
1451
1461
|
@pattern_cc_2 = @pattern_cc
|
1452
1462
|
end
|
1453
|
-
|
1463
|
+
|
1454
1464
|
if @res1 && @res2 then
|
1455
1465
|
if @res1.begin(0) < @res2.begin(0) then
|
1456
1466
|
@res = @res1
|
@@ -1473,19 +1483,19 @@ module Meteor
|
|
1473
1483
|
@elm_ = nil
|
1474
1484
|
#raise NoSuchElementException.new(elm_name,attr_name1,attr_value1,attr_name2,attr_value2);
|
1475
1485
|
end
|
1476
|
-
|
1477
|
-
if @elm_ then
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
end
|
1482
|
-
|
1486
|
+
|
1487
|
+
#if @elm_ then
|
1488
|
+
# @elm_.arguments.store(attr_name1, attr_value1)
|
1489
|
+
# @elm_.arguments.store(attr_name2, attr_value2)
|
1490
|
+
# @elm_.arguments.recordable = true
|
1491
|
+
#end
|
1492
|
+
|
1483
1493
|
@elm_
|
1484
1494
|
end
|
1485
1495
|
private :element_5
|
1486
|
-
|
1496
|
+
|
1487
1497
|
def element_with_5_1(elm_name)
|
1488
|
-
|
1498
|
+
|
1489
1499
|
if @res.captures.length == FOUR then
|
1490
1500
|
#要素
|
1491
1501
|
@elm_ = Element.new(elm_name)
|
@@ -1507,11 +1517,11 @@ module Meteor
|
|
1507
1517
|
@elm_.pattern = @pattern_cc
|
1508
1518
|
#
|
1509
1519
|
@elm_.empty = true
|
1510
|
-
|
1520
|
+
|
1511
1521
|
@elm_.parser = self
|
1512
|
-
|
1522
|
+
|
1513
1523
|
elsif @res.captures.length == SIX then
|
1514
|
-
|
1524
|
+
|
1515
1525
|
@elm_ = Element.new(elm_name)
|
1516
1526
|
#属性
|
1517
1527
|
@elm_.attributes = @res[1].chop
|
@@ -1521,15 +1531,15 @@ module Meteor
|
|
1521
1531
|
@elm_.document = @res[0]
|
1522
1532
|
#要素ありタグ検索用パターン
|
1523
1533
|
@elm_.pattern = @pattern_cc
|
1524
|
-
|
1534
|
+
|
1525
1535
|
@elm_.empty = true
|
1526
|
-
|
1536
|
+
|
1527
1537
|
@elm_.parser = self
|
1528
1538
|
end
|
1529
1539
|
@elm_
|
1530
1540
|
end
|
1531
1541
|
private :element_with_5_1
|
1532
|
-
|
1542
|
+
|
1533
1543
|
def element_with_5_2(elm_name)
|
1534
1544
|
|
1535
1545
|
#@pattern_cc_1 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
|
@@ -1540,7 +1550,7 @@ module Meteor
|
|
1540
1550
|
@pattern_cc_1 = "<#{@_elm_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))"
|
1541
1551
|
|
1542
1552
|
@pattern_cc_1b = '' << TAG_OPEN << elm_name << TAG_SEARCH_1_4
|
1543
|
-
|
1553
|
+
|
1544
1554
|
#@pattern_cc_1_1 = '' << TAG_OPEN << @_elm_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
|
1545
1555
|
#@pattern_cc_1_1 << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
|
1546
1556
|
#@pattern_cc_1_1 << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
|
@@ -1549,39 +1559,39 @@ module Meteor
|
|
1549
1559
|
@pattern_cc_1 = "<#{@_elm_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
|
1550
1560
|
|
1551
1561
|
@pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_elm_name << TAG_SEARCH_4_3
|
1552
|
-
|
1562
|
+
|
1553
1563
|
@pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_elm_name << TAG_CLOSE
|
1554
|
-
|
1564
|
+
|
1555
1565
|
@pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_elm_name << TAG_CLOSE
|
1556
|
-
|
1566
|
+
|
1557
1567
|
@pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_elm_name << TAG_CLOSE
|
1558
|
-
|
1568
|
+
|
1559
1569
|
#内容あり要素検索
|
1560
1570
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
|
1561
|
-
|
1571
|
+
|
1562
1572
|
@sbuf = ''
|
1563
|
-
|
1573
|
+
|
1564
1574
|
@pattern_2 = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
|
1565
1575
|
@pattern_1b = Meteor::Core::Util::PatternCache.get(@pattern_cc_1b);
|
1566
1576
|
|
1567
1577
|
@cnt = 0
|
1568
1578
|
|
1569
1579
|
create_element_pattern
|
1570
|
-
|
1580
|
+
|
1571
1581
|
@pattern_cc = @sbuf
|
1572
|
-
|
1582
|
+
|
1573
1583
|
if @sbuf.length == ZERO || @cnt != ZERO then
|
1574
1584
|
# raise NoSuchElementException.new(elm_name,attr_name1,attr_value1,attr_name2,attr_value2);
|
1575
1585
|
return nil
|
1576
1586
|
end
|
1577
|
-
|
1587
|
+
|
1578
1588
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
1579
1589
|
@res = @pattern.match(@root.document)
|
1580
|
-
|
1590
|
+
|
1581
1591
|
@res
|
1582
1592
|
end
|
1583
1593
|
private :element_with_5_2
|
1584
|
-
|
1594
|
+
|
1585
1595
|
def element_without_5(elm_name)
|
1586
1596
|
element_without_5_1(elm_name,TAG_SEARCH_NC_2_3_2_2);
|
1587
1597
|
end
|
@@ -1604,7 +1614,7 @@ module Meteor
|
|
1604
1614
|
@pattern_cc = "<#{@_elm_name}\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}"
|
1605
1615
|
|
1606
1616
|
@elm_.pattern = @pattern_cc
|
1607
|
-
|
1617
|
+
|
1608
1618
|
@elm_.parser = self
|
1609
1619
|
|
1610
1620
|
@elm_
|
@@ -1649,7 +1659,7 @@ module Meteor
|
|
1649
1659
|
end
|
1650
1660
|
private :element_4
|
1651
1661
|
|
1652
|
-
def create_element_pattern
|
1662
|
+
def create_element_pattern
|
1653
1663
|
|
1654
1664
|
if RUBY_VERSION >= RUBY_VERSION_1_9_0 then
|
1655
1665
|
|
@@ -1851,25 +1861,25 @@ module Meteor
|
|
1851
1861
|
#
|
1852
1862
|
def attribute(*args)
|
1853
1863
|
case args.length
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1864
|
+
#when ONE
|
1865
|
+
# get_attribute_value_1(args[0])
|
1866
|
+
when TWO
|
1867
|
+
if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String) then
|
1868
|
+
get_attribute_value_2(args[0],args[1])
|
1869
|
+
#elsif args[0].kind_of?(String) && args[1].kind_of?(String) then
|
1870
|
+
# set_attribute_2(args[0],args[1])
|
1871
|
+
elsif args[0].kind_of?(Meteor::Element) && args[1].kind_of?(Meteor::AttributeMap) then
|
1872
|
+
set_attribute_2_m(args[0],args[1])
|
1873
|
+
else
|
1874
|
+
raise ArgumentError
|
1875
|
+
end
|
1876
|
+
when THREE
|
1877
|
+
set_attribute_3(args[0],args[1],args[2])
|
1863
1878
|
else
|
1864
1879
|
raise ArgumentError
|
1865
|
-
end
|
1866
|
-
when THREE
|
1867
|
-
set_attribute_3(args[0],args[1],args[2])
|
1868
|
-
else
|
1869
|
-
raise ArgumentError
|
1870
1880
|
end
|
1871
1881
|
end
|
1872
|
-
|
1882
|
+
|
1873
1883
|
#
|
1874
1884
|
# 要素の属性を編集する
|
1875
1885
|
#
|
@@ -1882,12 +1892,12 @@ module Meteor
|
|
1882
1892
|
attr_value = escape(attr_value)
|
1883
1893
|
#属性群の更新
|
1884
1894
|
edit_attributes_(elm,attr_name,attr_value)
|
1885
|
-
|
1886
|
-
if !elm.origin then
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
end
|
1895
|
+
|
1896
|
+
#if !elm.origin then
|
1897
|
+
# if elm.arguments.map.include?(attr_name) then
|
1898
|
+
# elm.arguments.store(attr_name, attr_value)
|
1899
|
+
# end
|
1900
|
+
#end
|
1891
1901
|
end
|
1892
1902
|
elm
|
1893
1903
|
end
|
@@ -1900,7 +1910,7 @@ module Meteor
|
|
1900
1910
|
|
1901
1911
|
#検索対象属性の存在判定
|
1902
1912
|
if elm.attributes.include?(' ' << attr_name << ATTR_EQ) then
|
1903
|
-
|
1913
|
+
|
1904
1914
|
@_attr_value = attr_value
|
1905
1915
|
##replace2regex(@_attr_value)
|
1906
1916
|
#if elm.origin then
|
@@ -1910,7 +1920,7 @@ module Meteor
|
|
1910
1920
|
#end
|
1911
1921
|
#属性の置換
|
1912
1922
|
@pattern = Meteor::Core::Util::PatternCache.get('' << attr_name << SET_ATTR_1)
|
1913
|
-
|
1923
|
+
|
1914
1924
|
#elm.attributes.sub!(@pattern,'' << attr_name << ATTR_EQ << @_attr_value << DOUBLE_QUATATION)
|
1915
1925
|
elm.attributes.sub!(@pattern,"#{attr_name}=\"#{@_attr_value}\"")
|
1916
1926
|
else
|
@@ -1930,7 +1940,7 @@ module Meteor
|
|
1930
1940
|
#elm.attributes << SPACE << attr_name << ATTR_EQ << @_attr_value << DOUBLE_QUATATION
|
1931
1941
|
elm.attributes << " #{attr_name}=\"#{@_attr_value}\""
|
1932
1942
|
end
|
1933
|
-
|
1943
|
+
|
1934
1944
|
end
|
1935
1945
|
private :edit_attributes_
|
1936
1946
|
|
@@ -1958,7 +1968,7 @@ module Meteor
|
|
1958
1968
|
#elm.document = "<#{elm.name}#{@_attributes}>#{@_content}</#{elm.name}>"
|
1959
1969
|
else
|
1960
1970
|
#空要素の場合
|
1961
|
-
elm.document = '' << TAG_OPEN << elm.name << @_attributes << closer
|
1971
|
+
elm.document = '' << TAG_OPEN << elm.name << @_attributes << closer
|
1962
1972
|
end
|
1963
1973
|
else
|
1964
1974
|
@_content = elm.mixed_content
|
@@ -1979,26 +1989,26 @@ module Meteor
|
|
1979
1989
|
end
|
1980
1990
|
private :edit_document_2
|
1981
1991
|
|
1982
|
-
def edit_pattern_(elm)
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
end
|
2001
|
-
private :edit_pattern_
|
1992
|
+
#def edit_pattern_(elm)
|
1993
|
+
#
|
1994
|
+
# elm.arguments.map.each do |name, attr|
|
1995
|
+
# if attr.changed then
|
1996
|
+
# @_attr_value = escape_regex(attr.value)
|
1997
|
+
# ##replace2regex(@_attr_value)
|
1998
|
+
# #@pattern_cc = '' << name << SET_ATTR_1
|
1999
|
+
# @pattern_cc = "#{attr.name}=\"[^\"]*\""
|
2000
|
+
# @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
2001
|
+
# #elm.pattern.gsub!(@pattern,'' << name << ATTR_EQ << @_attr_value << DOUBLE_QUATATION)
|
2002
|
+
# elm.pattern.sub!(@pattern, "#{attr.name}=\"#{@_attr_value}\"")
|
2003
|
+
# elsif attr.removed then
|
2004
|
+
# @pattern_cc = '' << name << SET_ATTR_1
|
2005
|
+
# #@pattern_cc = "#{attr_name}=\"[^\"]*\""
|
2006
|
+
# @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
2007
|
+
# elm.pattern.gsub!(@pattern, EMPTY)
|
2008
|
+
# end
|
2009
|
+
# end
|
2010
|
+
#end
|
2011
|
+
#private :edit_pattern_
|
2002
2012
|
|
2003
2013
|
##
|
2004
2014
|
## 要素の属性を編集する
|
@@ -2013,7 +2023,7 @@ module Meteor
|
|
2013
2023
|
# @root.element
|
2014
2024
|
#end
|
2015
2025
|
#private :set_attribute_2
|
2016
|
-
|
2026
|
+
|
2017
2027
|
#
|
2018
2028
|
# 要素の属性値を取得する
|
2019
2029
|
#
|
@@ -2040,7 +2050,7 @@ module Meteor
|
|
2040
2050
|
end
|
2041
2051
|
end
|
2042
2052
|
private :get_attribute_value_
|
2043
|
-
|
2053
|
+
|
2044
2054
|
##
|
2045
2055
|
## 要素の属性値を取得する
|
2046
2056
|
##
|
@@ -2055,7 +2065,7 @@ module Meteor
|
|
2055
2065
|
# end
|
2056
2066
|
#end
|
2057
2067
|
#private :get_attribute_value_1
|
2058
|
-
|
2068
|
+
|
2059
2069
|
#
|
2060
2070
|
# 属性マップを取得する
|
2061
2071
|
#
|
@@ -2064,12 +2074,12 @@ module Meteor
|
|
2064
2074
|
#
|
2065
2075
|
def attribute_map(*args)
|
2066
2076
|
case args.length
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2077
|
+
when ZERO
|
2078
|
+
get_attribute_map_0
|
2079
|
+
when ONE
|
2080
|
+
get_attribute_map_1(args[0])
|
2081
|
+
else
|
2082
|
+
raise ArgumentError
|
2073
2083
|
end
|
2074
2084
|
end
|
2075
2085
|
|
@@ -2090,7 +2100,7 @@ module Meteor
|
|
2090
2100
|
attrs
|
2091
2101
|
end
|
2092
2102
|
private :get_attribute_map_1
|
2093
|
-
|
2103
|
+
|
2094
2104
|
#
|
2095
2105
|
# 要素の属性マップを取得する
|
2096
2106
|
#
|
@@ -2104,7 +2114,7 @@ module Meteor
|
|
2104
2114
|
end
|
2105
2115
|
end
|
2106
2116
|
private :get_attribute_map_0
|
2107
|
-
|
2117
|
+
|
2108
2118
|
#
|
2109
2119
|
# 要素の属性を編集する
|
2110
2120
|
#
|
@@ -2124,7 +2134,7 @@ module Meteor
|
|
2124
2134
|
elm
|
2125
2135
|
end
|
2126
2136
|
private :set_attribute_2_m
|
2127
|
-
|
2137
|
+
|
2128
2138
|
#
|
2129
2139
|
# 要素の内容をセットする or 内容を取得する
|
2130
2140
|
#
|
@@ -2133,30 +2143,30 @@ module Meteor
|
|
2133
2143
|
#
|
2134
2144
|
def content(*args)
|
2135
2145
|
case args.length
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2146
|
+
when ONE
|
2147
|
+
#if args[0].kind_of?(Meteor::Element) then
|
2148
|
+
get_content_1(args[0])
|
2139
2149
|
#elsif args[0].kind_of?(String) then
|
2140
2150
|
# set_content_1(args[0])
|
2141
2151
|
#else
|
2142
2152
|
# raise ArgumentError
|
2143
2153
|
#end
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2154
|
+
when TWO
|
2155
|
+
#if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String) then
|
2156
|
+
set_content_2_s(args[0],args[1])
|
2147
2157
|
#elsif args[0].kind_of?(String) && (args[1].eql?(true) || args[1].eql?(false)) then
|
2148
2158
|
##elsif args[0].kind_of?(String) && (args[1].kinf_of?(TrueClass) || args[1].kind_of?(FalseClass)) then
|
2149
2159
|
# set_content_2_b(args[0],args[1])
|
2150
2160
|
#else
|
2151
2161
|
# raise ArgumentError
|
2152
2162
|
#end
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2163
|
+
when THREE
|
2164
|
+
set_content_3(args[0],args[1],args[2])
|
2165
|
+
else
|
2166
|
+
raise ArgumentError
|
2157
2167
|
end
|
2158
2168
|
end
|
2159
|
-
|
2169
|
+
|
2160
2170
|
#
|
2161
2171
|
# 要素の内容をセットする
|
2162
2172
|
#
|
@@ -2168,7 +2178,7 @@ module Meteor
|
|
2168
2178
|
|
2169
2179
|
if entity_ref then
|
2170
2180
|
escape_content(content,elm.name)
|
2171
|
-
end
|
2181
|
+
end
|
2172
2182
|
elm.mixed_content = content
|
2173
2183
|
elm
|
2174
2184
|
end
|
@@ -2186,7 +2196,7 @@ module Meteor
|
|
2186
2196
|
elm
|
2187
2197
|
end
|
2188
2198
|
private :set_content_2_s
|
2189
|
-
|
2199
|
+
|
2190
2200
|
##
|
2191
2201
|
## 要素の内容を編集する
|
2192
2202
|
##
|
@@ -2198,7 +2208,7 @@ module Meteor
|
|
2198
2208
|
# end
|
2199
2209
|
#end
|
2200
2210
|
#private :set_content_1
|
2201
|
-
|
2211
|
+
|
2202
2212
|
##
|
2203
2213
|
## 要素の内容を編集する
|
2204
2214
|
##
|
@@ -2213,7 +2223,7 @@ module Meteor
|
|
2213
2223
|
# @root.element
|
2214
2224
|
#end
|
2215
2225
|
#private :set_content_2_b
|
2216
|
-
|
2226
|
+
|
2217
2227
|
def get_content_1(elm)
|
2218
2228
|
if !elm.cx then
|
2219
2229
|
if elm.empty then
|
@@ -2224,7 +2234,7 @@ module Meteor
|
|
2224
2234
|
end
|
2225
2235
|
end
|
2226
2236
|
private :get_content_1
|
2227
|
-
|
2237
|
+
|
2228
2238
|
#
|
2229
2239
|
# 要素の属性を消す
|
2230
2240
|
#
|
@@ -2232,12 +2242,12 @@ module Meteor
|
|
2232
2242
|
#
|
2233
2243
|
def remove_attribute(*args)
|
2234
2244
|
case args.length
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2245
|
+
when ONE
|
2246
|
+
remove_attribute_1(args[0])
|
2247
|
+
when TWO
|
2248
|
+
remove_attribute_2(args[0],args[1])
|
2249
|
+
else
|
2250
|
+
raise ArgumentError
|
2241
2251
|
end
|
2242
2252
|
end
|
2243
2253
|
|
@@ -2252,11 +2262,11 @@ module Meteor
|
|
2252
2262
|
|
2253
2263
|
remove_attributes_(elm,attr_name)
|
2254
2264
|
|
2255
|
-
if !elm.origin then
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
end
|
2265
|
+
#if !elm.origin then
|
2266
|
+
# if elm.arguments.map.include?(attr_name) then
|
2267
|
+
# elm.arguments.delete(attr_name)
|
2268
|
+
# end
|
2269
|
+
#end
|
2260
2270
|
end
|
2261
2271
|
|
2262
2272
|
elm
|
@@ -2270,7 +2280,7 @@ module Meteor
|
|
2270
2280
|
elm.attributes.sub!(@pattern,EMPTY)
|
2271
2281
|
end
|
2272
2282
|
private :remove_attributes_
|
2273
|
-
|
2283
|
+
|
2274
2284
|
#
|
2275
2285
|
# 要素の属性を消す
|
2276
2286
|
#
|
@@ -2284,15 +2294,15 @@ module Meteor
|
|
2284
2294
|
@root.element
|
2285
2295
|
end
|
2286
2296
|
private :remove_attribute_1
|
2287
|
-
|
2297
|
+
|
2288
2298
|
#
|
2289
2299
|
# 要素を消す
|
2290
2300
|
#
|
2291
2301
|
# @param [Meteor::Element] elm 要素
|
2292
2302
|
#
|
2293
2303
|
def remove_element(elm)
|
2294
|
-
|
2295
|
-
|
2304
|
+
replace(elm,EMPTY)
|
2305
|
+
elm.usable = false
|
2296
2306
|
end
|
2297
2307
|
|
2298
2308
|
#
|
@@ -2303,12 +2313,12 @@ module Meteor
|
|
2303
2313
|
#
|
2304
2314
|
def cxtag(*args)
|
2305
2315
|
case args.length
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2316
|
+
when ONE
|
2317
|
+
cxtag_1(args[0])
|
2318
|
+
when TWO
|
2319
|
+
cxtag_2(args[0],args[1])
|
2320
|
+
else
|
2321
|
+
raise ArgumentError
|
2312
2322
|
end
|
2313
2323
|
end
|
2314
2324
|
|
@@ -2398,9 +2408,9 @@ module Meteor
|
|
2398
2408
|
end
|
2399
2409
|
private :replace
|
2400
2410
|
|
2401
|
-
def reflect
|
2402
|
-
#puts @
|
2403
|
-
@
|
2411
|
+
def reflect
|
2412
|
+
#puts @element_cache.size.to_s
|
2413
|
+
@element_cache.values.each do |item|
|
2404
2414
|
if item.usable then
|
2405
2415
|
#puts "#{item.name}:#{item.document}"
|
2406
2416
|
#if item.name == EMPTY then
|
@@ -2409,42 +2419,26 @@ module Meteor
|
|
2409
2419
|
@pattern = Meteor::Core::Util::PatternCache.get(item.pattern)
|
2410
2420
|
@root.document.sub!(@pattern,item.copy.parser.root_element.hook_document)
|
2411
2421
|
#@root.document.sub!(@pattern,item.document)
|
2422
|
+
#item.copy.parser.element_cache.clear
|
2412
2423
|
item.copy = nil
|
2413
2424
|
else
|
2414
2425
|
edit_document_1(item)
|
2415
|
-
edit_pattern_(item)
|
2426
|
+
#edit_pattern_(item)
|
2416
2427
|
end
|
2417
2428
|
item.usable = false
|
2418
2429
|
end
|
2419
2430
|
end
|
2420
2431
|
end
|
2421
2432
|
protected :reflect
|
2422
|
-
|
2433
|
+
|
2423
2434
|
#
|
2424
2435
|
# 出力する
|
2425
2436
|
#
|
2426
2437
|
def flush
|
2427
|
-
reflect
|
2428
2438
|
|
2429
2439
|
#puts @root.document
|
2430
|
-
if @root.element then
|
2431
|
-
if
|
2432
|
-
@_attributes = @root.element.attributes
|
2433
|
-
#replace2regex(@_attributes)
|
2434
|
-
if @root.element.origin.cx then
|
2435
|
-
#@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
|
2436
|
-
#@root.hookDocument << @_attributes << SET_CX_2
|
2437
|
-
#@root.hookDocument << @root.document << SET_CX_3
|
2438
|
-
#@root.hookDocument << @root.element.name << SET_CX_4
|
2439
|
-
@root.hook_document << "<!-- @#{@root.element.name} #{@_attributes}-->#{@root.document}<!-- /@#{@root.element.name} -->"
|
2440
|
-
else
|
2441
|
-
#@root.hookDocument << TAG_OPEN << @root.element.name
|
2442
|
-
#@root.hookDocument << @_attributes << TAG_CLOSE << @root.document
|
2443
|
-
#@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
|
2444
|
-
@root.hook_document << "<#{@root.element.name}#{@_attributes}>#{@root.document}</#{@root.element.name}>"
|
2445
|
-
end
|
2446
|
-
@root.element = Element.new!(@root.element.origin,self)
|
2447
|
-
else
|
2440
|
+
if @root.element then
|
2441
|
+
if @root.element.origin.mono then
|
2448
2442
|
if @root.element.origin.cx then
|
2449
2443
|
#@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
|
2450
2444
|
#@root.hookDocument << @root.element.attributes << SET_CX_2
|
@@ -2462,15 +2456,34 @@ module Meteor
|
|
2462
2456
|
#@root.hook_document << @root.document
|
2463
2457
|
@root.element = Element.new!(@root.element.origin,self)
|
2464
2458
|
#@root.document = String.new(@root.element.document)
|
2459
|
+
else
|
2460
|
+
reflect
|
2461
|
+
@_attributes = @root.element.attributes
|
2462
|
+
#replace2regex(@_attributes)
|
2463
|
+
if @root.element.origin.cx then
|
2464
|
+
#@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
|
2465
|
+
#@root.hookDocument << @_attributes << SET_CX_2
|
2466
|
+
#@root.hookDocument << @root.document << SET_CX_3
|
2467
|
+
#@root.hookDocument << @root.element.name << SET_CX_4
|
2468
|
+
@root.hook_document << "<!-- @#{@root.element.name} #{@_attributes}-->#{@root.document}<!-- /@#{@root.element.name} -->"
|
2469
|
+
else
|
2470
|
+
#@root.hookDocument << TAG_OPEN << @root.element.name
|
2471
|
+
#@root.hookDocument << @_attributes << TAG_CLOSE << @root.document
|
2472
|
+
#@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
|
2473
|
+
@root.hook_document << "<#{@root.element.name}#{@_attributes}>#{@root.document}</#{@root.element.name}>"
|
2474
|
+
end
|
2475
|
+
@root.element = Element.new!(@root.element.origin,self)
|
2465
2476
|
end
|
2466
2477
|
#@root.element.origin.document = @root.hook_document
|
2467
2478
|
#@root.element.origin.name = EMPTY
|
2468
2479
|
else
|
2480
|
+
reflect
|
2481
|
+
@element_cache.clear
|
2469
2482
|
#フック判定がFALSEの場合
|
2470
2483
|
clean
|
2471
2484
|
end
|
2472
2485
|
end
|
2473
|
-
|
2486
|
+
|
2474
2487
|
def clean
|
2475
2488
|
#CX開始タグ置換
|
2476
2489
|
@pattern = @@pattern_clean1
|
@@ -2481,7 +2494,7 @@ module Meteor
|
|
2481
2494
|
#@root.document << "<!-- Powered by Meteor (C)Yasumasa Ashida -->"
|
2482
2495
|
end
|
2483
2496
|
private :clean
|
2484
|
-
|
2497
|
+
|
2485
2498
|
#
|
2486
2499
|
# 要素をコピーする
|
2487
2500
|
#
|
@@ -2492,9 +2505,9 @@ module Meteor
|
|
2492
2505
|
if elm.empty then
|
2493
2506
|
#内容あり要素の場合
|
2494
2507
|
set_mono_info(elm)
|
2495
|
-
|
2508
|
+
|
2496
2509
|
pif2 = create(self)
|
2497
|
-
|
2510
|
+
|
2498
2511
|
@elm_ = Element.new!(elm,pif2)
|
2499
2512
|
|
2500
2513
|
if !elm.mono then
|
@@ -2502,41 +2515,41 @@ module Meteor
|
|
2502
2515
|
else
|
2503
2516
|
pif2.root_element.document = String.new(elm.document)
|
2504
2517
|
end
|
2505
|
-
|
2518
|
+
|
2506
2519
|
@elm_
|
2507
2520
|
end
|
2508
2521
|
end
|
2509
|
-
private :shadow
|
2510
|
-
|
2522
|
+
private :shadow
|
2523
|
+
|
2511
2524
|
def set_mono_info(elm)
|
2512
2525
|
end
|
2513
|
-
private :set_mono_info
|
2514
|
-
|
2526
|
+
private :set_mono_info
|
2527
|
+
|
2515
2528
|
#
|
2516
2529
|
# フッククラスの処理を実行する
|
2517
2530
|
# @param [Array] args 引数配列
|
2518
2531
|
#
|
2519
2532
|
def execute(*args)
|
2520
2533
|
case args.length
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2534
|
+
when TWO
|
2535
|
+
execute_2(args[0],args[1])
|
2536
|
+
when THREE
|
2537
|
+
execute_3(args[0],args[1],args[2])
|
2538
|
+
else
|
2539
|
+
raise ArgumentError
|
2527
2540
|
end
|
2528
2541
|
end
|
2529
|
-
|
2542
|
+
|
2530
2543
|
def execute_2(elm,hook)
|
2531
2544
|
hook.do_action(elm)
|
2532
2545
|
end
|
2533
2546
|
private :execute_2
|
2534
|
-
|
2547
|
+
|
2535
2548
|
def execute_3(elm,loop,list)
|
2536
2549
|
loop.do_action(elm,list)
|
2537
2550
|
end
|
2538
2551
|
private :execute_3
|
2539
|
-
|
2552
|
+
|
2540
2553
|
#
|
2541
2554
|
# 正規表現対象文字を置換する
|
2542
2555
|
#
|
@@ -2547,7 +2560,7 @@ module Meteor
|
|
2547
2560
|
Regexp.quote(str)
|
2548
2561
|
end
|
2549
2562
|
private :escape_regex
|
2550
|
-
|
2563
|
+
|
2551
2564
|
#def replace2regex(str)
|
2552
2565
|
# #if str.include?(EN_1) then
|
2553
2566
|
# # str.gsub!(@@pattern_sub_regex1,SUB_REGEX2)
|
@@ -2561,7 +2574,7 @@ module Meteor
|
|
2561
2574
|
# #end
|
2562
2575
|
#end
|
2563
2576
|
#private :replace4regex
|
2564
|
-
|
2577
|
+
|
2565
2578
|
#
|
2566
2579
|
# @param [String] content 入力文字列
|
2567
2580
|
# @return [String] 出力文字列
|
@@ -2660,7 +2673,7 @@ module Meteor
|
|
2660
2673
|
|
2661
2674
|
end
|
2662
2675
|
private :create
|
2663
|
-
|
2676
|
+
|
2664
2677
|
end
|
2665
2678
|
|
2666
2679
|
module Util
|
@@ -2845,7 +2858,7 @@ module Meteor
|
|
2845
2858
|
MATCH_TAG = ['br','hr','img','input','meta','base']
|
2846
2859
|
#MATCH_TAG_2 = "textarea|option|pre"
|
2847
2860
|
MATCH_TAG_2 =['textarea','option','pre']
|
2848
|
-
|
2861
|
+
|
2849
2862
|
HTTP_EQUIV = 'http-equiv'
|
2850
2863
|
CONTENT_TYPE = 'Content-Type'
|
2851
2864
|
CONTENT = 'content'
|
@@ -2911,35 +2924,35 @@ module Meteor
|
|
2911
2924
|
|
2912
2925
|
#@@pattern_true = Regexp.new(TRUE)
|
2913
2926
|
#@@pattern_false = Regexp.new(FALSE)
|
2914
|
-
|
2927
|
+
|
2915
2928
|
TYPE_L = 'type'
|
2916
2929
|
TYPE_U = 'TYPE'
|
2917
|
-
|
2930
|
+
|
2918
2931
|
if RUBY_VERSION >= RUBY_VERSION_1_9_0 then
|
2919
2932
|
TABLE_FOR_ESCAPE_ = {
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2933
|
+
'&' => '&',
|
2934
|
+
'"' => '"',
|
2935
|
+
'\'' => ''',
|
2936
|
+
'<' => '<',
|
2937
|
+
'>' => '>',
|
2938
|
+
' ' => ' ',
|
2939
|
+
}
|
2940
|
+
|
2928
2941
|
TABLE_FOR_ESCAPE_CONTENT_ = {
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2942
|
+
'&' => '&',
|
2943
|
+
'"' => '"',
|
2944
|
+
'\'' => ''',
|
2945
|
+
'<' => '<',
|
2946
|
+
'>' => '>',
|
2947
|
+
' ' => ' ',
|
2948
|
+
"\n" => '<br>',
|
2949
|
+
}
|
2950
|
+
|
2938
2951
|
PATTERN_ESCAPE = "[&\"'<> ]"
|
2939
2952
|
PATTERN_ESCAPE_CONTENT = "[&\"'<> \\n]"
|
2940
|
-
|
2953
|
+
|
2941
2954
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
2942
|
-
@@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
|
2955
|
+
@@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
|
2943
2956
|
else
|
2944
2957
|
@@pattern_and_1 = Regexp.new(AND_1)
|
2945
2958
|
@@pattern_lt_1 = Regexp.new(LT_1)
|
@@ -2954,18 +2967,18 @@ module Meteor
|
|
2954
2967
|
@@pattern_and_2 = Regexp.new(AND_2)
|
2955
2968
|
@@pattern_br_2 = Regexp.new(BR_2)
|
2956
2969
|
end
|
2957
|
-
|
2958
|
-
|
2970
|
+
|
2971
|
+
|
2959
2972
|
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt|nbsp);'
|
2960
2973
|
@@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
|
2961
|
-
|
2974
|
+
|
2962
2975
|
#@@pattern_match_tag = Regexp.new(MATCH_TAG)
|
2963
2976
|
@@pattern_set_mono1 = Regexp.new(SET_MONO_1)
|
2964
2977
|
#@@pattern_match_tag2 = Regexp.new(MATCH_TAG_2)
|
2965
2978
|
|
2966
2979
|
GET_ATTRS_MAP2='\\s(disabled|readonly|checked|selected|multiple)'
|
2967
2980
|
@@pattern_get_attrs_map2 = Regexp.new(GET_ATTRS_MAP2)
|
2968
|
-
|
2981
|
+
|
2969
2982
|
#
|
2970
2983
|
# イニシャライザ
|
2971
2984
|
#
|
@@ -2974,12 +2987,12 @@ module Meteor
|
|
2974
2987
|
def initialize(*args)
|
2975
2988
|
super(args)
|
2976
2989
|
case args.length
|
2977
|
-
|
2978
|
-
|
2979
|
-
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2990
|
+
when ZERO
|
2991
|
+
initialize_0
|
2992
|
+
when ONE
|
2993
|
+
initialize_1(args[0])
|
2994
|
+
else
|
2995
|
+
raise ArgumentError
|
2983
2996
|
end
|
2984
2997
|
end
|
2985
2998
|
|
@@ -3124,9 +3137,9 @@ module Meteor
|
|
3124
3137
|
@elm_.attributes = @res[1]
|
3125
3138
|
#空要素検索用パターン
|
3126
3139
|
@elm_.pattern = @pattern_cc
|
3127
|
-
|
3140
|
+
|
3128
3141
|
@elm_.document = @res[0]
|
3129
|
-
|
3142
|
+
|
3130
3143
|
@elm_.parser = self
|
3131
3144
|
end
|
3132
3145
|
private :element_without_1
|
@@ -3169,11 +3182,11 @@ module Meteor
|
|
3169
3182
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
3170
3183
|
#内容あり要素検索
|
3171
3184
|
@res = @pattern.match(@root.document)
|
3172
|
-
|
3185
|
+
|
3173
3186
|
if !@res then
|
3174
3187
|
@res = element_with_3_2(elm_name)
|
3175
3188
|
end
|
3176
|
-
|
3189
|
+
|
3177
3190
|
if @res then
|
3178
3191
|
element_with_3_1(elm_name)
|
3179
3192
|
else
|
@@ -3181,11 +3194,11 @@ module Meteor
|
|
3181
3194
|
end
|
3182
3195
|
end
|
3183
3196
|
|
3184
|
-
if @elm_ then
|
3185
|
-
|
3186
|
-
|
3187
|
-
end
|
3188
|
-
|
3197
|
+
#if @elm_ then
|
3198
|
+
# @elm_.arguments.store(attr_name, attr_value)
|
3199
|
+
# @elm_.arguments.recordable = true
|
3200
|
+
#end
|
3201
|
+
|
3189
3202
|
@elm_
|
3190
3203
|
end
|
3191
3204
|
private :element_3
|
@@ -3254,7 +3267,7 @@ module Meteor
|
|
3254
3267
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
3255
3268
|
#空要素検索
|
3256
3269
|
@res = @pattern.match(@root.document)
|
3257
|
-
|
3270
|
+
|
3258
3271
|
if @res then
|
3259
3272
|
element_without_5(elm_name)
|
3260
3273
|
else
|
@@ -3273,11 +3286,11 @@ module Meteor
|
|
3273
3286
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
3274
3287
|
#内容あり要素検索
|
3275
3288
|
@res = @pattern.match(@root.document)
|
3276
|
-
|
3289
|
+
|
3277
3290
|
if !@res then
|
3278
3291
|
@res = element_with_5_2(elm_name)
|
3279
3292
|
end
|
3280
|
-
|
3293
|
+
|
3281
3294
|
if @res then
|
3282
3295
|
element_with_5_1(elm_name)
|
3283
3296
|
else
|
@@ -3285,16 +3298,16 @@ module Meteor
|
|
3285
3298
|
end
|
3286
3299
|
end
|
3287
3300
|
|
3288
|
-
if @elm_ then
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
end
|
3293
|
-
|
3301
|
+
#if @elm_ then
|
3302
|
+
# @elm_.arguments.store(attr_name1, attr_value1)
|
3303
|
+
# @elm_.arguments.store(attr_name2, attr_value2)
|
3304
|
+
# @elm_.arguments.recordable = true
|
3305
|
+
#end
|
3306
|
+
|
3294
3307
|
@elm_
|
3295
3308
|
end
|
3296
3309
|
private :element_5
|
3297
|
-
|
3310
|
+
|
3298
3311
|
def element_without_5(elm_name)
|
3299
3312
|
element_without_5_1(elm_name,TAG_SEARCH_NC_2_4_3_2)
|
3300
3313
|
end
|
@@ -3416,9 +3429,9 @@ module Meteor
|
|
3416
3429
|
elm.type_value
|
3417
3430
|
end
|
3418
3431
|
private :get_type
|
3419
|
-
|
3432
|
+
|
3420
3433
|
def get_attribute_value_2_r(elm,match_p)
|
3421
|
-
|
3434
|
+
|
3422
3435
|
@res = match_p.match(elm.attributes)
|
3423
3436
|
|
3424
3437
|
if @res then
|
@@ -3428,7 +3441,7 @@ module Meteor
|
|
3428
3441
|
end
|
3429
3442
|
end
|
3430
3443
|
private :get_attribute_value_2_r
|
3431
|
-
|
3444
|
+
|
3432
3445
|
#
|
3433
3446
|
# 要素の属性マップを取得する
|
3434
3447
|
#
|
@@ -3437,17 +3450,17 @@ module Meteor
|
|
3437
3450
|
#
|
3438
3451
|
def get_attribute_map_1(elm)
|
3439
3452
|
attrs = Meteor::AttributeMap.new
|
3440
|
-
|
3453
|
+
|
3441
3454
|
elm.attributes.scan(@@pattern_get_attrs_map) do |a, b|
|
3442
3455
|
attrs.store(a, unescape(b))
|
3443
3456
|
end
|
3444
|
-
|
3457
|
+
|
3445
3458
|
elm.attributes.scan(@@pattern_get_attrs_map2) do |a|
|
3446
3459
|
attrs.store(a, TRUE)
|
3447
3460
|
end
|
3448
|
-
|
3461
|
+
|
3449
3462
|
attrs.recordable = true
|
3450
|
-
|
3463
|
+
|
3451
3464
|
attrs
|
3452
3465
|
end
|
3453
3466
|
private :get_attribute_map_1
|
@@ -3460,7 +3473,7 @@ module Meteor
|
|
3460
3473
|
elm.attributes.sub!(@pattern, EMPTY)
|
3461
3474
|
else
|
3462
3475
|
#属性検索用パターン
|
3463
|
-
@pattern = Meteor::Core::Util::PatternCache.get(attr_name)
|
3476
|
+
@pattern = Meteor::Core::Util::PatternCache.get(attr_name)
|
3464
3477
|
elm.attributes.sub!(@pattern, EMPTY)
|
3465
3478
|
#end
|
3466
3479
|
end
|
@@ -3522,7 +3535,7 @@ module Meteor
|
|
3522
3535
|
def escape_content(content,elm_name)
|
3523
3536
|
if RUBY_VERSION < RUBY_VERSION_1_9_0 then
|
3524
3537
|
content = escape(content)
|
3525
|
-
|
3538
|
+
|
3526
3539
|
if !is_match(MATCH_TAG_2,elm_name) then
|
3527
3540
|
#「¥r?¥n」->「<br>」
|
3528
3541
|
content.gsub!(@@pattern_br_1, BR_2)
|
@@ -3530,7 +3543,7 @@ module Meteor
|
|
3530
3543
|
else
|
3531
3544
|
content.gsub!(@@pattern_escape_content, TABLE_FOR_ESCAPE_CONTENT_)
|
3532
3545
|
end
|
3533
|
-
|
3546
|
+
|
3534
3547
|
content
|
3535
3548
|
end
|
3536
3549
|
private :escape_content
|
@@ -3559,21 +3572,21 @@ module Meteor
|
|
3559
3572
|
#end
|
3560
3573
|
content.gsub!(@@pattern_unescape) do
|
3561
3574
|
case $1
|
3562
|
-
|
3563
|
-
|
3564
|
-
|
3565
|
-
|
3566
|
-
|
3567
|
-
|
3568
|
-
|
3569
|
-
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3573
|
-
|
3575
|
+
when AND_3 then
|
3576
|
+
AND_1
|
3577
|
+
when QO_3 then
|
3578
|
+
DOUBLE_QUATATION
|
3579
|
+
when AP_3 then
|
3580
|
+
AP_1
|
3581
|
+
when GT_3 then
|
3582
|
+
GT_1
|
3583
|
+
when LT_3 then
|
3584
|
+
LT_1
|
3585
|
+
when NBSP_3 then
|
3586
|
+
SPACE
|
3574
3587
|
end
|
3575
3588
|
end
|
3576
|
-
|
3589
|
+
|
3577
3590
|
content
|
3578
3591
|
end
|
3579
3592
|
private :unescape
|
@@ -3614,7 +3627,7 @@ module Meteor
|
|
3614
3627
|
|
3615
3628
|
#MATCH_TAG_2 = "textarea|option|pre"
|
3616
3629
|
MATCH_TAG_2 = ['textarea','option','pre']
|
3617
|
-
|
3630
|
+
|
3618
3631
|
ATTR_LOGIC = ['disabled','readonly','checked','selected','multiple']
|
3619
3632
|
OPTION = 'option'
|
3620
3633
|
SELECTED = 'selected'
|
@@ -3643,7 +3656,7 @@ module Meteor
|
|
3643
3656
|
#@@pattern_readonly = Regexp.new(READONLY)
|
3644
3657
|
#@@pattern_select = Regexp.new(SELECT)
|
3645
3658
|
#@@pattern_multiple = Regexp.new(MULTIPLE)
|
3646
|
-
|
3659
|
+
|
3647
3660
|
SELECTED_M = '\\sselected="[^"]*"\\s|\\sselected="[^"]*"$'
|
3648
3661
|
SELECTED_M1 = '\\sselected="([^"]*)"\\s|\\sselected="([^"]*)"$'
|
3649
3662
|
SELECTED_R = 'selected="[^"]*"'
|
@@ -3693,31 +3706,31 @@ module Meteor
|
|
3693
3706
|
|
3694
3707
|
if RUBY_VERSION >= RUBY_VERSION_1_9_0 then
|
3695
3708
|
TABLE_FOR_ESCAPE_ = {
|
3696
|
-
|
3697
|
-
|
3698
|
-
|
3699
|
-
|
3700
|
-
|
3701
|
-
|
3702
|
-
|
3703
|
-
|
3709
|
+
'&' => '&',
|
3710
|
+
'"' => '"',
|
3711
|
+
'\'' => ''',
|
3712
|
+
'<' => '<',
|
3713
|
+
'>' => '>',
|
3714
|
+
' ' => ' ',
|
3715
|
+
}
|
3716
|
+
|
3704
3717
|
TABLE_FOR_ESCAPE_CONTENT_ = {
|
3705
|
-
|
3706
|
-
|
3707
|
-
|
3708
|
-
|
3709
|
-
|
3710
|
-
|
3711
|
-
|
3712
|
-
|
3713
|
-
|
3718
|
+
'&' => '&',
|
3719
|
+
'"' => '"',
|
3720
|
+
'\'' => ''',
|
3721
|
+
'<' => '<',
|
3722
|
+
'>' => '>',
|
3723
|
+
' ' => ' ',
|
3724
|
+
"\n" => '<br/>',
|
3725
|
+
}
|
3726
|
+
|
3714
3727
|
PATTERN_ESCAPE = '[&"\'<> ]'
|
3715
3728
|
PATTERN_ESCAPE_CONTENT = '[&"\'<> \\n]'
|
3716
3729
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
3717
3730
|
@@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
|
3718
|
-
|
3731
|
+
|
3719
3732
|
else
|
3720
|
-
|
3733
|
+
|
3721
3734
|
@@pattern_and_1 = Regexp.new(AND_1)
|
3722
3735
|
@@pattern_lt_1 = Regexp.new(LT_1)
|
3723
3736
|
@@pattern_gt_1 = Regexp.new(GT_1)
|
@@ -3732,12 +3745,12 @@ module Meteor
|
|
3732
3745
|
@@pattern_space_2 = Regexp.new(NBSP_2)
|
3733
3746
|
@@pattern_and_2 = Regexp.new(AND_2)
|
3734
3747
|
@@pattern_br_2 = Regexp.new(BR_3)
|
3735
|
-
|
3748
|
+
|
3736
3749
|
end
|
3737
|
-
|
3750
|
+
|
3738
3751
|
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt|nbsp);'
|
3739
3752
|
@@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
|
3740
|
-
|
3753
|
+
|
3741
3754
|
#@@pattern_match_tag = Regexp.new(MATCH_TAG)
|
3742
3755
|
@@pattern_set_mono1 = Regexp.new(SET_MONO_1)
|
3743
3756
|
#@@pattern_match_tag2 = Regexp.new(MATCH_TAG_2)
|
@@ -3749,12 +3762,12 @@ module Meteor
|
|
3749
3762
|
def initialize(*args)
|
3750
3763
|
super(args)
|
3751
3764
|
case args.length
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
|
3756
|
-
|
3757
|
-
|
3765
|
+
when ZERO
|
3766
|
+
initialize_0
|
3767
|
+
when ONE
|
3768
|
+
initialize_1(args[0])
|
3769
|
+
else
|
3770
|
+
raise ArgumentError
|
3758
3771
|
end
|
3759
3772
|
end
|
3760
3773
|
|
@@ -3824,11 +3837,11 @@ module Meteor
|
|
3824
3837
|
#
|
3825
3838
|
def analyze_content_type
|
3826
3839
|
element(META_S,HTTP_EQUIV,CONTENT_TYPE)
|
3827
|
-
|
3840
|
+
|
3828
3841
|
if !@elm_ then
|
3829
3842
|
element(META,HTTP_EQUIV,CONTENT_TYPE)
|
3830
3843
|
end
|
3831
|
-
|
3844
|
+
|
3832
3845
|
if @elm_ then
|
3833
3846
|
@root.content_type = @elm_.attribute(CONTENT)
|
3834
3847
|
else
|
@@ -3894,10 +3907,10 @@ module Meteor
|
|
3894
3907
|
#属性の置換
|
3895
3908
|
elm.attributes.gsub!(replace_regex, EMPTY)
|
3896
3909
|
end
|
3897
|
-
|
3910
|
+
|
3898
3911
|
end
|
3899
3912
|
private :edit_attributes_5
|
3900
|
-
|
3913
|
+
|
3901
3914
|
def get_attribute_value_(elm,attr_name)
|
3902
3915
|
if is_match(SELECTED, attr_name) && is_match(OPTION,elm.name) then
|
3903
3916
|
get_attribute_value_2_r(elm,attr_name,@@pattern_selected_m1)
|
@@ -3925,9 +3938,9 @@ module Meteor
|
|
3925
3938
|
elm.type_value
|
3926
3939
|
end
|
3927
3940
|
private :get_type
|
3928
|
-
|
3941
|
+
|
3929
3942
|
def get_attribute_value_2_r(elm,attr_name,match_p)
|
3930
|
-
|
3943
|
+
|
3931
3944
|
@res = match_p.match(elm.attributes)
|
3932
3945
|
|
3933
3946
|
if @res then
|
@@ -3961,7 +3974,7 @@ module Meteor
|
|
3961
3974
|
end
|
3962
3975
|
end
|
3963
3976
|
private :get_attribute_value_2_r
|
3964
|
-
|
3977
|
+
|
3965
3978
|
#
|
3966
3979
|
# 属性マップを取得する
|
3967
3980
|
#
|
@@ -3970,7 +3983,7 @@ module Meteor
|
|
3970
3983
|
#
|
3971
3984
|
def get_attribute_map_1(elm)
|
3972
3985
|
attrs = Meteor::AttributeMap.new
|
3973
|
-
|
3986
|
+
|
3974
3987
|
elm.attributes.scan(@@pattern_get_attrs_map) do |a, b|
|
3975
3988
|
if is_match(ATTR_LOGIC, a) && a==b then
|
3976
3989
|
attrs.store(a, TRUE)
|
@@ -3979,11 +3992,11 @@ module Meteor
|
|
3979
3992
|
end
|
3980
3993
|
end
|
3981
3994
|
attrs.recordable = true
|
3982
|
-
|
3995
|
+
|
3983
3996
|
attrs
|
3984
3997
|
end
|
3985
3998
|
private :get_attribute_map_1
|
3986
|
-
|
3999
|
+
|
3987
4000
|
def set_mono_info(elm)
|
3988
4001
|
|
3989
4002
|
@res = @@pattern_set_mono1.match(elm.mixed_content)
|
@@ -4025,7 +4038,7 @@ module Meteor
|
|
4025
4038
|
if content.include?(DOUBLE_QUATATION) then
|
4026
4039
|
content.gsub!(@@pattern_dq_1,QO_2)
|
4027
4040
|
end
|
4028
|
-
|
4041
|
+
#「'」->「'」
|
4029
4042
|
if content.include?(AP_1) then
|
4030
4043
|
content.gsub!(@@pattern_ap_1,AP_2)
|
4031
4044
|
end
|
@@ -4036,16 +4049,16 @@ module Meteor
|
|
4036
4049
|
else
|
4037
4050
|
content.gsub!(@@pattern_escape,TABLE_FOR_ESCAPE_)
|
4038
4051
|
end
|
4039
|
-
|
4052
|
+
|
4040
4053
|
content
|
4041
4054
|
end
|
4042
4055
|
private :escape
|
4043
4056
|
|
4044
4057
|
def escape_content(content,elm_name)
|
4045
|
-
|
4058
|
+
|
4046
4059
|
if RUBY_VERSION < RUBY_VERSION_1_9_0 then
|
4047
4060
|
content = escape(content)
|
4048
|
-
|
4061
|
+
|
4049
4062
|
if !is_match(MATCH_TAG_2,elm_name) then
|
4050
4063
|
#「¥r?¥n」->「<br>」
|
4051
4064
|
content.gsub!(@@pattern_br_1, BR_2)
|
@@ -4081,21 +4094,21 @@ module Meteor
|
|
4081
4094
|
#end
|
4082
4095
|
content.gsub!(@@pattern_unescape) do
|
4083
4096
|
case $1
|
4084
|
-
|
4085
|
-
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4089
|
-
|
4090
|
-
|
4091
|
-
|
4092
|
-
|
4093
|
-
|
4094
|
-
|
4095
|
-
|
4097
|
+
when AND_3 then
|
4098
|
+
AND_1
|
4099
|
+
when QO_3 then
|
4100
|
+
DOUBLE_QUATATION
|
4101
|
+
when AP_3 then
|
4102
|
+
AP_1
|
4103
|
+
when GT_3 then
|
4104
|
+
GT_1
|
4105
|
+
when LT_3 then
|
4106
|
+
LT_1
|
4107
|
+
when NBSP_3 then
|
4108
|
+
SPACE
|
4096
4109
|
end
|
4097
4110
|
end
|
4098
|
-
|
4111
|
+
|
4099
4112
|
content
|
4100
4113
|
end
|
4101
4114
|
private :unescape
|
@@ -4122,7 +4135,7 @@ module Meteor
|
|
4122
4135
|
#
|
4123
4136
|
# XMLパーサ
|
4124
4137
|
#
|
4125
|
-
class ParserImpl < Meteor::Core::Kernel
|
4138
|
+
class ParserImpl < Meteor::Core::Kernel
|
4126
4139
|
|
4127
4140
|
if RUBY_VERSION >= RUBY_VERSION_1_9_0 then
|
4128
4141
|
TABLE_FOR_ESCAPE_ = {
|
@@ -4131,7 +4144,7 @@ module Meteor
|
|
4131
4144
|
'\'' => ''',
|
4132
4145
|
'<' => '<',
|
4133
4146
|
'>' => '>',
|
4134
|
-
}
|
4147
|
+
}
|
4135
4148
|
PATTERN_ESCAPE = '[&\"\'<>]'
|
4136
4149
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
4137
4150
|
else
|
@@ -4151,7 +4164,7 @@ module Meteor
|
|
4151
4164
|
|
4152
4165
|
PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt);'
|
4153
4166
|
@@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
|
4154
|
-
|
4167
|
+
|
4155
4168
|
@@pattern_set_mono1 = Regexp.new(SET_MONO_1)
|
4156
4169
|
|
4157
4170
|
#
|
@@ -4163,12 +4176,12 @@ module Meteor
|
|
4163
4176
|
super(args)
|
4164
4177
|
|
4165
4178
|
case args.length
|
4166
|
-
|
4167
|
-
|
4168
|
-
|
4169
|
-
|
4170
|
-
|
4171
|
-
|
4179
|
+
when ZERO
|
4180
|
+
initialize_0
|
4181
|
+
when ONE
|
4182
|
+
initialize_1(args[0])
|
4183
|
+
else
|
4184
|
+
raise ArgumentError
|
4172
4185
|
end
|
4173
4186
|
end
|
4174
4187
|
|
@@ -4177,8 +4190,8 @@ module Meteor
|
|
4177
4190
|
#
|
4178
4191
|
def initialize_0
|
4179
4192
|
end
|
4180
|
-
|
4181
|
-
|
4193
|
+
private :initialize_0
|
4194
|
+
|
4182
4195
|
#
|
4183
4196
|
# イニシャライザ
|
4184
4197
|
#
|
@@ -4208,7 +4221,7 @@ module Meteor
|
|
4208
4221
|
def read(file_path,encoding)
|
4209
4222
|
super(file_path, encoding)
|
4210
4223
|
end
|
4211
|
-
|
4224
|
+
|
4212
4225
|
# コンテントタイプを取得する
|
4213
4226
|
#
|
4214
4227
|
# @return [Streing]コンテントタイプ
|
@@ -4216,7 +4229,7 @@ module Meteor
|
|
4216
4229
|
def content_type()
|
4217
4230
|
@root.content_type
|
4218
4231
|
end
|
4219
|
-
|
4232
|
+
|
4220
4233
|
def set_mono_info(elm)
|
4221
4234
|
|
4222
4235
|
@res = @@pattern_set_mono1.match(elm.mixed_content)
|
@@ -4301,20 +4314,20 @@ module Meteor
|
|
4301
4314
|
#else
|
4302
4315
|
content.gsub!(@@pattern_unescape) do
|
4303
4316
|
case $1
|
4304
|
-
|
4305
|
-
|
4306
|
-
|
4307
|
-
|
4308
|
-
|
4309
|
-
|
4310
|
-
|
4311
|
-
|
4312
|
-
|
4313
|
-
|
4317
|
+
when AND_3 then
|
4318
|
+
AND_1
|
4319
|
+
when QO_3 then
|
4320
|
+
DOUBLE_QUATATION
|
4321
|
+
when AP_3 then
|
4322
|
+
AP_1
|
4323
|
+
when GT_3 then
|
4324
|
+
GT_1
|
4325
|
+
when LT_3 then
|
4326
|
+
LT_1
|
4314
4327
|
end
|
4315
4328
|
end
|
4316
4329
|
#end
|
4317
|
-
|
4330
|
+
|
4318
4331
|
content
|
4319
4332
|
end
|
4320
4333
|
private :unescape
|