asip-meteor 0.9.1.8 → 0.9.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/meteor.rb +137 -230
  2. metadata +2 -2
data/lib/meteor.rb CHANGED
@@ -18,7 +18,7 @@
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.1.8
21
+ # @version 0.9.1.9
22
22
  #
23
23
 
24
24
 
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  module Meteor
33
33
 
34
- VERSION = "0.9.1.8"
34
+ VERSION = "0.9.1.9"
35
35
 
36
36
  ZERO = 0
37
37
  ONE = 1
@@ -84,8 +84,7 @@ module Meteor
84
84
  #@mono = false
85
85
  #@parent = false
86
86
  @arguments = AttributeMap.new
87
- #@origin = self.object_id
88
- @usable = ZERO
87
+ @usable = true
89
88
  end
90
89
  private :initialize_s
91
90
 
@@ -102,17 +101,15 @@ module Meteor
102
101
  @empty = elm.empty
103
102
  @cx = elm.cx
104
103
  @mono = elm.mono
105
- @parent = elm.parent
106
104
  @parser = elm.parser
107
105
  @arguments = AttributeMap.new(elm.arguments)
108
- #@origin = elm.object_id
109
- @usable = ZERO
106
+ @usable = true
107
+ @origin = elm
110
108
  elm.parser.e_cache.store(elm.object_id,self)
111
109
  end
112
110
  private :initialize_e
113
111
 
114
112
  def self.new!(elm)
115
- #@obj = elm.parser.e_cache[elm.origin]
116
113
  @obj = elm.parser.e_cache[elm.object_id]
117
114
  if @obj then
118
115
  @obj.attributes = String.new(elm.attributes)
@@ -120,11 +117,10 @@ module Meteor
120
117
  @obj.pattern = String.new(elm.pattern)
121
118
  @obj.document = String.new(elm.document)
122
119
  @obj.arguments = AttributeMap.new(elm.arguments)
123
- @obj.usable = ZERO
120
+ @obj.usable = true
124
121
  @obj
125
122
  else
126
123
  @obj = self.new(elm)
127
- #elm.parser.e_cache.store(elm.origin,@obj)
128
124
  @obj
129
125
  end
130
126
 
@@ -138,13 +134,31 @@ module Meteor
138
134
  attr_accessor :empty
139
135
  attr_accessor :cx
140
136
  attr_accessor :mono
141
- attr_accessor :parent
142
137
  attr_accessor :parser
143
138
  attr_accessor :type_value
144
139
  attr_accessor :arguments
145
140
  attr_accessor :usable
146
- #attr_accessor :origin
147
-
141
+ attr_accessor :origin
142
+
143
+ #
144
+ # 子要素を取得する
145
+ #
146
+ # @param [Array] args 引数配列
147
+ # @return [Element] 子要素
148
+ #
149
+ def child(*args)
150
+ @parser.element(*args)
151
+ end
152
+
153
+ #
154
+ # CX(コメント拡張)タグを取得する
155
+ #
156
+ # @param [Array] args 引数配列
157
+ # @return [Meteor::Element] 要素
158
+ #
159
+ def cxtag(*args)
160
+ @parser.cxtag(*args)
161
+ end
148
162
  #
149
163
  # 属性を編集する or 属性の値を取得する
150
164
  #
@@ -164,8 +178,6 @@ module Meteor
164
178
  @parser.attribute_map(self)
165
179
  end
166
180
 
167
-
168
-
169
181
  #
170
182
  # 内容をセットする or 内容を取得する
171
183
  #
@@ -230,6 +242,14 @@ module Meteor
230
242
  @parser.remove_element(self)
231
243
  end
232
244
 
245
+ def print
246
+ @parser.print
247
+ end
248
+
249
+ def flush
250
+ @parser.flush
251
+ end
252
+
233
253
  end
234
254
 
235
255
  #
@@ -251,26 +271,17 @@ module Meteor
251
271
  #@character_encoding=''
252
272
 
253
273
  #フックドキュメント
254
- @hook_document = EMPTY
255
- #フック判定フラグ
256
- #@hook = false
257
- #単一要素フック判定フラグ
258
- #@mono_hook = false
259
- #要素
260
- #@element = nil
274
+ @hook_document = ''
261
275
  #変更可能要素
262
- #@mutableElement = nil
276
+ #@element = nil
263
277
  end
264
278
 
265
279
  attr_accessor :content_type
266
280
  attr_accessor :kaigyo_code
267
281
  attr_accessor :character_encoding
282
+ attr_accessor :document
268
283
  attr_accessor :hook_document
269
- attr_accessor :hook;
270
- attr_accessor :mono_hook
271
- attr_accessor :element
272
- attr_accessor :mutableElement
273
- attr_accessor :document
284
+ attr_accessor :element
274
285
  end
275
286
 
276
287
  #
@@ -341,7 +352,6 @@ module Meteor
341
352
  attr.removed = false
342
353
  end
343
354
  attr.value = value
344
- #@map[name] = attr
345
355
  end
346
356
  end
347
357
 
@@ -610,9 +620,8 @@ module Meteor
610
620
  pif2 = ps.child(elm)
611
621
  init(pif2)
612
622
  list.each do |item|
613
- if pif2.root_element.hook then
623
+ if pif2.root_element.element && !pif2.root_element.element.mono then
614
624
  pif2.root_element.document = elm.mixed_content
615
- #elsif pif2.rootElement.mono_hook then
616
625
  end
617
626
  execute(pif2.root_element.mutable_element, item)
618
627
  pif2.print
@@ -908,60 +917,6 @@ module Meteor
908
917
 
909
918
  attr_accessor :e_cache
910
919
 
911
- #
912
- # フックフラグをセットする
913
- #
914
- # @param [TrueClass,FalseClass] hook フックフラグ
915
- #
916
- #def hook=(hook)
917
- # @root.hook = hook
918
- #end
919
-
920
- #
921
- # フックフラグを取得する
922
- #
923
- # @return [TrueClass,FalseClass] フックフラグ
924
- #
925
- #def hook
926
- # @root.hook
927
- #end
928
-
929
- #
930
- # 単一要素フックフラグをセットする
931
- #
932
- # @pamam [TrueClass,FalseClass] hook 単一要素フックフラグ
933
- #
934
- #def mono_hook=(hook)
935
- # @root.mono_hook = hook
936
- #end
937
-
938
- #
939
- # 単一要素フックフラグを取得する
940
- #
941
- # @return [TrueClass,FalseClass] 単一要素フックフラグ
942
- #
943
- #def mono_hook
944
- # @root.mono_hook
945
- #end
946
-
947
- #
948
- # フックドキュメントをセットする
949
- #
950
- # @param [String] hookDocument フックドキュメント
951
- #
952
- #def hookDocument=(hookDocument)
953
- # @root.hookDocument = hookDocument
954
- #end
955
-
956
- #
957
- # フックドキュメントを取得する
958
- #
959
- # @return [String] フックドキュメント
960
- #
961
- #def hookDocument
962
- # @root.hookDocument
963
- #end
964
-
965
920
  #
966
921
  # 文字エンコーディングをセットする
967
922
  #
@@ -1057,7 +1012,13 @@ module Meteor
1057
1012
  def element(*args)
1058
1013
  case args.length
1059
1014
  when ONE
1060
- element_1(args[0])
1015
+ if args[0].kind_of?(String) then
1016
+ element_1(args[0])
1017
+ elsif args[0].kind_of?(Meteor::Element) then
1018
+ shadow(args[0])
1019
+ else
1020
+ raise ArgumentError
1021
+ end
1061
1022
  when TWO
1062
1023
  element_2(args[0],args[1])
1063
1024
  when THREE
@@ -1375,7 +1336,6 @@ module Meteor
1375
1336
  @res = @pattern.match(@root.document)
1376
1337
 
1377
1338
  if @res then
1378
- #@elm_ = element_3(@res[1], attr_name, attr_value)
1379
1339
  element_3(@res[1], attr_name, attr_value)
1380
1340
  else
1381
1341
  @elm_ = nil
@@ -1865,12 +1825,10 @@ module Meteor
1865
1825
  #属性群の更新
1866
1826
  edit_attributes_(elm,attr_name,attr_value)
1867
1827
 
1868
- if !elm.parent then
1828
+ if !elm.origin then
1869
1829
  if elm.arguments.map.include?(attr_name) then
1870
1830
  elm.arguments.store(attr_name, attr_value)
1871
1831
  end
1872
-
1873
- #@e_cache.store(elm.origin, elm)
1874
1832
  end
1875
1833
  end
1876
1834
  elm
@@ -1883,12 +1841,11 @@ module Meteor
1883
1841
  #@res = @pattern.match(elm.attributes)
1884
1842
 
1885
1843
  #検索対象属性の存在判定
1886
- #if @res then
1887
1844
  if elm.attributes.include?(' ' << attr_name << ATTR_EQ) then
1888
1845
 
1889
1846
  @_attr_value = attr_value
1890
1847
  #replace2regex(@_attr_value)
1891
- if elm.parser.root_element.hook || elm.parser.root_element.mono_hook then
1848
+ if elm.origin then
1892
1849
  replace4regex(@_attr_value)
1893
1850
  else
1894
1851
  replace2regex(@_attr_value)
@@ -1902,7 +1859,7 @@ module Meteor
1902
1859
  #属性文字列の最後に新規の属性を追加する
1903
1860
  @_attr_value = attr_value
1904
1861
  #replace2regex(@_attr_value)
1905
- if elm.parser.root_element.hook || elm.parser.root_element.mono_hook then
1862
+ if elm.origin then
1906
1863
  replace2regex(@_attr_value)
1907
1864
  end
1908
1865
 
@@ -1933,7 +1890,7 @@ module Meteor
1933
1890
  #内容あり要素の場合
1934
1891
  @_content = elm.mixed_content
1935
1892
  #replace2regex(@_content)
1936
- if elm.parser.root_element.hook || elm.parser.root_element.mono_hook then
1893
+ if elm.origin then
1937
1894
  replace4regex(@_content)
1938
1895
  else
1939
1896
  replace2regex(@_content)
@@ -1951,7 +1908,7 @@ module Meteor
1951
1908
  end
1952
1909
  else
1953
1910
  @_content = elm.mixed_content
1954
- if elm.parser.root_element.hook || elm.parser.root_element.mono_hook then
1911
+ if elm.origin then
1955
1912
  replace4regex(@_content)
1956
1913
  else
1957
1914
  replace2regex(@_content)
@@ -1996,10 +1953,10 @@ module Meteor
1996
1953
  # @param [String] attr_value 属性値
1997
1954
  #
1998
1955
  def set_attribute_2(attr_name,attr_value)
1999
- if @root.hook || @root.mono_hook then
2000
- set_attribute_3(@root.mutableElement, attr_name, attr_value)
1956
+ if @root.element.origin then
1957
+ set_attribute_3(@root.element, attr_name, attr_value)
2001
1958
  end
2002
- @root.mutableElement
1959
+ @root.element
2003
1960
  end
2004
1961
  private :set_attribute_2
2005
1962
 
@@ -2037,8 +1994,8 @@ module Meteor
2037
1994
  # @return [String] 属性値
2038
1995
  #
2039
1996
  def get_attribute_value_1(attr_name)
2040
- if @root.hook || @root.mono_hook then
2041
- get_attribute_value_2(@root.mutableElement, attr_name)
1997
+ if @root.element then
1998
+ get_attribute_value_2(@root.element, attr_name)
2042
1999
  else
2043
2000
  nil
2044
2001
  end
@@ -2086,8 +2043,8 @@ module Meteor
2086
2043
  # @return [Meteor::AttributeMap] 属性マップ
2087
2044
  #
2088
2045
  def get_attribute_map_0()
2089
- if @root.hook || @root.mono_hook then
2090
- get_attribute_map_1(@root.mutableElement)
2046
+ if @root.element then
2047
+ get_attribute_map_1(@root.element)
2091
2048
  else
2092
2049
  nil
2093
2050
  end
@@ -2109,10 +2066,6 @@ module Meteor
2109
2066
  remove_attributes_(elm, name)
2110
2067
  end
2111
2068
  end
2112
-
2113
- #if !elm.parent then
2114
- # @e_cache.store(elm.origin,elm)
2115
- #end
2116
2069
  end
2117
2070
  elm
2118
2071
  end
@@ -2161,10 +2114,6 @@ module Meteor
2161
2114
  end
2162
2115
 
2163
2116
  elm.mixed_content = content
2164
-
2165
- #if !elm.parent then
2166
- # @e_cache.store(elm.origin,elm)
2167
- #end
2168
2117
 
2169
2118
  elm
2170
2119
  end
@@ -2187,8 +2136,8 @@ module Meteor
2187
2136
  # @param [String] content 内容
2188
2137
  #
2189
2138
  def set_content_1(content)
2190
- if @root.mono_hook then
2191
- set_content_2_s(@root.mutableElement, content)
2139
+ if @root.element && @root.element.mono then
2140
+ set_content_2_s(@root.element, content)
2192
2141
  end
2193
2142
  end
2194
2143
  private :set_content_1
@@ -2200,11 +2149,11 @@ module Meteor
2200
2149
  # @param [TrueClass,FalseClass] entity_ref エンティティ参照フラグ
2201
2150
  #
2202
2151
  def set_content_2_b(content,entity_ref)
2203
- if @root.mono_hook then
2204
- set_content_3(@root.mutableElement, content, entity_ref)
2152
+ if @root.element && @root.element.mono then
2153
+ set_content_3(@root.element, content, entity_ref)
2205
2154
  end
2206
2155
 
2207
- @root.mutableElement
2156
+ @root.element
2208
2157
  end
2209
2158
  private :set_content_2_b
2210
2159
 
@@ -2246,12 +2195,10 @@ module Meteor
2246
2195
 
2247
2196
  remove_attributes_(elm,attr_name)
2248
2197
 
2249
- if !elm.parent then
2198
+ if !elm.origin then
2250
2199
  if elm.arguments.map.include?(attr_name) then
2251
2200
  elm.arguments.delete(attr_name)
2252
2201
  end
2253
-
2254
- #@e_cache.store(elm.origin,elm)
2255
2202
  end
2256
2203
  end
2257
2204
 
@@ -2273,11 +2220,11 @@ module Meteor
2273
2220
  # @param [String] attr_name 属性名
2274
2221
  #
2275
2222
  def remove_attribute_1(attr_name)
2276
- if @root.hook || @root.mono_hook then
2277
- remove_attribute_2(@root.mutableElement, attr_name)
2223
+ if @root.element then
2224
+ remove_attribute_2(@root.element, attr_name)
2278
2225
  end
2279
2226
 
2280
- @root.mutableElement
2227
+ @root.element
2281
2228
  end
2282
2229
  private :remove_attribute_1
2283
2230
 
@@ -2288,8 +2235,7 @@ module Meteor
2288
2235
  #
2289
2236
  def remove_element(elm)
2290
2237
  replace(elm,EMPTY)
2291
- #@e_cache.delete(elm.origin)
2292
- elm.usable = ONE
2238
+ elm.usable = false
2293
2239
  end
2294
2240
 
2295
2241
  #
@@ -2385,7 +2331,7 @@ module Meteor
2385
2331
  #
2386
2332
  def replace(elm,replace_document)
2387
2333
  #文字エスケープ
2388
- if replace_document.size > ZERO && elm.parent && elm.mono then
2334
+ if replace_document.size > ZERO && elm.origin && elm.mono then
2389
2335
  replace2regex(replace_document)
2390
2336
  end
2391
2337
  #タグ置換パターン
@@ -2395,15 +2341,14 @@ module Meteor
2395
2341
  end
2396
2342
 
2397
2343
  def reflect()
2398
-
2344
+
2399
2345
  @e_cache.values.each do |item|
2400
- if item.usable == ZERO then
2346
+ if item.usable then
2401
2347
  edit_document_1(item)
2402
2348
  edit_pattern_(item)
2403
- item.usable = 1
2349
+ item.usable = false
2404
2350
  end
2405
2351
  end
2406
- #@e_cache.clear
2407
2352
  end
2408
2353
  protected :reflect
2409
2354
 
@@ -2413,42 +2358,42 @@ module Meteor
2413
2358
  def print
2414
2359
  reflect()
2415
2360
 
2416
- if @root.hook then
2417
- @_attributes = @root.mutableElement.attributes
2418
- replace2regex(@_attributes)
2419
- if @root.element.cx then
2420
- #@root.hookDocument << SET_CX_1 << @root.mutableElement.name << SPACE
2421
- #@root.hookDocument << @_attributes << SET_CX_2
2422
- #@root.hookDocument << @root.document << SET_CX_3
2423
- #@root.hookDocument << @root.mutableElement.name << SET_CX_4
2424
- @root.hook_document << "<!-- @#{@root.mutableElement.name} #{@_attributes}-->#{@root.document}<!-- /@#{@root.mutableElement.name} -->"
2425
- else
2426
- #@root.hookDocument << TAG_OPEN << @root.mutableElement.name
2427
- #@root.hookDocument << @_attributes << TAG_CLOSE << @root.document
2428
- #@root.hookDocument << TAG_OPEN3 << @root.mutableElement.name << TAG_CLOSE
2429
- @root.hook_document << "<#{@root.mutableElement.name}#{@_attributes}>#{@root.document}</#{@root.mutableElement.name}>"
2430
- end
2431
- @root.mutableElement = Element.new!(@root.element)
2432
- @root.document = String.new(@root.element.mixed_content)
2433
- else
2434
- if @root.mono_hook then
2435
- if @root.element.cx then
2436
- #@root.hookDocument << SET_CX_1 << @root.mutableElement.name << SPACE
2437
- #@root.hookDocument << @root.mutableElement.attributes << SET_CX_2
2438
- #@root.hookDocument << @root.mutableElement.mixed_content << SET_CX_3
2439
- #@root.hookDocument << @root.mutableElement.name << SET_CX_4
2440
- @root.hook_document << "<!-- @#{@root.mutableElement.name} #{@root.mutableElement.attributes}-->#{@root.mutableElement.mixed_content}<!-- /@#{@root.mutableElement.name} -->"
2361
+ if @root.element then
2362
+ if !@root.element.origin.mono then
2363
+ @_attributes = @root.element.attributes
2364
+ replace2regex(@_attributes)
2365
+ if @root.element.origin.cx then
2366
+ #@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
2367
+ #@root.hookDocument << @_attributes << SET_CX_2
2368
+ #@root.hookDocument << @root.document << SET_CX_3
2369
+ #@root.hookDocument << @root.element.name << SET_CX_4
2370
+ @root.hook_document << "<!-- @#{@root.element.name} #{@_attributes}-->#{@root.document}<!-- /@#{@root.element.name} -->"
2441
2371
  else
2442
- #@root.hookDocument << TAG_OPEN << @root.mutableElement.name
2443
- #@root.hookDocument << @root.mutableElement.attributes << TAG_CLOSE << @root.mutableElement.mixed_content
2444
- #@root.hookDocument << TAG_OPEN3 << @root.mutableElement.name << TAG_CLOSE
2445
- @root.hook_document << "<#{@root.mutableElement.name}#{@root.mutableElement.attributes}>#{@root.mutableElement.mixed_content}</#{@root.mutableElement.name}>"
2372
+ #@root.hookDocument << TAG_OPEN << @root.element.name
2373
+ #@root.hookDocument << @_attributes << TAG_CLOSE << @root.document
2374
+ #@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
2375
+ @root.hook_document << "<#{@root.element.name}#{@_attributes}>#{@root.document}</#{@root.element.name}>"
2446
2376
  end
2447
- @root.mutableElement = Element.new!(@root.element)
2377
+ @root.element = Element.new!(@root.element.origin)
2378
+ @root.document = String.new(@root.element.origin.mixed_content)
2448
2379
  else
2449
- #フック判定がFALSEの場合
2450
- clean
2380
+ if @root.element.origin.cx then
2381
+ #@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
2382
+ #@root.hookDocument << @root.element.attributes << SET_CX_2
2383
+ #@root.hookDocument << @root.element.mixed_content << SET_CX_3
2384
+ #@root.hookDocument << @root.element.name << SET_CX_4
2385
+ @root.hook_document << "<!-- @#{@root.element.name} #{@root.element.attributes}-->#{@root.element.mixed_content}<!-- /@#{@root.element.name} -->"
2386
+ else
2387
+ #@root.hookDocument << TAG_OPEN << @root.element.name
2388
+ #@root.hookDocument << @root.element.attributes << TAG_CLOSE << @root.element.mixed_content
2389
+ #@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
2390
+ @root.hook_document << "<#{@root.element.name}#{@root.element.attributes}>#{@root.element.mixed_content}</#{@root.element.name}>"
2391
+ end
2392
+ @root.element = Element.new!(@root.element.origin)
2451
2393
  end
2394
+ else
2395
+ #フック判定がFALSEの場合
2396
+ clean
2452
2397
  end
2453
2398
  end
2454
2399
 
@@ -2464,33 +2409,40 @@ module Meteor
2464
2409
  private :clean
2465
2410
 
2466
2411
  #
2467
- # 子パーサを取得する
2412
+ # 要素をコピーする
2468
2413
  #
2469
2414
  # @param [Meteor::Element] elm 要素
2470
- # @return [Meteor::Parser] 子パーサ
2415
+ # @return [Meteor::Element] 要素
2471
2416
  #
2472
- def child(elm)
2417
+ def shadow(elm)
2473
2418
  if elm.empty then
2474
2419
  #内容あり要素の場合
2475
2420
  set_mono_info(elm)
2476
2421
 
2477
2422
  pif2 = create(self)
2478
2423
 
2479
- elm.parent=true
2480
- pif2.root_element.element = elm
2481
- pif2.root_element.mutableElement = Element.new(elm)
2482
- pif2.root_element.kaigyo_code = @root.kaigyo_code
2424
+ @elm_ = Element.new(elm)
2425
+ @elm_.parser = pif2
2483
2426
 
2484
- if elm.mono then
2485
- pif2.root_element.mono_hook = true
2486
-
2487
- pif2
2488
- else
2489
- pif2.root_element.document = String.new(elm.mixed_content)
2490
- pif2.root_element.hook = true
2491
-
2492
- pif2
2493
- end
2427
+ if !elm.mono then
2428
+ pif2.root_element.document = String.new(elm.mixed_content)
2429
+ end
2430
+ pif2.root_element.element = @elm_
2431
+
2432
+ @elm_
2433
+ end
2434
+ end
2435
+ private :shadow
2436
+
2437
+ #
2438
+ # 子パーサを取得する
2439
+ #
2440
+ # @param [Meteor::Element] elm 要素
2441
+ # @return [Meteor::Parser] 子パーサ
2442
+ #
2443
+ def child(elm)
2444
+ if shadow(elm) then
2445
+ @elm_.parser
2494
2446
  end
2495
2447
  end
2496
2448
 
@@ -2502,11 +2454,9 @@ module Meteor
2502
2454
  # 反映する
2503
2455
  #
2504
2456
  def flush
2505
- if @root.hook || @root.mono_hook then
2506
- if @root.element then
2507
- @root.element.parser.reflect
2508
- @root.element.parser.replace(@root.element, @root.hook_document)
2509
- end
2457
+ if @root.element && @root.element.origin then
2458
+ @root.element.origin.parser.reflect
2459
+ @root.element.origin.parser.replace(@root.element.origin, @root.hook_document)
2510
2460
  end
2511
2461
  end
2512
2462
 
@@ -2537,39 +2487,11 @@ module Meteor
2537
2487
  #
2538
2488
  # 正規表現対象文字を置換する
2539
2489
  #
2540
- # @param [String] element 入力文字列
2490
+ # @param [String] str 入力文字列
2541
2491
  # @return [String] 出力文字列
2542
2492
  #
2543
- def escape_regex(element)
2544
- ##「\」->[\\]
2545
- #element.gsub!(@@pattern_en,EN_2)
2546
- ##「$」->「\$」
2547
- #element.gsub!(@@pattern_dol,DOL_2)
2548
- ##「+」->「\+」
2549
- #element.gsub!(@@pattern_plus,PLUS_2)
2550
- #todo
2551
- ##「(」->「\(」
2552
- #element.gsub!(@@pattern_brac_open,BRAC_OPEN_2)
2553
- ##「)」->「\)」
2554
- #element.gsub!(@@pattern_brac_close,BRAC_CLOSE_2)
2555
- ##「[」->「\[」
2556
- #element.gsub!(@@pattern_sbrac_open,SBRAC_OPEN_2)
2557
- ##「]」->「\]」
2558
- #element.gsub!(@@pattern_sbrac_close,SBRAC_CLOSE_2)
2559
- ##「{」->「\{」
2560
- #element.gsub!(@@pattern_cbrac_open,CBRAC_OPEN_2)
2561
- ##「}」->「\}」
2562
- #element.gsub!(@@pattern_cbrac_close,CBRAC_CLOSE_2)
2563
- ##「.」->「\.」
2564
- #element.gsub!(@@pattern_comma,COMMA_2)
2565
- ##「|」->「\|」
2566
- #element.gsub!(@@pattern_vline,VLINE_2)
2567
- ##「?」->「\?」
2568
- #element.gsub!(@@pattern_qmark,QMARK_2)
2569
- ##「*」->「\*」
2570
- #element.gsub!(@@pattern_asterisk,ASTERISK_2)
2571
- Regexp.quote(element)
2572
-
2493
+ def escape_regex(str)
2494
+ Regexp.quote(str)
2573
2495
  end
2574
2496
  private :escape_regex
2575
2497
 
@@ -2705,7 +2627,6 @@ module Meteor
2705
2627
  #
2706
2628
  # イニシャライザ
2707
2629
  #
2708
-
2709
2630
  def initialize
2710
2631
  end
2711
2632
 
@@ -3029,8 +2950,8 @@ module Meteor
3029
2950
  def initialize_1(ps)
3030
2951
  @root.document = String.new(ps.document)
3031
2952
  @root.hook_document = String.new(ps.root_element.hook_document)
3032
- @root.hook = ps.root_element.hook
3033
- @root.mono_hook = ps.root_element.mono_hook
2953
+ #@root.hook = ps.root_element.hook
2954
+ #@root.mono_hook = ps.root_element.mono_hook
3034
2955
  @root.content_type = String.new(ps.content_type);
3035
2956
  end
3036
2957
  private :initialize_1
@@ -3081,11 +3002,9 @@ module Meteor
3081
3002
  # ドキュメントをパースし、コンテントタイプをセットする
3082
3003
  #
3083
3004
  def analyze_content_type
3084
- #@elm_ = element(META_S,HTTP_EQUIV,CONTENT_TYPE)
3085
3005
  element(META_S,HTTP_EQUIV,CONTENT_TYPE)
3086
3006
 
3087
3007
  if !@elm_ then
3088
- #@elm_ = element(META,HTTP_EQUIV,CONTENT_TYPE)
3089
3008
  element(META,HTTP_EQUIV,CONTENT_TYPE)
3090
3009
  end
3091
3010
 
@@ -3248,7 +3167,6 @@ module Meteor
3248
3167
  @res = @pattern.match(@root.document)
3249
3168
 
3250
3169
  if @res then
3251
- #@elm_ = element_3(@res[1],attr_name,attr_value)
3252
3170
  element_3(@res[1],attr_name,attr_value)
3253
3171
  else
3254
3172
  @elm_ = nil
@@ -3362,7 +3280,6 @@ module Meteor
3362
3280
  @res = @pattern.match(@root.document)
3363
3281
 
3364
3282
  if @res then
3365
- #@elm_ = element_5(@res[1],attr_name1,attr_value1,attr_name2,attr_value2)
3366
3283
  element_5(@res[1],attr_name1,attr_value1,attr_name2,attr_value2)
3367
3284
  else
3368
3285
  @elm_ = nil
@@ -3395,13 +3312,11 @@ module Meteor
3395
3312
  private :edit_attributes_
3396
3313
 
3397
3314
  def edit_attributes_5(elm,attr_name,attr_value,match_p,replace)
3398
- #attr_value = escape(attr_value)
3399
3315
 
3400
3316
  if is_match(TRUE, attr_value) then
3401
3317
  @res = match_p.match(elm.attributes)
3402
3318
 
3403
3319
  if !@res then
3404
- #if elm.attributes.include?(match_p[0]) || elm.attributes.rindex(match_p[1],elm.attributes.length - 1) == 0 || elm.attributes.include?(match_p[2]) || elm.attributes.rindex(match_p[3],elm.attributes.length - 1) == 0
3405
3320
  if !EMPTY.eql?(elm.attributes) && !EMPTY.eql?(elm.attributes.strip) then
3406
3321
  elm.attributes = '' << SPACE << elm.attributes.strip
3407
3322
  else
@@ -3460,7 +3375,6 @@ module Meteor
3460
3375
  @res = match_p.match(elm.attributes)
3461
3376
 
3462
3377
  if @res then
3463
- #if elm.attributes.include?(match_p[0]) || elm.attributes.rindex(match_p[1],elm.attributes.length - 1) == 0 || elm.attributes.include?(match_p[2]) || elm.attributes.rindex(match_p[3],elm.attributes.length - 1) == 0 then
3464
3378
  TRUE
3465
3379
  else
3466
3380
  FALSE
@@ -3812,8 +3726,6 @@ module Meteor
3812
3726
  def initialize_1(ps)
3813
3727
  @root.document = String.new(ps.document)
3814
3728
  @root.hook_document = String.new(ps.root_element.hook_document)
3815
- @root.hook = ps.root_element.hook
3816
- @root.mono_hook = ps.root_element.mono_hook
3817
3729
  @root.content_type = String.new(ps.content_type);
3818
3730
  end
3819
3731
  private :initialize_1
@@ -3864,11 +3776,9 @@ module Meteor
3864
3776
  # ドキュメントをパースし、コンテントタイプをセットする
3865
3777
  #
3866
3778
  def analyze_content_type
3867
- #@elm_ = element(META_S,HTTP_EQUIV,CONTENT_TYPE)
3868
3779
  element(META_S,HTTP_EQUIV,CONTENT_TYPE)
3869
3780
 
3870
3781
  if !@elm_ then
3871
- #@elm_ = element(META,HTTP_EQUIV,CONTENT_TYPE)
3872
3782
  element(META,HTTP_EQUIV,CONTENT_TYPE)
3873
3783
  end
3874
3784
 
@@ -4229,9 +4139,6 @@ module Meteor
4229
4139
  def initialize_1(ps)
4230
4140
  @root.document = String.new(ps.document)
4231
4141
  @root.hook_document = String.new(ps.root_element.hook_document)
4232
- @root.hook = ps.root_element.hook
4233
- @root.mono_hook = ps.root_element.mono_hook
4234
- #@root.content_type = String.new(ps.content_type);
4235
4142
  end
4236
4143
 
4237
4144
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asip-meteor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1.8
4
+ version: 0.9.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - asip
@@ -9,7 +9,7 @@ autorequire: meteor
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-27 00:00:00 -07:00
12
+ date: 2009-05-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15