meteor 0.9.13 → 0.9.15

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.
@@ -17,23 +17,23 @@ module Meteor
17
17
  class Kernel < Meteor::Parser
18
18
  # find
19
19
  # E
20
- PATTERN_FIND_1 = '^([^,\\[\\]#\\.]+)$'
20
+ PATTERN_FIND_1 = "^([^,\\[\\]#\\.]+)$"
21
21
  # # id_attribute_value
22
- PATTERN_FIND_2_1 = '^#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
22
+ PATTERN_FIND_2_1 = "^#([^\\.,\\[\\]#][^,\\[\\]#]*)$"
23
23
  # .class_attribute_value
24
- PATTERN_FIND_2_2 = '^\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
24
+ PATTERN_FIND_2_2 = "^\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$"
25
25
  # [attribute_name=attribute_value]
26
- PATTERN_FIND_2_3 = '^\\[([^\\[\\],]+)=([^\\[\\],]+)\\]$'
26
+ PATTERN_FIND_2_3 = "^\\[([^\\[\\],]+)=([^\\[\\],]+)\\]$"
27
27
  # E[attribute_name=attribute_value]
28
- PATTERN_FIND_3_1 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,\\[\\]]+)=([^,\\[\\]]+)\\]$'
28
+ PATTERN_FIND_3_1 = "^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,\\[\\]]+)=([^,\\[\\]]+)\\]$"
29
29
  # E# id_attribute_value
30
- PATTERN_FIND_3_2 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
30
+ PATTERN_FIND_3_2 = "^([^\\.,\\[\\]#][^,\\[\\]#]+)#([^\\.,\\[\\]#][^,\\[\\]#]*)$"
31
31
  # E.class_attribute_value
32
- PATTERN_FIND_3_3 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
32
+ PATTERN_FIND_3_3 = "^([^\\.,\\[\\]#][^,\\[\\]#]+)\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$"
33
33
  # [attribute_name1=attribute_value1][attribute_name2=attribute_value2]
34
- PATTERN_FIND_4 = '^\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
34
+ PATTERN_FIND_4 = "^\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$"
35
35
  # E[attribute_name1=attribute_value1][attribute_name2=attribute_value2]
36
- PATTERN_FIND_5 = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
36
+ PATTERN_FIND_5 = "^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$"
37
37
 
38
38
  @@pattern_find_1 = Regexp.new(PATTERN_FIND_1)
39
39
  @@pattern_find_2_1 = Regexp.new(PATTERN_FIND_2_1)
@@ -45,12 +45,12 @@ module Meteor
45
45
  @@pattern_find_4 = Regexp.new(PATTERN_FIND_4)
46
46
  @@pattern_find_5 = Regexp.new(PATTERN_FIND_5)
47
47
 
48
- @@pattern_set_mono1 = Regexp.new('\\A[^<>]*\\Z')
48
+ @@pattern_set_mono1 = Regexp.new("\\A[^<>]*\\Z")
49
49
 
50
- @@pattern_get_attrs_map = Regexp.new('([^\\s]*)="([^\"]*)"')
50
+ @@pattern_get_attrs_map = Regexp.new("([^\\s]*)=\"([^\\\"]*)\"")
51
51
 
52
- @@pattern_clean1 = Regexp.new('<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->')
53
- @@pattern_clean2 = Regexp.new('<!--\\s\\/@[^<>]*(\\s)*-->')
52
+ @@pattern_clean1 = Regexp.new("<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->")
53
+ @@pattern_clean2 = Regexp.new("<!--\\s\\/@[^<>]*(\\s)*-->")
54
54
 
55
55
  attr_accessor :element_cache
56
56
  attr_accessor :doc_type
@@ -113,7 +113,7 @@ module Meteor
113
113
  # element cache (要素キャッシュ)
114
114
  @element_cache = Hash.new
115
115
  # document hook (フック・ドキュメント)
116
- @document_hook = String.new('')
116
+ @document_hook = String.new("")
117
117
 
118
118
  @error_check = true
119
119
  end
@@ -132,7 +132,7 @@ module Meteor
132
132
  # io = File.open(file_path,"r:" << enc)
133
133
  io = File.open(file_path, "r:UTF-8")
134
134
  else
135
- io = File.open(file_path, String.new('') << "r:" << enc << ":utf-8")
135
+ io = File.open(file_path, String.new("") << "r:" << enc << ":utf-8")
136
136
  end
137
137
 
138
138
  # load and save (読込及び格納)
@@ -199,7 +199,7 @@ module Meteor
199
199
  # @param [Meteor::Element] elm element (要素)
200
200
  # @return [Meteor::Element] element (要素)
201
201
  #
202
- def element(elm, attrs = nil,*args)
202
+ def element(elm, attrs = nil, *args)
203
203
  if !attrs
204
204
  if elm.kind_of?(String) || elm.kind_of?(Symbol)
205
205
  element_1(elm.to_s)
@@ -242,29 +242,32 @@ module Meteor
242
242
  end
243
243
  elsif attrs.kind_of?(String) || attrs.kind_of?(Symbol)
244
244
  case args.length
245
- when ZERO
246
- element_2(elm.to_s,attrs.to_s)
247
- if @elm_
248
- @element_cache.store(@elm_.object_id, @elm_)
249
- end
250
- when ONE
251
- element_3(elm.to_s, attrs.to_s, args[0])
252
- if @elm_
253
- @element_cache.store(@elm_.object_id, @elm_)
254
- end
255
- when TWO
256
- element_4(elm.to_s, attrs.to_s, args[0].to_s,args[1])
257
- if @elm_
258
- @element_cache.store(@elm_.object_id, @elm_)
259
- end
260
- when THREE
261
- element_5(elm.to_s, attrs.to_s, args[0],args[1].to_s,args[2])
262
- if @elm_
263
- @element_cache.store(@elm_.object_id, @elm_)
264
- end
265
- else
266
- @elm_ = nil
267
- raise ArgumentError
245
+ when ZERO
246
+ element_2(elm.to_s, attrs.to_s)
247
+ if @elm_
248
+ @element_cache.store(@elm_.object_id, @elm_)
249
+ end
250
+
251
+ when ONE
252
+ element_3(elm.to_s, attrs.to_s, args[0])
253
+ if @elm_
254
+ @element_cache.store(@elm_.object_id, @elm_)
255
+ end
256
+
257
+ when TWO
258
+ element_4(elm.to_s, attrs.to_s, args[0].to_s, args[1])
259
+ if @elm_
260
+ @element_cache.store(@elm_.object_id, @elm_)
261
+ end
262
+
263
+ when THREE
264
+ element_5(elm.to_s, attrs.to_s, args[0], args[1].to_s, args[2])
265
+ if @elm_
266
+ @element_cache.store(@elm_.object_id, @elm_)
267
+ end
268
+ else
269
+ @elm_ = nil
270
+ raise ArgumentError
268
271
  end
269
272
  else
270
273
  @elm_ = nil
@@ -294,7 +297,7 @@ module Meteor
294
297
  # puts '---element_with_1'
295
298
  element_with_1(name)
296
299
  end
297
- # else
300
+ # else
298
301
  end
299
302
 
300
303
  @elm_
@@ -345,7 +348,7 @@ module Meteor
345
348
  # document (全体)
346
349
  @elm_.document = @res[0]
347
350
  # void element search pattern (空要素検索用パターン)
348
- @pattern_cc = String.new('') << "<" << @_name << '(|\\s[^<>]*)\\/>'
351
+ @pattern_cc = String.new("") << "<" << @_name << "(|\\s[^<>]*)\\/>"
349
352
  # @pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>"
350
353
  @elm_.pattern = @pattern_cc
351
354
 
@@ -366,7 +369,11 @@ module Meteor
366
369
  # @param [true,false] quote flag (クオート・フラグ)
367
370
  # @return [Meteor::Element] element (要素)
368
371
  def element_3(name, attr_name, attr_value, quote = true)
369
- element_quote_3(name,attr_name,attr_value)
372
+ if quote
373
+ quote_element_3(name, attr_name, attr_value)
374
+ else
375
+ quote_name(name)
376
+ end
370
377
 
371
378
  @pattern_cc_1 = element_pattern_3
372
379
 
@@ -409,8 +416,9 @@ module Meteor
409
416
  element_with_3_1(name)
410
417
  else
411
418
  if @error_check
412
- puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
419
+ puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message)
413
420
  end
421
+
414
422
  @elm_ = nil
415
423
  end
416
424
 
@@ -425,13 +433,12 @@ module Meteor
425
433
 
426
434
  private :element_pattern_3
427
435
 
428
- def element_quote_3(name,attr_name,attr_value)
429
- @_name = Regexp.quote(name)
430
- @_attr_name = Regexp.quote(attr_name)
431
- @_attr_value = Regexp.quote(attr_value)
436
+ def quote_element_3(name, attr_name, attr_value)
437
+ quote_name(name)
438
+ quote_attribute(attr_name, attr_value)
432
439
  end
433
440
 
434
- private :element_quote_3
441
+ private :quote_element_3
435
442
 
436
443
  def element_with_3_1(name)
437
444
  # puts @res.captures.length
@@ -478,7 +485,7 @@ module Meteor
478
485
 
479
486
  @elm_.parser = self
480
487
 
481
- when THREE,SIX
488
+ when THREE, SIX
482
489
  # element (要素)
483
490
  @elm_ = Meteor::Element.new(name)
484
491
  unless @on_search
@@ -501,6 +508,7 @@ module Meteor
501
508
 
502
509
  @elm_.parser = self
503
510
  end
511
+
504
512
  @elm_
505
513
  end
506
514
 
@@ -525,26 +533,25 @@ module Meteor
525
533
  # @pattern_cc_1 = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
526
534
  # @pattern_cc_1 << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
527
535
  @pattern_cc_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
528
- @pattern_cc_1b = String.new('') << "<" << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
536
+ @pattern_cc_1b = String.new("") << "<" << @_name << "(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
529
537
  # @pattern_cc_1b = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
530
538
  # @pattern_cc_1_1 = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
531
539
  # @pattern_cc_1_1 << @_attr_value << '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
532
540
  @pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
533
- @pattern_cc_1_2 = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
541
+ @pattern_cc_1_2 = String.new("") << ".*?<" << @_name << "(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
534
542
  # @pattern_cc_1_2 = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
535
543
 
536
-
537
- @pattern_cc_2 = String.new('') << '<\\/' << @_name << '>'
544
+ @pattern_cc_2 = String.new("") << "<\\/" << @_name << ">"
538
545
  # @pattern_cc_2 = String.new('') << "<\\/#{@_name}>"
539
- @pattern_cc_2_1 = String.new('') << '.*?<\/' << @_name << '>'
546
+ @pattern_cc_2_1 = String.new("") << ".*?<\\/" << @_name << ">"
540
547
  # @pattern_cc_2_1 = ".*?<\\/#{@_name}>"
541
- @pattern_cc_2_2 = String.new('') << '.*?)<\/' << @_name << '>'
548
+ @pattern_cc_2_2 = String.new("") << ".*?)<\\/" << @_name << ">"
542
549
  # @pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
543
550
 
544
551
  # search of element with content (内容あり要素検索)
545
552
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
546
553
 
547
- @sbuf = String.new('')
554
+ @sbuf = String.new("")
548
555
 
549
556
  @pattern_2 = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
550
557
  @pattern_1b = Meteor::Core::Util::PatternCache.get(@pattern_cc_1b)
@@ -554,13 +561,12 @@ module Meteor
554
561
  create_element_pattern
555
562
 
556
563
  @pattern_cc = @sbuf
557
-
558
564
  end
559
565
 
560
566
  private :element_pattern_with_3_2
561
567
 
562
568
  def element_without_3(name)
563
- element_without_3_1(name, '"[^<>]*)\\/>')
569
+ element_without_3_1(name, "\"[^<>]*)\\/>")
564
570
  end
565
571
 
566
572
  private :element_without_3
@@ -573,7 +579,7 @@ module Meteor
573
579
  # document (全体)
574
580
  @elm_.document = @res[0]
575
581
  # pattern (空要素検索用パターン)
576
- @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="' << @_attr_value << closer
582
+ @pattern_cc = String.new("") << "<" << @_name << "(\\s[^<>]*" << @_attr_name << "=\"" << @_attr_value << closer
577
583
  # @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}#{closer}"
578
584
  @elm_.pattern = @pattern_cc
579
585
  @elm_.parser = self
@@ -591,7 +597,7 @@ module Meteor
591
597
  #
592
598
  def element_2(attr_name, attr_value)
593
599
 
594
- element_quote_2(attr_name,attr_value)
600
+ quote_attribute(attr_name, attr_value)
595
601
 
596
602
  element_pattern_2
597
603
 
@@ -602,11 +608,12 @@ module Meteor
602
608
  element_3(@res[1], attr_name, attr_value)
603
609
  else
604
610
  if @error_check
605
- puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
611
+ puts(Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message)
606
612
  end
613
+
607
614
  @elm_ = nil
608
615
  end
609
- #=end
616
+ #=end
610
617
 
611
618
  =begin
612
619
  @pattern_cc_1 = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(\\3[^<>]*>)).)*)<\\/\\3>"
@@ -661,12 +668,18 @@ module Meteor
661
668
 
662
669
  private :element_2
663
670
 
664
- def element_quote_2(attr_name, attr_value)
671
+ def quote_name(name)
672
+ @_name = Regexp.quote(name)
673
+ end
674
+
675
+ private :quote_name
676
+
677
+ def quote_attribute(attr_name, attr_value)
665
678
  @_attr_name = Regexp.quote(attr_name)
666
679
  @_attr_value = Regexp.quote(attr_value)
667
680
  end
668
681
 
669
- private :element_quote_2
682
+ private :quote_attribute
670
683
 
671
684
  def element_pattern_2
672
685
  # # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*' << @_attr_name << '="' << @_attr_value << '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
@@ -677,7 +690,7 @@ module Meteor
677
690
  private :element_pattern_2
678
691
 
679
692
  =begin
680
- def element_with_2_1
693
+ def element_with_2_1
681
694
  # puts @res.captures.length
682
695
  case @res.captures.length
683
696
  when FOUR
@@ -816,7 +829,7 @@ module Meteor
816
829
  #
817
830
  def element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
818
831
 
819
- element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
832
+ quote_element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
820
833
 
821
834
  @pattern_cc_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)\\/>|<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
822
835
 
@@ -859,8 +872,9 @@ module Meteor
859
872
  element_with_5_1(name)
860
873
  else
861
874
  if @error_check
862
- puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
875
+ puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message)
863
876
  end
877
+
864
878
  @elm_ = nil
865
879
  end
866
880
 
@@ -869,7 +883,7 @@ module Meteor
869
883
 
870
884
  private :element_5
871
885
 
872
- def element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
886
+ def quote_element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
873
887
  @_name = Regexp.quote(name)
874
888
  @_attr_name1 = Regexp.quote(attr_name1)
875
889
  @_attr_name2 = Regexp.quote(attr_name2)
@@ -877,7 +891,7 @@ module Meteor
877
891
  @_attr_value2 = Regexp.quote(attr_value2)
878
892
  end
879
893
 
880
- private :element_quote_5
894
+ private :quote_element_5
881
895
 
882
896
  def element_with_5_1(name)
883
897
 
@@ -926,7 +940,7 @@ module Meteor
926
940
  @elm_.empty = true
927
941
  @elm_.parser = self
928
942
 
929
- when THREE,SIX
943
+ when THREE, SIX
930
944
  # element (要素)
931
945
  @elm_ = Meteor::Element.new(name)
932
946
  # attribute (属性)
@@ -941,6 +955,7 @@ module Meteor
941
955
  @elm_.empty = true
942
956
  @elm_.parser = self
943
957
  end
958
+
944
959
  @elm_
945
960
  end
946
961
 
@@ -970,7 +985,7 @@ module Meteor
970
985
  # @pattern_cc_1 << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
971
986
  # @pattern_cc_1 << @_attr_value1 << '")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))'
972
987
  @pattern_cc_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))"
973
- @pattern_cc_1b = String.new('') << "<" << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
988
+ @pattern_cc_1b = String.new("") << "<" << @_name << "(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
974
989
  # @pattern_cc_1b = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
975
990
 
976
991
  # @pattern_cc_1_1 = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
@@ -979,10 +994,10 @@ module Meteor
979
994
  # @pattern_cc_1_1 << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
980
995
  # @pattern_cc_1_1 << @_attr_value1 << '")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
981
996
  @pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
982
- @pattern_cc_1_2 = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
983
- @pattern_cc_2 = String.new('') << '<\\/' << @_name << '>'
984
- @pattern_cc_2_1 = String.new('') << '.*?<\/' << @_name << '>'
985
- @pattern_cc_2_2 = String.new('') << '.*?)<\/' << @_name << '>'
997
+ @pattern_cc_1_2 = String.new("") << ".*?<" << @_name << "(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
998
+ @pattern_cc_2 = String.new("") << "<\\/" << @_name << ">"
999
+ @pattern_cc_2_1 = String.new("") << ".*?<\\/" << @_name << ">"
1000
+ @pattern_cc_2_2 = String.new("") << ".*?)<\\/" << @_name << ">"
986
1001
 
987
1002
  # @pattern_cc_1_2 = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
988
1003
  # @pattern_cc_2 = String.new('') << "<\\/#{@_name}>"
@@ -992,7 +1007,7 @@ module Meteor
992
1007
  # search of element with content (内容あり要素検索)
993
1008
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
994
1009
 
995
- @sbuf = String.new('')
1010
+ @sbuf = String.new("")
996
1011
 
997
1012
  @pattern_2 = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
998
1013
  @pattern_1b = Meteor::Core::Util::PatternCache.get(@pattern_cc_1b)
@@ -1005,7 +1020,7 @@ module Meteor
1005
1020
  private :element_pattern_with_5_2
1006
1021
 
1007
1022
  def element_without_5(name)
1008
- element_without_5_1(name, '")[^<>]*)\\/>')
1023
+ element_without_5_1(name, "\")[^<>]*)\\/>")
1009
1024
  end
1010
1025
 
1011
1026
  private :element_without_5
@@ -1042,7 +1057,7 @@ module Meteor
1042
1057
  #
1043
1058
  def element_4(attr_name1, attr_value1, attr_name2, attr_value2)
1044
1059
 
1045
- element_quote_4(attr_name1, attr_value1, attr_name2, attr_value2)
1060
+ quote_element_4(attr_name1, attr_value1, attr_name2, attr_value2)
1046
1061
 
1047
1062
  element_pattern_4
1048
1063
 
@@ -1054,8 +1069,11 @@ module Meteor
1054
1069
  element_5(@res[1], attr_name1, attr_value1, attr_name2, attr_value2)
1055
1070
  else
1056
1071
  if @error_check
1057
- puts Meteor::Exception::NoSuchElementException.new(attr_name1, attr_value1, attr_name2, attr_value2).message
1072
+ puts(
1073
+ Meteor::Exception::NoSuchElementException.new(attr_name1, attr_value1, attr_name2, attr_value2).message
1074
+ )
1058
1075
  end
1076
+
1059
1077
  @elm_ = nil
1060
1078
  end
1061
1079
 
@@ -1064,14 +1082,14 @@ module Meteor
1064
1082
 
1065
1083
  private :element_4
1066
1084
 
1067
- def element_quote_4(attr_name1, attr_value1, attr_name2, attr_value2)
1085
+ def quote_element_4(attr_name1, attr_value1, attr_name2, attr_value2)
1068
1086
  @_attr_name1 = Regexp.quote(attr_name1)
1069
1087
  @_attr_name2 = Regexp.quote(attr_name2)
1070
1088
  @_attr_value1 = Regexp.quote(attr_value1)
1071
1089
  @_attr_value2 = Regexp.quote(attr_value2)
1072
1090
  end
1073
1091
 
1074
- private :element_quote_4
1092
+ private :quote_element_4
1075
1093
 
1076
1094
  def element_pattern_4
1077
1095
 
@@ -1081,7 +1099,6 @@ module Meteor
1081
1099
  # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
1082
1100
  # @pattern_cc << @_attr_value1 << '"'
1083
1101
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")"
1084
-
1085
1102
  end
1086
1103
 
1087
1104
  private :element_pattern_4
@@ -1268,7 +1285,7 @@ module Meteor
1268
1285
  # @param [String] attr_value2 attribute value2 (属性値2)
1269
1286
  # @return [Array<Meteor::Element>] element array (要素配列)
1270
1287
  #
1271
- def elements(elm, attrs = nil,*args)
1288
+ def elements(elm, attrs = nil, *args)
1272
1289
  if !attrs
1273
1290
  if elm.kind_of?(String)
1274
1291
  elements_(elm)
@@ -1294,17 +1311,17 @@ module Meteor
1294
1311
  end
1295
1312
  elsif attrs.kind_of?(String)
1296
1313
  case args.length
1297
- when ZERO
1298
- elements_(elm,attrs)
1299
- when ONE
1300
- elements_(elm, attrs, args[0])
1301
- when TWO
1302
- elements_(elm, attrs, args[0],args[1])
1303
- when THREE
1304
- elements_(elm, attrs, args[0],args[1],args[2])
1305
- else
1306
- @elm_ = nil
1307
- raise ArgumentError
1314
+ when ZERO
1315
+ elements_(elm, attrs)
1316
+ when ONE
1317
+ elements_(elm, attrs, args[0])
1318
+ when TWO
1319
+ elements_(elm, attrs, args[0], args[1])
1320
+ when THREE
1321
+ elements_(elm, attrs, args[0], args[1], args[2])
1322
+ else
1323
+ @elm_ = nil
1324
+ raise ArgumentError
1308
1325
  end
1309
1326
  else
1310
1327
  @elm_ = nil
@@ -1318,16 +1335,16 @@ module Meteor
1318
1335
  @on_search = true
1319
1336
 
1320
1337
  case args.size
1321
- when ONE
1322
- @elm_ = element_1(*args)
1323
- when TWO
1324
- @elm_ = element_2(*args)
1325
- when THREE
1326
- @elm_ = element_3(*args)
1327
- when FOUR
1328
- @elm_ = element_4(*args)
1329
- when FIVE
1330
- @elm_ = element_5(*args)
1338
+ when ONE
1339
+ @elm_ = element_1(*args)
1340
+ when TWO
1341
+ @elm_ = element_2(*args)
1342
+ when THREE
1343
+ @elm_ = element_3(*args)
1344
+ when FOUR
1345
+ @elm_ = element_4(*args)
1346
+ when FIVE
1347
+ @elm_ = element_5(*args)
1331
1348
  end
1332
1349
 
1333
1350
  if !@elm_
@@ -1342,35 +1359,37 @@ module Meteor
1342
1359
 
1343
1360
  @position = 0
1344
1361
 
1345
- while (@res = @pattern.match(@root.document,@position))
1362
+ while (@res = @pattern.match(@root.document, @position))
1346
1363
  @position = @res.end(0)
1347
1364
  # puts @res[0]
1348
1365
  # if @res
1349
- case args.size
1350
- when ONE
1351
- if @elm_.empty
1352
- element_with_1(@elm_.name)
1353
- else
1354
- element_without_1(@elm_.name)
1355
- end
1356
- when TWO,THREE
1357
- if @elm_.empty
1358
- element_with_3_1(@elm_.name)
1359
- else
1360
- element_without_3(@elm_.name)
1361
- end
1362
- when FOUR,FIVE
1363
- if @elm_.empty
1364
- element_with_5_1(@elm_.name)
1365
- else
1366
- element_without_5(@elm_.name)
1367
- end
1366
+ case args.size
1367
+ when ONE
1368
+ if @elm_.empty
1369
+ element_with_1(@elm_.name)
1370
+ else
1371
+ element_without_1(@elm_.name)
1372
+ end
1373
+
1374
+ when TWO, THREE
1375
+ if @elm_.empty
1376
+ element_with_3_1(@elm_.name)
1377
+ else
1378
+ element_without_3(@elm_.name)
1379
+ end
1380
+
1381
+ when FOUR, FIVE
1382
+ if @elm_.empty
1383
+ element_with_5_1(@elm_.name)
1384
+ else
1385
+ element_without_5(@elm_.name)
1368
1386
  end
1387
+ end
1369
1388
 
1370
- @elm_.pattern = Regexp.quote(@elm_.document)
1371
- elm_arr << @elm_
1389
+ @elm_.pattern = Regexp.quote(@elm_.document)
1390
+ elm_arr << @elm_
1372
1391
 
1373
- @element_cache.store(@elm_.object_id, @elm_)
1392
+ @element_cache.store(@elm_.object_id, @elm_)
1374
1393
 
1375
1394
  # else
1376
1395
  # break
@@ -1389,75 +1408,77 @@ module Meteor
1389
1408
  # @return [Array<Meteor::Element>] element array (要素配列)
1390
1409
  #
1391
1410
  def find(selector)
1392
- open_count = selector.count('[')
1411
+ open_count = selector.count("[")
1393
1412
 
1394
1413
  case open_count
1395
- when ZERO
1396
- if selector.count('#.') == 0
1397
- if @res = @@pattern_find_1.match(selector)
1398
- elements_(@res[1])
1399
- else
1400
- nil
1401
- end
1402
- elsif selector.count('#') == 1
1403
- if selector[0] == '#'
1404
- if @res = @@pattern_find_2_1.match(selector)
1405
- elements_('id', @res[1])
1406
- else
1407
- nil
1408
- end
1409
- else
1410
- if @res = @@pattern_find_3_2.match(selector)
1411
- elements_(@res[1], 'id', @res[2])
1412
- else
1413
- nil
1414
- end
1415
- end
1416
- elsif selector.count('.') == 1
1417
- if selector[0] == '.'
1418
- if @res = @@pattern_find_2_2.match(selector)
1419
- elements_('class', @res[1])
1420
- else
1421
- nil
1422
- end
1423
- else
1424
- if @res = @@pattern_find_3_3.match(selector)
1425
- elements_(@res[1], 'class', @res[2])
1426
- else
1427
- nil
1428
- end
1429
- end
1414
+ when ZERO
1415
+ if selector.count("#.") == 0
1416
+ if @res = @@pattern_find_1.match(selector)
1417
+ elements_(@res[1])
1418
+ else
1419
+ nil
1430
1420
  end
1431
- when ONE
1432
- if selector[0] == '['
1433
- if @res = @@pattern_find_2_3.match(selector)
1434
- elements_(@res[1], @res[2])
1421
+ elsif selector.count("#") == 1
1422
+ if selector[0] == "#"
1423
+ if @res = @@pattern_find_2_1.match(selector)
1424
+ elements_("id", @res[1])
1435
1425
  else
1436
1426
  nil
1437
1427
  end
1438
1428
  else
1439
- if @res = @@pattern_find_3_1.match(selector)
1440
- elements_(@res[1], @res[2], @res[3])
1429
+ if @res = @@pattern_find_3_2.match(selector)
1430
+ elements_(@res[1], "id", @res[2])
1441
1431
  else
1442
1432
  nil
1443
1433
  end
1444
1434
  end
1445
- when 2
1446
- if selector[0] == '['
1447
- if @res = @@pattern_find_4.match(selector)
1448
- elements_(@res[1], @res[2], @res[3], @res[4])
1435
+ elsif selector.count(".") == 1
1436
+ if selector[0] == "."
1437
+ if @res = @@pattern_find_2_2.match(selector)
1438
+ elements_("class", @res[1])
1449
1439
  else
1450
1440
  nil
1451
1441
  end
1452
1442
  else
1453
- if @res = @@pattern_find_5.match(selector)
1454
- elements_(@res[1], @res[2], @res[3], @res[4], @res[5])
1443
+ if @res = @@pattern_find_3_3.match(selector)
1444
+ elements_(@res[1], "class", @res[2])
1455
1445
  else
1456
1446
  nil
1457
1447
  end
1458
1448
  end
1449
+ end
1450
+
1451
+ when ONE
1452
+ if selector[0] == "["
1453
+ if @res = @@pattern_find_2_3.match(selector)
1454
+ elements_(@res[1], @res[2])
1455
+ else
1456
+ nil
1457
+ end
1459
1458
  else
1460
- nil
1459
+ if @res = @@pattern_find_3_1.match(selector)
1460
+ elements_(@res[1], @res[2], @res[3])
1461
+ else
1462
+ nil
1463
+ end
1464
+ end
1465
+
1466
+ when 2
1467
+ if selector[0] == "["
1468
+ if @res = @@pattern_find_4.match(selector)
1469
+ elements_(@res[1], @res[2], @res[3], @res[4])
1470
+ else
1471
+ nil
1472
+ end
1473
+ else
1474
+ if @res = @@pattern_find_5.match(selector)
1475
+ elements_(@res[1], @res[2], @res[3], @res[4], @res[5])
1476
+ else
1477
+ nil
1478
+ end
1479
+ end
1480
+ else
1481
+ nil
1461
1482
  end
1462
1483
  end
1463
1484
 
@@ -1479,18 +1500,18 @@ module Meteor
1479
1500
  # @param [String,Symbol] attr_name attribute name (属性名)
1480
1501
  # @return [String] attribute value (属性値)
1481
1502
  #
1482
- def attr(elm, attr,*args)
1503
+ def attr(elm, attr, *args)
1483
1504
  if attr.kind_of?(String) || attr.kind_of?(Symbol)
1484
1505
  case args.length
1485
- when ZERO
1486
- get_attr_value(elm, attr.to_s)
1487
- when ONE
1488
- if args[0] != nil
1489
- elm.document_sync = true
1490
- set_attribute_3(elm, attr.to_s,args[0])
1491
- else
1492
- remove_attr(elm, attr.to_s)
1493
- end
1506
+ when ZERO
1507
+ get_attr_value(elm, attr.to_s)
1508
+ when ONE
1509
+ if args[0] != nil
1510
+ elm.document_sync = true
1511
+ set_attribute_3(elm, attr.to_s, args[0])
1512
+ else
1513
+ remove_attr(elm, attr.to_s)
1514
+ end
1494
1515
  end
1495
1516
 
1496
1517
  elsif attr.kind_of?(Hash) && attr.size == 1
@@ -1500,11 +1521,11 @@ module Meteor
1500
1521
  else
1501
1522
  remove_attr(elm, attr.keys[0].to_s)
1502
1523
  end
1503
- # elsif attrs.kind_of?(Hash) && attrs.size >= 1
1504
- # elm.document_sync = true
1505
- # attrs.each{|name,value|
1506
- # set_attribute_3(elm,name,value)
1507
- # }
1524
+ # elsif attrs.kind_of?(Hash) && attrs.size >= 1
1525
+ # elm.document_sync = true
1526
+ # attrs.each{|name,value|
1527
+ # set_attribute_3(elm,name,value)
1528
+ # }
1508
1529
  else
1509
1530
  raise ArgumentError
1510
1531
  end
@@ -1523,6 +1544,7 @@ module Meteor
1523
1544
  # update attributes (属性群の更新)
1524
1545
  edit_attrs_(elm, attr_name, attr_value)
1525
1546
  end
1547
+
1526
1548
  elm
1527
1549
  end
1528
1550
 
@@ -1534,26 +1556,26 @@ module Meteor
1534
1556
  # @res = @pattern.match(elm.attributes)
1535
1557
 
1536
1558
  # (検索対象属性の存在判定)
1537
- if elm.attributes.include?(String.new(' ') << attr_name << '="')
1559
+ if elm.attributes.include?(String.new(" ") << attr_name << "=\"")
1538
1560
  @_attr_value = attr_value
1539
1561
 
1540
1562
  # replace attribute (属性の置換)
1541
- @pattern = Meteor::Core::Util::PatternCache.get(String.new('') << attr_name << '="[^"]*"')
1563
+ @pattern = Meteor::Core::Util::PatternCache.get(String.new("") << attr_name << "=\"[^\"]*\"")
1542
1564
  # @pattern = Meteor::Core::Util::PatternCache.get("#{attr_name}=\"[^\"]*\"")
1543
1565
 
1544
- elm.attributes.sub!(@pattern, String.new('') << attr_name << '="' << @_attr_value << '"')
1566
+ elm.attributes.sub!(@pattern, String.new("") << attr_name << "=\"" << @_attr_value << "\"")
1545
1567
  # elm.attributes.sub!(@pattern, "#{attr_name}=\"#{@_attr_value}\"")
1546
1568
  else
1547
1569
  # add an attribute to attrubutes (属性文字列の最後に新規の属性を追加する)
1548
1570
  @_attr_value = attr_value
1549
1571
 
1550
- if '' != elm.attributes && '' != elm.attributes.strip
1551
- elm.attributes = String.new('') << ' ' << elm.attributes.strip
1572
+ if "" != elm.attributes && "" != elm.attributes.strip
1573
+ elm.attributes = String.new("") << " " << elm.attributes.strip
1552
1574
  else
1553
- elm.attributes = String.new('')
1575
+ elm.attributes = String.new("")
1554
1576
  end
1555
1577
 
1556
- elm.attributes << ' ' << attr_name << '="' << @_attr_value << '"'
1578
+ elm.attributes << " " << attr_name << "=\"" << @_attr_value << "\""
1557
1579
  # elm.attributes << " #{attr_name}=\"#{@_attr_value}\""
1558
1580
  end
1559
1581
  end
@@ -1575,7 +1597,7 @@ module Meteor
1575
1597
  def get_attr_value_(elm, attr_name)
1576
1598
 
1577
1599
  # attribute search pattern (属性検索用パターン)
1578
- @pattern = Meteor::Core::Util::PatternCache.get(String.new('') << attr_name << '="([^"]*)"')
1600
+ @pattern = Meteor::Core::Util::PatternCache.get(String.new("") << attr_name << "=\"([^\"]*)\"")
1579
1601
  # @pattern = Meteor::Core::Util::PatternCache.get("#{attr_name}=\"([^\"]*)\"")
1580
1602
 
1581
1603
  @res = @pattern.match(elm.attributes)
@@ -1597,25 +1619,25 @@ module Meteor
1597
1619
  # @param [Meteor::element] elm element (要素)
1598
1620
  # @return [Hash<String,String>] attribute map (要素マップ)
1599
1621
  #
1600
- def attrs(elm,*args)
1622
+ def attrs(elm, *args)
1601
1623
  case args.length
1602
- when ZERO
1603
- get_attrs(elm)
1604
- when ONE
1605
- if args[0].kind_of?(Hash)
1606
- if args[0].size == 1
1607
- elm.document_sync = true
1608
- set_attribute_3(elm, args[0].keys[0].to_s, args[0].values[0])
1609
- elsif args[0].size >= 1
1610
- set_attrs(elm, args[0])
1611
- else
1612
- raise ArgumentError
1613
- end
1624
+ when ZERO
1625
+ get_attrs(elm)
1626
+ when ONE
1627
+ if args[0].kind_of?(Hash)
1628
+ if args[0].size == 1
1629
+ elm.document_sync = true
1630
+ set_attribute_3(elm, args[0].keys[0].to_s, args[0].values[0])
1631
+ elsif args[0].size >= 1
1632
+ set_attrs(elm, args[0])
1614
1633
  else
1615
1634
  raise ArgumentError
1616
1635
  end
1617
1636
  else
1618
1637
  raise ArgumentError
1638
+ end
1639
+ else
1640
+ raise ArgumentError
1619
1641
  end
1620
1642
  end
1621
1643
 
@@ -1649,6 +1671,7 @@ module Meteor
1649
1671
  set_attribute_3(elm, name.to_s, value)
1650
1672
  end
1651
1673
  end
1674
+
1652
1675
  elm
1653
1676
  end
1654
1677
 
@@ -1665,17 +1688,17 @@ module Meteor
1665
1688
  # @param [Meteor::Element] elm element (要素)
1666
1689
  # @return [Meteor::AttributeMap] attribute map (属性マップ)
1667
1690
  #
1668
- def attr_map(elm,*args)
1691
+ def attr_map(elm, *args)
1669
1692
  case args.length
1670
- when ZERO
1671
- get_attr_map(elm)
1672
- when ONE
1673
- # if elm.kind_of?(Meteor::Element) && args[0].kind_of?(Meteor::AttributeMap)
1674
- elm.document_sync = true
1675
- set_attr_map(elm, args[0])
1676
- # end
1677
- else
1678
- raise ArgumentError
1693
+ when ZERO
1694
+ get_attr_map(elm)
1695
+ when ONE
1696
+ # if elm.kind_of?(Meteor::Element) && args[0].kind_of?(Meteor::AttributeMap)
1697
+ elm.document_sync = true
1698
+ set_attr_map(elm, args[0])
1699
+ # end
1700
+ else
1701
+ raise ArgumentError
1679
1702
  end
1680
1703
  end
1681
1704
 
@@ -1690,6 +1713,7 @@ module Meteor
1690
1713
  elm.attributes.scan(@@pattern_get_attrs_map) do |a, b|
1691
1714
  attrs.store(a, unescape(b))
1692
1715
  end
1716
+
1693
1717
  attrs.recordable = true
1694
1718
 
1695
1719
  attrs
@@ -1713,6 +1737,7 @@ module Meteor
1713
1737
  end
1714
1738
  end
1715
1739
  end
1740
+
1716
1741
  elm
1717
1742
  end
1718
1743
 
@@ -1738,24 +1763,24 @@ module Meteor
1738
1763
  #
1739
1764
  def content(*args)
1740
1765
  case args.length
1741
- when ONE
1742
- # if args[0].kind_of?(Meteor::Element)
1743
- get_content_1(args[0])
1766
+ when ONE
1767
+ # if args[0].kind_of?(Meteor::Element)
1768
+ get_content_1(args[0])
1744
1769
  # else
1745
1770
  # raise ArgumentError
1746
1771
  # end
1747
- when TWO
1748
- # if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String)
1749
- args[0].document_sync = true
1750
- set_content_2(args[0], args[1].to_s)
1751
- # else
1752
- # raise ArgumentError
1753
- # end
1754
- when THREE
1755
- args[0].document_sync = true
1756
- set_content_3(args[0], args[1].to_s, args[2])
1757
- else
1758
- raise ArgumentError
1772
+ when TWO
1773
+ # if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String)
1774
+ args[0].document_sync = true
1775
+ set_content_2(args[0], args[1].to_s)
1776
+ # else
1777
+ # raise ArgumentError
1778
+ # end
1779
+ when THREE
1780
+ args[0].document_sync = true
1781
+ set_content_3(args[0], args[1].to_s, args[2])
1782
+ else
1783
+ raise ArgumentError
1759
1784
  end
1760
1785
  end
1761
1786
 
@@ -1766,11 +1791,12 @@ module Meteor
1766
1791
  # @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
1767
1792
  # @return [Meteor::Element] element (要素)
1768
1793
  #
1769
- def set_content_3(elm, content, entity_ref=true)
1794
+ def set_content_3(elm, content, entity_ref = true)
1770
1795
 
1771
1796
  if entity_ref || !elm.raw_content
1772
1797
  escape_content(content, elm)
1773
1798
  end
1799
+
1774
1800
  elm.mixed_content = content
1775
1801
  elm
1776
1802
  end
@@ -1788,6 +1814,7 @@ module Meteor
1788
1814
  unless elm.raw_content
1789
1815
  escape_content(content, elm)
1790
1816
  end
1817
+
1791
1818
  elm.mixed_content = content
1792
1819
  elm
1793
1820
  end
@@ -1830,10 +1857,10 @@ module Meteor
1830
1857
 
1831
1858
  def remove_attrs_(elm, attr_name)
1832
1859
  # attribute search pattern (属性検索用パターン)
1833
- @pattern = Meteor::Core::Util::PatternCache.get(String.new('') << attr_name << '="[^"]*"\\s?')
1860
+ @pattern = Meteor::Core::Util::PatternCache.get(String.new("") << attr_name << "=\"[^\"]*\"\\s?")
1834
1861
  # @pattern = Meteor::Core::Util::PatternCache.get("#{attr_name}=\"[^\"]*\"\\s?")
1835
1862
  # replace attrubute (属性の置換)
1836
- elm.attributes.sub!(@pattern, '')
1863
+ elm.attributes.sub!(@pattern, "")
1837
1864
  end
1838
1865
 
1839
1866
  private :remove_attrs_
@@ -1861,18 +1888,19 @@ module Meteor
1861
1888
  #
1862
1889
  def cxtag(*args)
1863
1890
  case args.length
1864
- when ONE
1865
- cxtag_1(args[0].to_s)
1866
- if @elm_
1867
- @element_cache.store(@elm_.object_id, @elm_)
1868
- end
1869
- when TWO
1870
- cxtag_2(args[0].to_s, args[1].to_s)
1871
- if @elm_
1872
- @element_cache.store(@elm_.object_id, @elm_)
1873
- end
1874
- else
1875
- raise ArgumentError
1891
+ when ONE
1892
+ cxtag_1(args[0].to_s)
1893
+ if @elm_
1894
+ @element_cache.store(@elm_.object_id, @elm_)
1895
+ end
1896
+
1897
+ when TWO
1898
+ cxtag_2(args[0].to_s, args[1].to_s)
1899
+ if @elm_
1900
+ @element_cache.store(@elm_.object_id, @elm_)
1901
+ end
1902
+ else
1903
+ raise ArgumentError
1876
1904
  end
1877
1905
  end
1878
1906
 
@@ -1931,7 +1959,7 @@ module Meteor
1931
1959
 
1932
1960
  @_id = Regexp.quote(id)
1933
1961
 
1934
- @pattern_cc = String.new('') << '<!--\\s@([^<>]*)\\s[^<>]*id="' << @_id << '"'
1962
+ @pattern_cc = String.new("") << "<!--\\s@([^<>]*)\\s[^<>]*id=\"" << @_id << "\""
1935
1963
  # @pattern_cc = "<!--\\s@([^<>]*)\\s[^<>]*id=\"#{@_id}\""
1936
1964
 
1937
1965
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -1980,8 +2008,9 @@ module Meteor
1980
2008
  # edit_pattern_(item)
1981
2009
  end
1982
2010
  else
1983
- replace(item, '')
2011
+ replace(item, "")
1984
2012
  end
2013
+
1985
2014
  item.usable = false
1986
2015
  end
1987
2016
  end
@@ -1990,7 +2019,7 @@ module Meteor
1990
2019
  protected :reflect
1991
2020
 
1992
2021
  def edit_document_1(elm)
1993
- edit_document_2(elm, '/>')
2022
+ edit_document_2(elm, "/>")
1994
2023
  end
1995
2024
 
1996
2025
  private :edit_document_1
@@ -2016,17 +2045,20 @@ module Meteor
2016
2045
  # @root.hookDocument << @root.element.attributes << '-->'
2017
2046
  # @root.hookDocument << @root.element.mixed_content << '<!-- /@'
2018
2047
  # @root.hookDocument << @root.element.name << ' -->'
2019
- self.document_hook << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
2048
+ self.document_hook <<
2049
+ "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
2020
2050
 
2021
2051
  # self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
2022
2052
  else
2023
2053
  # @root.hookDocument << "<" << @root.element.name
2024
2054
  # @root.hookDocument << @root.element.attributes << '>' << @root.element.mixed_content
2025
2055
  # @root.hookDocument << '</' << @root.element.name << '>'
2026
- self.document_hook << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
2056
+ self.document_hook <<
2057
+ "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
2027
2058
 
2028
2059
  # self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
2029
2060
  end
2061
+
2030
2062
  self.element_hook = Element.new!(self.element_hook.origin, self)
2031
2063
  else
2032
2064
  reflect
@@ -2037,17 +2069,20 @@ module Meteor
2037
2069
  # @root.hookDocument << @_attributes << '-->'
2038
2070
  # @root.hookDocument << @root.document << '<!-- /@'
2039
2071
  # @root.hookDocument << @root.element.name << ' -->'
2040
- self.document_hook << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
2072
+ self.document_hook <<
2073
+ "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
2041
2074
 
2042
2075
  # self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
2043
2076
  else
2044
2077
  # @root.hookDocument << "<" << @root.element.name
2045
2078
  # @root.hookDocument << @_attributes << '>' << @root.document
2046
2079
  # @root.hookDocument << '</' << @root.element.name << '>'
2047
- self.document_hook << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
2080
+ self.document_hook <<
2081
+ "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
2048
2082
 
2049
2083
  # self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
2050
2084
  end
2085
+
2051
2086
  self.element_hook = Element.new!(self.element_hook.origin, self)
2052
2087
  end
2053
2088
  else
@@ -2061,10 +2096,10 @@ module Meteor
2061
2096
  def clean
2062
2097
  # replace CX start tag (CX開始タグ置換)
2063
2098
  @pattern = @@pattern_clean1
2064
- @root.document.gsub!(@pattern, '')
2099
+ @root.document.gsub!(@pattern, "")
2065
2100
  # rplace CX end tag (CX終了タグ置換)
2066
2101
  @pattern = @@pattern_clean2
2067
- @root.document.gsub!(@pattern, '')
2102
+ @root.document.gsub!(@pattern, "")
2068
2103
  # @root.document << "<!-- Powered by Meteor (C)Yasumasa Ashida -->"
2069
2104
  end
2070
2105
 
@@ -2090,6 +2125,7 @@ module Meteor
2090
2125
  else
2091
2126
  pif2.root_element.document = String.new(elm.document)
2092
2127
  end
2128
+
2093
2129
  pif2.root_element.kaigyo_code = elm.parser.root_element.kaigyo_code
2094
2130
 
2095
2131
  @elm_
@@ -2144,6 +2180,7 @@ module Meteor
2144
2180
  return true
2145
2181
  end
2146
2182
  end
2183
+
2147
2184
  false
2148
2185
  end
2149
2186
 
@@ -2161,18 +2198,18 @@ module Meteor
2161
2198
 
2162
2199
  def create(pif)
2163
2200
  case pif.doc_type
2164
- when Parser::HTML4
2165
- Meteor::Ml::Html4::ParserImpl.new
2166
- when Parser::XHTML4
2167
- Meteor::Ml::Xhtml4::ParserImpl.new
2168
- when Parser::HTML
2169
- Meteor::Ml::Html::ParserImpl.new
2170
- when Parser::XHTML
2171
- Meteor::Ml::Xhtml::ParserImpl.new
2172
- when Parser::XML
2173
- Meteor::Ml::Xml::ParserImpl.new
2174
- else
2175
- nil
2201
+ when Parser::HTML
2202
+ Meteor::Ml::Html::ParserImpl.new
2203
+ when Parser::XML
2204
+ Meteor::Ml::Xml::ParserImpl.new
2205
+ when Parser::XHTML
2206
+ Meteor::Ml::Xhtml::ParserImpl.new
2207
+ when Parser::HTML4
2208
+ Meteor::Ml::Html4::ParserImpl.new
2209
+ when Parser::XHTML4
2210
+ Meteor::Ml::Xhtml4::ParserImpl.new
2211
+ else
2212
+ nil
2176
2213
  end
2177
2214
  end
2178
2215