meteor 0.9.24 → 0.9.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80d59c6205221bcf3bcc849a8c70a7689eea1a91341531255341d60d58891a02
4
- data.tar.gz: eda5a84623011d29c4c842836123f0f39f81682a9dbfa40b2f1fe84bb4c8f91d
3
+ metadata.gz: 972f9396e2d45e6310cbfa0fda64ae798d10e150b7241db77cc07c954aa0a8ce
4
+ data.tar.gz: 07e9dc8c2e6f4018c3c00c6ed0d68fc2c2393c1daf43977e87fc50d9d063f40e
5
5
  SHA512:
6
- metadata.gz: d3a61991ed0eac2ce67ab6832ecfaca5ba6149996cf901ae474387e3143eb89c64163a439fb599470a68ef0f4ded6558fb2c02cce0270d37a235e344f757e2e3
7
- data.tar.gz: b3051e52c18ea7a590e149e20d49437aacfc149de2b427698d004819264031006870fe23239b35bb606d53db4b8d21fa99d9f2fadb2568024a460ea6ba182cc8
6
+ metadata.gz: e90da0e028c4cd8c41a81012fa74121c6f68d7ace825b540eea77ae9b7b8e857b99341c5eeba3c1ac0991bff7b743dad90fb406d9d95baa147c94f92cd33b214
7
+ data.tar.gz: d55c86399dcdaaf6bc11fec20bf25d4ef033e5e731014cb57e80f40b647b25d0ce6dcca84e8f1ac7c222c12142cc09362bd0782cc917c219e04a97ac0cb0df3a
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.25 / 2026-06-25 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactoring
4
+
1
5
  == 0.9.24 / 2026-06-22 Yasumasa Ashida <ys.ashida@gmail.com>
2
6
 
3
7
  * Refactoring
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.24)
4
+ meteor (0.9.25)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/demo/html.rb CHANGED
@@ -43,7 +43,7 @@ elm_text1["required"] = true
43
43
  # elm_select1['multiple'] = true # elm_select1.attr(multiple: true)
44
44
  # puts elm_select1['multiple'] # puts elm_select1.attr('multiple')
45
45
 
46
- # elm_select1.unsafe_content = "<option id=\"option12\">オプション12</option>"
46
+ # elm_select1.unsafe_content = "<option id=\"option1-2\">オプション1-2</option>"
47
47
 
48
48
  # elm_option1 = root.element('option', id: 'option1')
49
49
  # elm_option1['selected'] = true # elm_option1.attr(selected: true)
@@ -317,15 +317,15 @@ module Meteor
317
317
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>|<#{@_name}((?:|\\s[^<>]*))>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
318
318
 
319
319
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
320
- # search of content-rich element (内容あり要素検索)
320
+ # search of normal element (内容あり要素検索)
321
321
  @res = @pattern.match(@root.document)
322
322
 
323
323
  if @res
324
324
  if @res[1]
325
- element_without_1(name)
325
+ element_void_1(name)
326
326
  else
327
- # puts '---element_with_1'
328
- element_with_1(name)
327
+ # puts '---element_normal_1'
328
+ element_normal_1(name)
329
329
  end
330
330
  # else
331
331
  end
@@ -335,7 +335,7 @@ module Meteor
335
335
 
336
336
  private :element_1
337
337
 
338
- def element_with_1(name)
338
+ def element_normal_1(name)
339
339
  @elm_ = Meteor::Element.new(name)
340
340
 
341
341
  unless @on_search
@@ -356,21 +356,21 @@ module Meteor
356
356
  # document (全体)
357
357
  @elm_.document = @res[0]
358
358
  end
359
- # content-rich element search pattern (内容あり要素検索用パターン)
359
+ # normal element search pattern (内容あり要素検索用パターン)
360
360
  # @pattern_cc = String.new('') << "<" << @_name << '(?:|\\s[^<>]*)>((?!(' << @_name
361
361
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
362
362
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
363
363
 
364
364
  @elm_.pattern = @pattern_cc
365
- @elm_.empty = true
365
+ @elm_.normal = true
366
366
  @elm_.parser = self
367
367
 
368
368
  @elm_
369
369
  end
370
370
 
371
- private :element_with_1
371
+ private :element_normal_1
372
372
 
373
- def element_without_1(name)
373
+ def element_void_1(name)
374
374
  # element (要素)
375
375
  @elm_ = Meteor::Element.new(name)
376
376
  # attribute (属性)
@@ -382,14 +382,14 @@ module Meteor
382
382
  # @pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>"
383
383
  @elm_.pattern = @pattern_cc
384
384
 
385
- @elm_.empty = false
385
+ @elm_.normal = false
386
386
 
387
387
  @elm_.parser = self
388
388
 
389
389
  @elm_
390
390
  end
391
391
 
392
- private :element_without_1
392
+ private :element_void_1
393
393
 
394
394
  #
395
395
  # get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で検索し、要素を取得する)
@@ -411,7 +411,7 @@ module Meteor
411
411
  @res1 = @pattern.match(@root.document)
412
412
 
413
413
  if @res1 && @res1[1] || !@res1
414
- @res2 = element_with_3_2
414
+ @res2 = element_normal_3_2
415
415
  @pattern_cc_2 = @pattern_cc
416
416
 
417
417
  # puts @res2.captures.length
@@ -423,27 +423,27 @@ module Meteor
423
423
  @res = @res1
424
424
  # @pattern_cc = @pattern_cc_1
425
425
  if @res[1]
426
- element_without_3(name)
426
+ element_void_3(name)
427
427
  else
428
- element_with_3_1(name)
428
+ element_normal_3_1(name)
429
429
  end
430
430
  elsif @res1.begin(0) > @res2.begin(0)
431
431
  @res = @res2
432
432
  # @pattern_cc = @pattern_cc_2
433
- element_with_3_1(name)
433
+ element_normal_3_1(name)
434
434
  end
435
435
  elsif @res1 && !@res2
436
436
  @res = @res1
437
437
  # @pattern_cc = @pattern_cc_1
438
438
  if @res[1]
439
- element_without_3(name)
439
+ element_void_3(name)
440
440
  else
441
- element_with_3_1(name)
441
+ element_normal_3_1(name)
442
442
  end
443
443
  elsif @res2 && !@res1
444
444
  @res = @res2
445
445
  # @pattern_cc = @pattern_cc_2
446
- element_with_3_1(name)
446
+ element_normal_3_1(name)
447
447
  else
448
448
  if @error_check
449
449
  puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message)
@@ -470,7 +470,7 @@ module Meteor
470
470
 
471
471
  private :quote_element_3
472
472
 
473
- def element_with_3_1(name)
473
+ def element_normal_3_1(name)
474
474
  # puts @res.captures.length
475
475
  case @res.captures.length
476
476
  when FOUR
@@ -482,7 +482,7 @@ module Meteor
482
482
  @elm_.mixed_content = @res[2]
483
483
  # document (全体)
484
484
  @elm_.document = @res[0]
485
- # content-rich element search pattern (内容あり要素検索用パターン)
485
+ # normal element search pattern (内容あり要素検索用パターン)
486
486
  # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
487
487
  # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
488
488
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
@@ -490,7 +490,7 @@ module Meteor
490
490
 
491
491
  @elm_.pattern = @pattern_cc
492
492
 
493
- @elm_.empty = true
493
+ @elm_.normal = true
494
494
 
495
495
  @elm_.parser = self
496
496
  when FIVE
@@ -502,7 +502,7 @@ module Meteor
502
502
  @elm_.mixed_content = @res[3]
503
503
  # document (全体)
504
504
  @elm_.document = @res[0]
505
- # content-rich element search pattern (内容あり要素検索用パターン)
505
+ # normal element search pattern (内容あり要素検索用パターン)
506
506
  # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
507
507
  # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
508
508
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
@@ -510,7 +510,7 @@ module Meteor
510
510
 
511
511
  @elm_.pattern = @pattern_cc
512
512
 
513
- @elm_.empty = true
513
+ @elm_.normal = true
514
514
 
515
515
  @elm_.parser = self
516
516
 
@@ -530,10 +530,10 @@ module Meteor
530
530
  end
531
531
  # document (全体)
532
532
  @elm_.document = @res[0]
533
- # content-rich element search pattern (内容あり要素検索用パターン)
533
+ # normal element search pattern (内容あり要素検索用パターン)
534
534
  @elm_.pattern = @pattern_cc
535
535
 
536
- @elm_.empty = true
536
+ @elm_.normal = true
537
537
 
538
538
  @elm_.parser = self
539
539
  end
@@ -541,10 +541,10 @@ module Meteor
541
541
  @elm_
542
542
  end
543
543
 
544
- private :element_with_3_1
544
+ private :element_normal_3_1
545
545
 
546
- def element_with_3_2
547
- element_pattern_with_3_2
546
+ def element_normal_3_2
547
+ element_pattern_normal_3_2
548
548
 
549
549
  if @sbuf.length == ZERO || @cnt != ZERO
550
550
  return nil
@@ -556,9 +556,9 @@ module Meteor
556
556
  @res
557
557
  end
558
558
 
559
- private :element_with_3_2
559
+ private :element_normal_3_2
560
560
 
561
- def element_pattern_with_3_2
561
+ def element_pattern_normal_3_2
562
562
  # @pattern_cc_1 = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
563
563
  # @pattern_cc_1 << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
564
564
  @pattern_cc_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
@@ -577,7 +577,7 @@ module Meteor
577
577
  @pattern_cc_2_2 = String.new("") << ".*?)<\\/" << @_name << ">"
578
578
  # @pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
579
579
 
580
- # search of content-rich element (内容あり要素検索)
580
+ # search of normal element (内容あり要素検索)
581
581
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
582
582
 
583
583
  @sbuf = String.new("")
@@ -592,15 +592,15 @@ module Meteor
592
592
  @pattern_cc = @sbuf
593
593
  end
594
594
 
595
- private :element_pattern_with_3_2
595
+ private :element_pattern_normal_3_2
596
596
 
597
- def element_without_3(name)
598
- element_without_3_1(name, "\"[^<>]*)\\/>")
597
+ def element_void_3(name)
598
+ element_void_3_1(name, "\"[^<>]*)\\/>")
599
599
  end
600
600
 
601
- private :element_without_3
601
+ private :element_void_3
602
602
 
603
- def element_without_3_1(name, closer)
603
+ def element_void_3_1(name, closer)
604
604
  # element (要素)
605
605
  @elm_ = Meteor::Element.new(name)
606
606
  # attribute (属性)
@@ -616,7 +616,7 @@ module Meteor
616
616
  @elm_
617
617
  end
618
618
 
619
- private :element_without_3_1
619
+ private :element_void_3_1
620
620
 
621
621
  #
622
622
  # get element using attribute(name="value") (属性(属性名="属性値")で検索し、要素を取得する)
@@ -649,7 +649,7 @@ module Meteor
649
649
  @res1 = @pattern.match(@root.document)
650
650
 
651
651
  if @res1 && @res1[1] || !@res1
652
- @res2 = element_with_2_2
652
+ @res2 = element_normal_2_2
653
653
  @pattern_cc_2 = @pattern_cc
654
654
 
655
655
  # puts @res2.captures.length
@@ -661,27 +661,27 @@ module Meteor
661
661
  @res = @res1
662
662
  # @pattern_cc = @pattern_cc_1
663
663
  if @res[1]
664
- element_without_2
664
+ element_void_2
665
665
  else
666
- element_with_2_1
666
+ element_normal_2_1
667
667
  end
668
668
  elsif @res1.begin(0) > @res2.begin(0)
669
669
  @res = @res2
670
670
  # @pattern_cc = @pattern_cc_2
671
- element_with_2_1
671
+ element_normal_2_1
672
672
  end
673
673
  elsif @res1 && !@res2
674
674
  @res = @res1
675
675
  # @pattern_cc = @pattern_cc_1
676
676
  if @res[1]
677
- element_without_2
677
+ element_void_2
678
678
  else
679
- element_with_2_1
679
+ element_normal_2_1
680
680
  end
681
681
  elsif @res2 && !@res1
682
682
  @res = @res2
683
683
  # @pattern_cc = @pattern_cc_2
684
- element_with_2_1
684
+ element_normal_2_1
685
685
  else
686
686
  if @error_check
687
687
  puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
@@ -717,7 +717,7 @@ module Meteor
717
717
  private :element_pattern_2
718
718
 
719
719
  =begin
720
- def element_with_2_1
720
+ def element_normal_2_1
721
721
  # puts @res.captures.length
722
722
  case @res.captures.length
723
723
  when FOUR
@@ -737,7 +737,7 @@ module Meteor
737
737
  @ pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
738
738
 
739
739
  @elm_.pattern = @pattern_cc
740
- @elm_.empty = true
740
+ @elm_.normal = true
741
741
  @elm_.parser = self
742
742
  when FIVE,SEVEN
743
743
  @_name = @res[3]
@@ -756,7 +756,7 @@ module Meteor
756
756
  @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
757
757
 
758
758
  @elm_.pattern = @pattern_cc
759
- @elm_.empty = true
759
+ @elm_.normal = true
760
760
  @elm_.parser = self
761
761
  when THREE,SIX
762
762
  # puts @res[1]
@@ -773,20 +773,20 @@ module Meteor
773
773
  # pattern (内容あり要素検索用パターン)
774
774
  @elm_.pattern = @pattern_cc
775
775
 
776
- @elm_.empty = true
776
+ @elm_.normal = true
777
777
  @elm_.parser = self
778
778
  end
779
779
  @elm_
780
780
  end
781
781
 
782
- private :element_with_2_1
782
+ private :element_normal_2_1
783
783
 
784
- def element_with_2_2
784
+ def element_normal_2_2
785
785
  # @pattern_cc_1 = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
786
786
  # @pattern_cc_1 << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
787
787
  @pattern_cc_1 = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
788
788
 
789
- # search of content-rich element (内容あり要素検索)
789
+ # search of normal element (内容あり要素検索)
790
790
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
791
791
  @sbuf = String.new('')
792
792
 
@@ -804,7 +804,7 @@ module Meteor
804
804
  @res = @pattern.match(@root.document)
805
805
  end
806
806
 
807
- private :element_with_2_2
807
+ private :element_normal_2_2
808
808
 
809
809
  def create_pattern_2(args_cnt)
810
810
  @pattern_cc_1b = String.new('') << "<" << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
@@ -821,13 +821,13 @@ module Meteor
821
821
  @pattern_1b = Meteor::Core::Util::PatternCache.get(@pattern_cc_1b)
822
822
  end
823
823
 
824
- def element_without_2
825
- element_without_2_1('"[^<>]*\\/>')
824
+ def element_void_2
825
+ element_void_2_1('"[^<>]*\\/>')
826
826
  end
827
827
 
828
- private :element_without_2
828
+ private :element_void_2
829
829
 
830
- def element_without_2_1(closer)
830
+ def element_void_2_1(closer)
831
831
  # element (要素)
832
832
  @elm_ = Element.new(@res[1])
833
833
  # attribute (属性)
@@ -842,7 +842,7 @@ module Meteor
842
842
  @elm_
843
843
  end
844
844
 
845
- private :element_without_2_1
845
+ private :element_void_2_1
846
846
  =end
847
847
 
848
848
  #
@@ -863,7 +863,7 @@ module Meteor
863
863
  @res1 = @pattern.match(@root.document)
864
864
 
865
865
  if @res1 && @res1[1] || !@res1
866
- @res2 = element_with_5_2
866
+ @res2 = element_normal_5_2
867
867
  @pattern_cc_2 = @pattern_cc
868
868
 
869
869
  # puts @res2.captures.length
@@ -875,27 +875,27 @@ module Meteor
875
875
  @res = @res1
876
876
  # @pattern_cc = @pattern_cc_1
877
877
  if @res[1]
878
- element_without_5(name)
878
+ element_void_5(name)
879
879
  else
880
- element_with_5_1(name)
880
+ element_normal_5_1(name)
881
881
  end
882
882
  elsif @res1.begin(0) > @res2.begin(0)
883
883
  @res = @res2
884
884
  # @pattern_cc = @pattern_cc_2
885
- element_with_5_1(name)
885
+ element_normal_5_1(name)
886
886
  end
887
887
  elsif @res1 && !@res2
888
888
  @res = @res1
889
889
  # @pattern_cc = @pattern_cc_1
890
890
  if @res[1]
891
- element_without_5(name)
891
+ element_void_5(name)
892
892
  else
893
- element_with_5_1(name)
893
+ element_normal_5_1(name)
894
894
  end
895
895
  elsif @res2 && !@res1
896
896
  @res = @res2
897
897
  # @pattern_cc = @pattern_cc_2
898
- element_with_5_1(name)
898
+ element_normal_5_1(name)
899
899
  else
900
900
  if @error_check
901
901
  puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message)
@@ -919,7 +919,7 @@ module Meteor
919
919
 
920
920
  private :quote_element_5
921
921
 
922
- def element_with_5_1(name)
922
+ def element_normal_5_1(name)
923
923
 
924
924
  # puts @res.captures.length
925
925
  case @res.captures.length
@@ -942,7 +942,7 @@ module Meteor
942
942
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
943
943
 
944
944
  @elm_.pattern = @pattern_cc
945
- @elm_.empty = true
945
+ @elm_.normal = true
946
946
  @elm_.parser = self
947
947
  when FIVE
948
948
  # element (要素)
@@ -963,7 +963,7 @@ module Meteor
963
963
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
964
964
 
965
965
  @elm_.pattern = @pattern_cc
966
- @elm_.empty = true
966
+ @elm_.normal = true
967
967
  @elm_.parser = self
968
968
 
969
969
  when THREE, SIX
@@ -975,20 +975,20 @@ module Meteor
975
975
  @elm_.mixed_content = @res[3]
976
976
  # document (全体)
977
977
  @elm_.document = @res[0]
978
- # content-rich element search pattern (要素ありタグ検索用パターン)
978
+ # normal element search pattern (要素ありタグ検索用パターン)
979
979
  @elm_.pattern = @pattern_cc
980
980
 
981
- @elm_.empty = true
981
+ @elm_.normal = true
982
982
  @elm_.parser = self
983
983
  end
984
984
 
985
985
  @elm_
986
986
  end
987
987
 
988
- private :element_with_5_1
988
+ private :element_normal_5_1
989
989
 
990
- def element_with_5_2
991
- element_pattern_with_5_2
990
+ def element_normal_5_2
991
+ element_pattern_normal_5_2
992
992
 
993
993
  if @sbuf.length == ZERO || @cnt != ZERO
994
994
  return nil
@@ -1000,9 +1000,9 @@ module Meteor
1000
1000
  @res
1001
1001
  end
1002
1002
 
1003
- private :element_with_5_2
1003
+ private :element_normal_5_2
1004
1004
 
1005
- def element_pattern_with_5_2
1005
+ def element_pattern_normal_5_2
1006
1006
 
1007
1007
  # @pattern_cc_1 = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
1008
1008
  # @pattern_cc_1 << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
@@ -1029,7 +1029,7 @@ module Meteor
1029
1029
  # @pattern_cc_2_1 = ".*?<\\/#{@_name}>"
1030
1030
  # @pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
1031
1031
 
1032
- # search of content-rich element (内容あり要素検索)
1032
+ # search of normal element (内容あり要素検索)
1033
1033
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
1034
1034
 
1035
1035
  @sbuf = String.new("")
@@ -1042,15 +1042,15 @@ module Meteor
1042
1042
  @pattern_cc = @sbuf
1043
1043
  end
1044
1044
 
1045
- private :element_pattern_with_5_2
1045
+ private :element_pattern_normal_5_2
1046
1046
 
1047
- def element_without_5(name)
1048
- element_without_5_1(name, "\")[^<>]*)\\/>")
1047
+ def element_void_5(name)
1048
+ element_void_5_1(name, "\")[^<>]*)\\/>")
1049
1049
  end
1050
1050
 
1051
- private :element_without_5
1051
+ private :element_void_5
1052
1052
 
1053
- def element_without_5_1(name, closer)
1053
+ def element_void_5_1(name, closer)
1054
1054
  # element (要素)
1055
1055
  @elm_ = Meteor::Element.new(name)
1056
1056
  # attribute (属性)
@@ -1070,7 +1070,7 @@ module Meteor
1070
1070
  @elm_
1071
1071
  end
1072
1072
 
1073
- private :element_without_5_1
1073
+ private :element_void_5_1
1074
1074
 
1075
1075
  #
1076
1076
  # get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で検索し、要素を取得する)
@@ -1388,24 +1388,24 @@ module Meteor
1388
1388
  # if @res
1389
1389
  case args.size
1390
1390
  when ONE
1391
- if @elm_.empty
1392
- element_with_1(@elm_.name)
1391
+ if @elm_.normal
1392
+ element_normal_1(@elm_.name)
1393
1393
  else
1394
- element_without_1(@elm_.name)
1394
+ element_void_1(@elm_.name)
1395
1395
  end
1396
1396
 
1397
1397
  when TWO, THREE
1398
- if @elm_.empty
1399
- element_with_3_1(@elm_.name)
1398
+ if @elm_.normal
1399
+ element_normal_3_1(@elm_.name)
1400
1400
  else
1401
- element_without_3(@elm_.name)
1401
+ element_void_3(@elm_.name)
1402
1402
  end
1403
1403
 
1404
1404
  when FOUR, FIVE
1405
- if @elm_.empty
1406
- element_with_5_1(@elm_.name)
1405
+ if @elm_.normal
1406
+ element_normal_5_1(@elm_.name)
1407
1407
  else
1408
- element_without_5(@elm_.name)
1408
+ element_void_5(@elm_.name)
1409
1409
  end
1410
1410
  end
1411
1411
 
@@ -1846,7 +1846,7 @@ module Meteor
1846
1846
  #
1847
1847
  def get_content_1(elm)
1848
1848
  if !elm.cx
1849
- if elm.empty
1849
+ if elm.normal
1850
1850
  unescape_content(elm.mixed_content, elm)
1851
1851
  else
1852
1852
  nil
@@ -1955,7 +1955,7 @@ module Meteor
1955
1955
  # pattren (要素検索パターン)
1956
1956
  @elm_.pattern = @pattern_cc
1957
1957
 
1958
- @elm_.empty = true
1958
+ @elm_.normal = true
1959
1959
 
1960
1960
  @elm_.parser = self
1961
1961
  else
@@ -2073,7 +2073,7 @@ module Meteor
2073
2073
  # self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
2074
2074
  end
2075
2075
 
2076
- self.element_hook = Element.new!(self.element_hook.origin, self)
2076
+ self.element_hook = self.element_hook.origin.clone(self)
2077
2077
  else
2078
2078
  reflect
2079
2079
  @_attributes = self.element_hook.attributes
@@ -2097,7 +2097,7 @@ module Meteor
2097
2097
  # self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
2098
2098
  end
2099
2099
 
2100
- self.element_hook = Element.new!(self.element_hook.origin, self)
2100
+ self.element_hook = self.element_hook.origin.clone(self)
2101
2101
  end
2102
2102
  else
2103
2103
  reflect
@@ -2125,13 +2125,13 @@ module Meteor
2125
2125
  # @return [Meteor::Element] element (要素)
2126
2126
  #
2127
2127
  def shadow(elm)
2128
- if elm.empty
2129
- # case of content-rich element (内容あり要素の場合)
2128
+ if elm.normal
2129
+ # case of normal element (内容あり要素の場合)
2130
2130
  set_mono_info(elm)
2131
2131
 
2132
- pif2 = create(self)
2132
+ pif2 = self.class.new(self)
2133
2133
 
2134
- @elm_ = Element.new!(elm, pif2)
2134
+ @elm_ = elm.clone(pif2)
2135
2135
 
2136
2136
  if !elm.mono
2137
2137
  pif2.root_element.document = String.new(elm.mixed_content)
@@ -2209,25 +2209,6 @@ module Meteor
2209
2209
 
2210
2210
  private :is_match_s
2211
2211
 
2212
- def create(pif)
2213
- case pif.doc_type
2214
- when Parser::HTML
2215
- Meteor::Ml::Html::ParserImpl.new
2216
- when Parser::XML
2217
- Meteor::Ml::Xml::ParserImpl.new
2218
- when Parser::XHTML
2219
- Meteor::Ml::Xhtml::ParserImpl.new
2220
- when Parser::HTML4
2221
- Meteor::Ml::Html4::ParserImpl.new
2222
- when Parser::XHTML4
2223
- Meteor::Ml::Xhtml4::ParserImpl.new
2224
- else
2225
- nil
2226
- end
2227
- end
2228
-
2229
- private :create
2230
-
2231
2212
  def escape(content)
2232
2213
  # replace special character (特殊文字の置換)
2233
2214
  content = content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
@@ -17,8 +17,8 @@ module Meteor
17
17
  # @return [String] pattern (パターン)
18
18
  # @!attribute [rw] document_sync
19
19
  # @return [true,false] document update flag (ドキュメント更新フラグ)
20
- # @!attribute [rw] empty
21
- # @return [true,false] content empty flag (内容存在フラグ)
20
+ # @!attribute [rw] normal
21
+ # @return [true,false] content normal flag (内容存在フラグ)
22
22
  # @!attribute [rw] cx
23
23
  # @return [true,false] comment extension tag flag (コメント拡張タグフラグ)
24
24
  # @!attribute [rw] mono
@@ -43,7 +43,7 @@ module Meteor
43
43
  attr_accessor :raw_content
44
44
  attr_accessor :pattern
45
45
  attr_accessor :document_sync
46
- attr_accessor :empty
46
+ attr_accessor :normal
47
47
  attr_accessor :cx
48
48
  attr_accessor :mono
49
49
  attr_accessor :parser
@@ -56,6 +56,9 @@ module Meteor
56
56
  alias_method :tag, :name
57
57
  alias_method :tag=, :name=
58
58
 
59
+ alias_method :empty, :normal
60
+ alias_method :empty=, :normal=
61
+
59
62
  #
60
63
  # initializer (イニシャライザ)
61
64
  # @overload initialize(name)
@@ -77,19 +80,7 @@ module Meteor
77
80
  raise ArgumentError
78
81
  end
79
82
  when Meteor::TWO
80
- @name = args[0].name
81
- @attributes = String.new(args[0].attributes)
82
- @mixed_content = String.new(args[0].mixed_content)
83
- # @pattern = String.new(args[0].pattern)
84
- @pattern = args[0].pattern
85
- @document = String.new(args[0].document)
86
- @empty = args[0].empty
87
- @cx = args[0].cx
88
- @mono = args[0].mono
89
- @parser = args[1]
90
- # @usable = false
91
- @origin = args[0]
92
- args[0].copy = self
83
+ initialize_2(args[0], args[1])
93
84
  when Meteor::ZERO
94
85
  else
95
86
  raise ArgumentError
@@ -107,7 +98,7 @@ module Meteor
107
98
  # @pattern = nil
108
99
  # @document = nil
109
100
  # @parser=nil
110
- # @empty = false
101
+ # @normal = false
111
102
  # @cx = false
112
103
  # @mono = false
113
104
  # @parent = false
@@ -121,45 +112,57 @@ module Meteor
121
112
  # @param [Meteor::Element] elm element (要素)
122
113
  #
123
114
  def initialize_e(elm)
115
+ if self.normal
116
+ self.parser.element(elm)
117
+ else
118
+ @name = elm.name
119
+ @attributes = String.new(elm.attributes)
120
+ # @pattern = String.new(elm.pattern)
121
+ @pattern = elm.pattern
122
+ @document = String.new(elm.document)
123
+ @normal = elm.normal
124
+ @cx = elm.cx
125
+ @mono = elm.mono
126
+ @origin = elm
127
+ @parser = elm.parser
128
+ @usable = true
129
+ end
130
+ end
131
+
132
+ private :initialize_e
133
+
134
+ def initialize_2(elm, ps)
124
135
  @name = elm.name
125
136
  @attributes = String.new(elm.attributes)
137
+ @mixed_content = String.new(elm.mixed_content)
126
138
  # @pattern = String.new(elm.pattern)
127
139
  @pattern = elm.pattern
128
140
  @document = String.new(elm.document)
129
- @empty = elm.empty
141
+ @normal = elm.normal
130
142
  @cx = elm.cx
131
143
  @mono = elm.mono
144
+ @parser = ps
145
+ # @usable = false
132
146
  @origin = elm
133
- @parser = elm.parser
134
- @usable = true
147
+ elm.copy = self
135
148
  end
136
149
 
137
- private :initialize_e
150
+ private :initialize_2
138
151
 
139
152
  #
140
- # make copy (コピーを作成する)
141
- # @overload new!(elm,ps)
142
- # @param [Meteor::Element] elm element (要素)
153
+ # clone (複製する)
154
+ # @overload clone()
155
+ # @return [Meteor::Element] element (要素)
156
+ # @overload clone(ps)
143
157
  # @param [Meteor::Parser] ps parser (パーサ)
144
158
  # @return [Meteor::Element] element (要素)
145
159
  #
146
- def self.new!(*args)
160
+ def clone(*args)
147
161
  case args.length
148
- when Meteor::TWO
149
- @obj = args[1].element_hook
150
- if @obj
151
- @obj.attributes = String.new(args[0].attributes)
152
- @obj.mixed_content = String.new(args[0].mixed_content)
153
- # @obj.pattern = String.new(args[0].pattern)
154
- @obj.document = String.new(args[0].document)
155
- @obj
156
- else
157
- @obj = self.new(args[0], args[1])
158
- args[1].element_hook = @obj
159
- @obj
160
- end
161
- else
162
- raise ArgumentError
162
+ when Meteor::ZERO
163
+ clone_0
164
+ when Meteor::ONE
165
+ clone_1(args[0])
163
166
  end
164
167
  end
165
168
 
@@ -167,7 +170,7 @@ module Meteor
167
170
  # clone (複製する)
168
171
  # @return [Meteor::Element] element (要素)
169
172
  #
170
- def clone
173
+ def clone_0
171
174
  obj = self.parser.element_cache[self.object_id]
172
175
  if obj
173
176
  obj.attributes = String.new(self.attributes)
@@ -177,12 +180,36 @@ module Meteor
177
180
  obj.usable = true
178
181
  obj
179
182
  else
180
- obj = self.new(self)
183
+ obj = self.class.new(self)
181
184
  self.parser.element_cache[self.object_id] = obj
182
185
  obj
183
186
  end
184
187
  end
185
188
 
189
+ private :clone_0
190
+
191
+ #
192
+ # clone (複製する)
193
+ # @param [Meteor::Parser] ps parser (パーサ)
194
+ # @return [Meteor::Element] element (要素)
195
+ #
196
+ def clone_1(ps)
197
+ obj = ps.element_hook
198
+ if obj
199
+ obj.attributes = String.new(self.attributes)
200
+ obj.mixed_content = String.new(self.mixed_content)
201
+ # obj.pattern = String.new(self.pattern)
202
+ obj.document = String.new(self.document)
203
+ obj
204
+ else
205
+ obj = self.class.new(self, ps)
206
+ ps.element_hook = obj
207
+ obj
208
+ end
209
+ end
210
+
211
+ private :clone_1
212
+
186
213
  #
187
214
  # set document (ドキュメントをセットする)
188
215
  # @param [String] doc document (ドキュメント)
@@ -205,7 +232,7 @@ module Meteor
205
232
  # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
206
233
  @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
207
234
  else
208
- if @empty
235
+ if @normal
209
236
  # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
210
237
  @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
211
238
  else
@@ -218,7 +245,7 @@ module Meteor
218
245
  # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
219
246
  @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
220
247
  else
221
- if @empty
248
+ if @normal
222
249
  # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
223
250
  @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
224
251
  else
@@ -195,7 +195,7 @@ module Meteor
195
195
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
196
196
  @res = @pattern.match(@root.document)
197
197
  if @res
198
- element_without_1(name)
198
+ element_void_1(name)
199
199
  else
200
200
  if @error_check
201
201
  puts(Meteor::Exception::NoSuchElementException.new(name).message)
@@ -204,18 +204,18 @@ module Meteor
204
204
  @elm_ = nil
205
205
  end
206
206
  else
207
- # content-rich element search pattern (内容あり要素検索用パターン()
207
+ # normal element search pattern (内容あり要素検索用パターン()
208
208
  # @pattern_cc = String.new('') << "<" << @_name << '(|\\s[^<>]*)>(((?!(' << @_name
209
209
  # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
210
210
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
211
211
 
212
212
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
213
- # search of content-rich element (内容あり要素検索)
213
+ # search of normal element (内容あり要素検索)
214
214
  @res = @pattern.match(@root.document)
215
- # case of content-rich element (内容あり要素の場合)
215
+ # case of normal element (内容あり要素の場合)
216
216
  if @res
217
217
  @on_search = true
218
- element_with_1(name)
218
+ element_normal_1(name)
219
219
  else
220
220
  if @error_check
221
221
  puts(Meteor::Exception::NoSuchElementException.new(name).message)
@@ -230,7 +230,7 @@ module Meteor
230
230
 
231
231
  private :element_1
232
232
 
233
- def element_without_1(name)
233
+ def element_void_1(name)
234
234
  @elm_ = Meteor::Element.new(name)
235
235
  # attribute (属性)
236
236
  @elm_.attributes = @res[1]
@@ -242,7 +242,7 @@ module Meteor
242
242
  @elm_.parser = self
243
243
  end
244
244
 
245
- private :element_without_1
245
+ private :element_void_1
246
246
 
247
247
  #
248
248
  # get element using tag name and attribute(name="value") (要素のタグ名、属性(属性名="属性値")で検索し、要素を取得する)
@@ -270,7 +270,7 @@ module Meteor
270
270
  # void element search (空要素検索)
271
271
  @res = @pattern.match(@root.document)
272
272
  if @res
273
- element_without_3(name)
273
+ element_void_3(name)
274
274
  else
275
275
  if @error_check
276
276
  puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message)
@@ -279,22 +279,22 @@ module Meteor
279
279
  @elm_ = nil
280
280
  end
281
281
  else
282
- # content-rich element search pattern (内容あり要素検索パターン)
282
+ # normal element search pattern (内容あり要素検索パターン)
283
283
  # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
284
284
  # @pattern_cc << @_attr_value << '"[^<>]*)>(((?!(' << @_name
285
285
  # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
286
286
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
287
287
 
288
288
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
289
- # search of content-rich element (内容あり要素検索)
289
+ # search of normal element (内容あり要素検索)
290
290
  @res = @pattern.match(@root.document)
291
291
 
292
292
  if !@res && !is_match(@@match_tag_nne, name)
293
- @res = element_with_3_2
293
+ @res = element_normal_3_2
294
294
  end
295
295
 
296
296
  if @res
297
- element_with_3_1(name)
297
+ element_normal_3_1(name)
298
298
  else
299
299
  if @error_check
300
300
  puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message)
@@ -309,11 +309,11 @@ module Meteor
309
309
 
310
310
  private :element_3
311
311
 
312
- def element_without_3(name)
313
- element_without_3_1(name, "\"[^<>]*)>")
312
+ def element_void_3(name)
313
+ element_void_3_1(name, "\"[^<>]*)>")
314
314
  end
315
315
 
316
- private :element_without_3
316
+ private :element_void_3
317
317
 
318
318
  #
319
319
  # get element using attribute(name="value") (属性(属性名="属性値")で検索し、要素を取得する)
@@ -373,7 +373,7 @@ module Meteor
373
373
  @res = @pattern.match(@root.document)
374
374
 
375
375
  if @res
376
- element_without_5(name)
376
+ element_void_5(name)
377
377
  else
378
378
  if @error_check
379
379
  puts(
@@ -386,7 +386,7 @@ module Meteor
386
386
  @elm_ = nil
387
387
  end
388
388
  else
389
- # content-rich element search pattern (内容あり要素検索パターン)
389
+ # normal element search pattern (内容あり要素検索パターン)
390
390
  # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
391
391
  # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
392
392
  # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
@@ -396,15 +396,15 @@ module Meteor
396
396
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
397
397
 
398
398
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
399
- # search of content-rich element (内容あり要素検索)
399
+ # search of normal element (内容あり要素検索)
400
400
  @res = @pattern.match(@root.document)
401
401
 
402
402
  if !@res && !is_match(@@match_tag_nne, tag)
403
- @res = element_with_5_2
403
+ @res = element_normal_5_2
404
404
  end
405
405
 
406
406
  if @res
407
- element_with_5_1(name)
407
+ element_normal_5_1(name)
408
408
  else
409
409
  if @error_check
410
410
  puts(
@@ -423,11 +423,11 @@ module Meteor
423
423
 
424
424
  private :element_5
425
425
 
426
- def element_without_5(name)
427
- element_without_5_1(name, "\")[^<>]*)>")
426
+ def element_void_5(name)
427
+ element_void_5_1(name, "\")[^<>]*)>")
428
428
  end
429
429
 
430
- private :element_without_5
430
+ private :element_void_5
431
431
 
432
432
  #
433
433
  # get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で検索し、要素を取得する)
data/lib/meteor.rb CHANGED
@@ -36,11 +36,11 @@ require "meteor/ml/xml/parser_impl"
36
36
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
37
37
  #
38
38
  # @author Yasumasa Ashida
39
- # @version 0.9.24
39
+ # @version 0.9.25
40
40
  #
41
41
 
42
42
  module Meteor
43
- VERSION = "0.9.24"
43
+ VERSION = "0.9.25"
44
44
 
45
45
  # require 'fileutils'
46
46
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meteor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.24
4
+ version: 0.9.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida