meteor 0.9.40 → 0.9.42

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: a8a5ce47fc5de4ccdb94ed15e152a80efe36dc1765ca73e5b864d03bdc6feac7
4
- data.tar.gz: 820d8b7df1c57df54a31099a3191a2d54798e729748aa98516f4d36158b2887f
3
+ metadata.gz: 06e3af4f688641740f8ca20eccb680649355e66a6d370c5a9f09dc63ef2a5fea
4
+ data.tar.gz: d9a404cf2d03bc439a6b88f7aa60d39add1a7d49ed57fa46a9348339fefa75d4
5
5
  SHA512:
6
- metadata.gz: f3698775f588bfc8b5ceeca48cf5ffef533cc028822e986a7a98283547740f75c6f22a3035565defcbc7ccc990b0d30a375a2416bd10f8022d3b7348084840b5
7
- data.tar.gz: 28b21ad8f65b972f5dd3dfdcdb7f60e6407e575d7c6e1d5e8f8c586776f68230005242a3d3251659b9b978a4e5bcfd6456b21e161169bb734b4afd31696e90b0
6
+ metadata.gz: cce916500df8f9e7e3648d7144d3a9b68e0c4df21cd8ca70a0f5b667b8746897d5daca0fe8f741b757ec6ec052e4d768ef0646beb9d2990e9936370c646766b7
7
+ data.tar.gz: 6d2d1e9f403946998c2ec58123853021e8fc30adcd6602f425cbfb4a6f221c49c5ad6f55b014b9d4ccf2ce0eebf41e6670fb69721497a852605f12ed530347f0
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.42 / 2026-07-21 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactor Meteor::Element
4
+
5
+ == 0.9.41 / 2026-07-14 Yasumasa Ashida <ys.ashida@gmail.com>
6
+
7
+ * Remove unnecessary comments
8
+
1
9
  == 0.9.40 / 2026-07-13 Yasumasa Ashida <ys.ashida@gmail.com>
2
10
 
3
11
  * Fix comments
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.40)
4
+ meteor (0.9.42)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -41,9 +41,9 @@ PLATFORMS
41
41
  ruby
42
42
 
43
43
  DEPENDENCIES
44
- bundler (~> 4.0.15)
44
+ bundler (~> 4.0.16)
45
45
  meteor!
46
46
  rubocop (~> 1.88.2)
47
47
 
48
48
  BUNDLED WITH
49
- 4.0.15
49
+ 4.0.16
@@ -45,8 +45,6 @@ module Meteor
45
45
  RE_FIND_FOUR = Regexp.new(PATTERN_FIND_FOUR)
46
46
  RE_FIND_FIVE = Regexp.new(PATTERN_FIND_FIVE)
47
47
 
48
- RE_CHILDLESS = Regexp.new('\\A[^<>]*\\Z')
49
-
50
48
  RE_GET_ATTRS_MAP = Regexp.new('([^\\s]*)="([^\"]*)"')
51
49
 
52
50
  RE_CLEAN_ONE = Regexp.new('<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->')
@@ -330,8 +328,6 @@ module Meteor
330
328
  end
331
329
  @elm_.document = @res[0]
332
330
  # normal element search pattern (内容あり要素検索用パターン)
333
- # @pattern_cc = String.new('') << "<" << @_name << '(?:|\\s[^<>]*)>((?!(' << @_name
334
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
335
331
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
336
332
 
337
333
  @elm_.pattern = @pattern_cc
@@ -454,9 +450,6 @@ module Meteor
454
450
  # document (全体)
455
451
  @elm_.document = @res[0]
456
452
  # normal element search pattern (内容あり要素検索用パターン)
457
- # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
458
- # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
459
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
460
453
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
461
454
 
462
455
  @elm_.pattern = @pattern_cc
@@ -474,9 +467,6 @@ module Meteor
474
467
  # document (全体)
475
468
  @elm_.document = @res[0]
476
469
  # normal element search pattern (内容あり要素検索用パターン)
477
- # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
478
- # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
479
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
480
470
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
481
471
 
482
472
  @elm_.pattern = @pattern_cc
@@ -526,13 +516,9 @@ module Meteor
526
516
  private :element_normal_three_two
527
517
 
528
518
  def element_pattern_normal_three_two # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
529
- # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
530
- # @pattern_cc_one << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
531
519
  @pattern_cc_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
532
520
  @pattern_cc_oneb = String.new('') << '<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
533
521
  # @pattern_cc_oneb = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
534
- # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
535
- # @pattern_cc_one_one << @_attr_value << '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
536
522
  @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
537
523
  @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
538
524
  # @pattern_cc_one_two = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
@@ -575,8 +561,6 @@ module Meteor
575
561
  # document (全体)
576
562
  @elm_.document = @res[0]
577
563
  # pattern (空要素検索用パターン)
578
- # @pattern_cc = String.new("") << "<" << @_name << "(\\s[^<>]*"
579
- # << @_attr_name << "=\"" << @_attr_value << closer
580
564
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}#{closer}"
581
565
  @elm_.pattern = @pattern_cc
582
566
  @elm_.parser = self
@@ -673,10 +657,8 @@ module Meteor
673
657
  private :quote_attribute
674
658
 
675
659
  def element_pattern_two
676
- # # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
677
- # << @_attr_name << '="' << @_attr_value << '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
678
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
679
- # << @_attr_name << '="' << @_attr_value << '"'
660
+ ## @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
661
+ ## << @_attr_name << '="' << @_attr_value << '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
680
662
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\""
681
663
  end
682
664
 
@@ -696,9 +678,6 @@ module Meteor
696
678
  # # document (全体)
697
679
  # @elm_.document = @res[0]
698
680
  # # pattern (内容あり要素検索用パターン)
699
- # # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
700
- # # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
701
- # # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
702
681
  # @ pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
703
682
  #
704
683
  # @elm_.pattern = @pattern_cc
@@ -715,9 +694,6 @@ module Meteor
715
694
  # # document (全体)
716
695
  # @elm_.document = @res[0]
717
696
  # # pattern (内容あり要素検索用パターン)
718
- # # @pattern_cc = String.new()<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
719
- # # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
720
- # # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
721
697
  # @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
722
698
  #
723
699
  # @elm_.pattern = @pattern_cc
@@ -747,8 +723,6 @@ module Meteor
747
723
  # private :element_normal_two_one
748
724
  #
749
725
  # def element_normal_two_two
750
- # # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
751
- # # @pattern_cc_one << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
752
726
  # @pattern_cc_one = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
753
727
  #
754
728
  # # search of normal element (内容あり要素検索)
@@ -774,8 +748,6 @@ module Meteor
774
748
  # def create_pattern_two(args_cnt)
775
749
  # @pattern_cc_oneb = String.new('') << "<" << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
776
750
  #
777
- # # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
778
- # # @pattern_cc_one_one << @_attr_value << '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
779
751
  # @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
780
752
  # @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
781
753
  # @pattern_cc_two = String.new('') << '<\\/' << @_name << '>'
@@ -894,12 +866,6 @@ module Meteor
894
866
  # document (全体)
895
867
  @elm_.document = @res[0]
896
868
  # pattern (内容あり要素検索用パターン)
897
- # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*(?:' << @_attr_name1 << '="'
898
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
899
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
900
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
901
- # @pattern_cc << @_attr_value1 << '")[^<>]*>((?!(' << @_name
902
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
903
869
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
904
870
 
905
871
  @elm_.pattern = @pattern_cc
@@ -915,12 +881,6 @@ module Meteor
915
881
  # documement (全体)
916
882
  @elm_.document = @res[0]
917
883
  # pattern (内容あり要素検索用パターン)
918
- # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*(?:' << @_attr_name1 << '="'
919
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
920
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
921
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
922
- # @pattern_cc << @_attr_value1 << '")[^<>]*>((?!(' << @_name
923
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
924
884
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
925
885
 
926
886
  @elm_.pattern = @pattern_cc
@@ -962,20 +922,10 @@ module Meteor
962
922
  private :element_normal_five_two
963
923
 
964
924
  def element_pattern_normal_five_two # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
965
- # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
966
- # @pattern_cc_one << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
967
- # @pattern_cc_one << @_attr_value2 << '"|' << @_attr_name2 << '="'
968
- # @pattern_cc_one << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
969
- # @pattern_cc_one << @_attr_value1 << '")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))'
970
925
  @pattern_cc_one = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
971
926
  @pattern_cc_oneb = String.new('') << '<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
972
927
  # @pattern_cc_oneb = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
973
928
 
974
- # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
975
- # @pattern_cc_one_one << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
976
- # @pattern_cc_one_one << @_attr_value2 << '"|' << @_attr_name2 << '="'
977
- # @pattern_cc_one_one << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
978
- # @pattern_cc_one_one << @_attr_value1 << '")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
979
929
  @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
980
930
  @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
981
931
  @pattern_cc_two = String.new('') << '<\\/' << @_name << '>'
@@ -1016,11 +966,6 @@ module Meteor
1016
966
  # document (全体)
1017
967
  @elm_.document = @res[0]
1018
968
  # pattern (空要素検索用パターン)
1019
- # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*(?:' << @_attr_name1 << '="'
1020
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
1021
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
1022
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
1023
- # @pattern_cc << @_attr_value1 << closer
1024
969
  @pattern_cc = "<#{@_name}(\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}" # rubocop:disable Layout/LineLength
1025
970
  @elm_.pattern = @pattern_cc
1026
971
  @elm_.parser = self
@@ -1074,11 +1019,6 @@ module Meteor
1074
1019
  private :quote_element_four
1075
1020
 
1076
1021
  def element_pattern_four
1077
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s([^<>]*(' << @_attr_name1 << '="'
1078
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
1079
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
1080
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
1081
- # @pattern_cc << @_attr_value1 << '"'
1082
1022
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")" # rubocop:disable Layout/LineLength
1083
1023
  end
1084
1024
 
@@ -1495,8 +1435,8 @@ module Meteor
1495
1435
  @pattern = Meteor::Core::Util::PatternCache.get(String.new('') << attr_name << '="[^"]*"')
1496
1436
  # @pattern = Meteor::Core::Util::PatternCache.get("#{attr_name}=\"[^\"]*\"")
1497
1437
 
1438
+ # elm.attributes.sub!(@pattern, "#{attr_name}=\"#{@_attr_value}\"")
1498
1439
  elm.attributes.sub!(@pattern, String.new('') << attr_name << '="' << @_attr_value << '"')
1499
- # elm.attributes.sub!(@pattern, "#{attr_name}=\"#{@_attr_value}\"")
1500
1440
  else
1501
1441
  # add an attribute to attrubutes (属性文字列の最後に新規の属性を追加する)
1502
1442
 
@@ -1828,8 +1768,6 @@ module Meteor
1828
1768
  @_id = Regexp.quote(id)
1829
1769
 
1830
1770
  # CX tag search pattern (CXタグ検索用パターン)
1831
- # @pattern_cc = String.new('') << "<!--\\s@" << @_name << '\\s([^<>]*id="'
1832
- # @pattern_cc << id << '"[^<>]*)-->(((?!(<!--\\s/@' << @_name << ")).)*)<!--\\s/@" << @_name << "\\s-->"
1833
1771
  # @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s\\/@#{@_name})).)*)<!--\\s\\/@#{@_name}\\s-->" # rubocop:disable Layout/LineLength
1834
1772
  @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s/@#{@_name})).)*)<!--\\s/@#{@_name}\\s-->" # rubocop:disable Layout/LineLength
1835
1773
 
@@ -1951,19 +1889,12 @@ module Meteor
1951
1889
  if element_hook
1952
1890
  if element_hook.origin.childless
1953
1891
  if element_hook.origin.cx
1954
- # @root.hookDocument << '<!-- @' << @root.element.name << ' '
1955
- # @root.hookDocument << @root.element.attributes << '-->'
1956
- # @root.hookDocument << @root.element.mixed_content << '<!-- /@'
1957
- # @root.hookDocument << @root.element.name << ' -->'
1958
1892
  document_hook <<
1959
1893
  "<!-- @#{element_hook.name} #{element_hook.attributes}-->#{element_hook.mixed_content}<!-- /@#{element_hook.name} -->" # rubocop:disable Layout/LineLength
1960
1894
 
1961
1895
  # self.document_hook << @root.newline <<
1962
1896
  # "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->" # rubocop:disable Layout/LineLength
1963
1897
  else
1964
- # @root.hookDocument << "<" << @root.element.name
1965
- # @root.hookDocument << @root.element.attributes << '>' << @root.element.mixed_content
1966
- # @root.hookDocument << '</' << @root.element.name << '>'
1967
1898
  document_hook <<
1968
1899
  "<#{element_hook.name}#{element_hook.attributes}>#{element_hook.mixed_content}</#{element_hook.name}>"
1969
1900
 
@@ -1976,22 +1907,15 @@ module Meteor
1976
1907
  @_attributes = element_hook.attributes
1977
1908
 
1978
1909
  if element_hook.origin.cx
1979
- # @root.hookDocument << '<!-- @' << @root.element.name << ' '
1980
- # @root.hookDocument << @_attributes << '-->'
1981
- # @root.hookDocument << @root.document << '<!-- /@'
1982
- # @root.hookDocument << @root.element.name << ' -->'
1983
1910
  document_hook <<
1984
1911
  "<!-- @#{element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{element_hook.name} -->"
1985
1912
 
1986
- # self.document_hook << @root.newline << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->" # rubocop:disable Layout/LineLength
1913
+ # self.document_hook << @root.newline << "<!-- @#{element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{element_hook.name} -->" # rubocop:disable Layout/LineLength
1987
1914
  else
1988
- # @root.hookDocument << "<" << @root.element.name
1989
- # @root.hookDocument << @_attributes << '>' << @root.document
1990
- # @root.hookDocument << '</' << @root.element.name << '>'
1991
1915
  document_hook <<
1992
1916
  "<#{element_hook.name}#{@_attributes}>#{@root.document}</#{element_hook.name}>"
1993
1917
 
1994
- # self.document_hook << @root.newline << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>" # rubocop:disable Layout/LineLength
1918
+ # document_hook << @root.newline << "<#{element_hook.name}#{@_attributes}>#{@root.document}</#{element_hook.name}>" # rubocop:disable Layout/LineLength
1995
1919
  end
1996
1920
 
1997
1921
  end
@@ -2021,12 +1945,9 @@ module Meteor
2021
1945
  # @param [Meteor::Element] elm element (要素)
2022
1946
  # @return [Meteor::Element] element (要素)
2023
1947
  #
2024
- def shadow(elm) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1948
+ def shadow(elm) # rubocop:disable Metrics/AbcSize
2025
1949
  return unless elm.normal
2026
1950
 
2027
- # case of normal element (内容あり要素の場合)
2028
- self.childless = elm
2029
-
2030
1951
  pif2 = self.class.new(self)
2031
1952
 
2032
1953
  @elm_ = elm.clone(pif2)
@@ -2044,14 +1965,6 @@ module Meteor
2044
1965
 
2045
1966
  # private :shadow
2046
1967
 
2047
- def childless=(elm)
2048
- @res = RE_CHILDLESS.match(elm.mixed_content)
2049
-
2050
- elm.childless = true if @res
2051
- end
2052
-
2053
- private :childless=
2054
-
2055
1968
  def match?(regex, str)
2056
1969
  case regex
2057
1970
  when Regexp
@@ -21,8 +21,6 @@ module Meteor
21
21
  # @return [true,false] content normal flag (内容存在フラグ)
22
22
  # @!attribute [rw] cx
23
23
  # @return [true,false] comment extension tag flag (コメント拡張タグフラグ)
24
- # @!attribute [rw] childless
25
- # @return [true,false] child childless flag (子要素なしフラグ)
26
24
  # @!attribute [rw] parser
27
25
  # @return [Meteor::Parser] parser(パーサ)
28
26
  # @!attribute [rw] type_value
@@ -37,7 +35,7 @@ module Meteor
37
35
  # @return [true,false] deletion flag (削除フラグ)
38
36
  #
39
37
  class Element # rubocop:disable Metrics/ClassLength
40
- attr_accessor :name, :attributes, :mixed_content, :raw_content, :pattern, :document_sync, :normal, :cx, :childless,
38
+ attr_accessor :name, :attributes, :mixed_content, :raw_content, :pattern, :document_sync, :normal, :cx,
41
39
  :parser, :type_value, :usable, :origin, :copy, :removed
42
40
 
43
41
  alias tag name
@@ -46,8 +44,7 @@ module Meteor
46
44
  alias empty normal
47
45
  alias empty= normal=
48
46
 
49
- alias mono childless
50
- alias mono= childless=
47
+ RE_CHILDLESS = Regexp.new('\\A[^<>]*\\Z')
51
48
 
52
49
  #
53
50
  # initializer (イニシャライザ)
@@ -90,7 +87,6 @@ module Meteor
90
87
  # @parser=nil
91
88
  # @normal = false
92
89
  # @cx = false
93
- # @childless = false
94
90
  # @parent = false
95
91
  @usable = true
96
92
  end
@@ -108,7 +104,7 @@ module Meteor
108
104
 
109
105
  private :initialize_e
110
106
 
111
- def initialize_two(elm, ps) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Naming/MethodParameterName
107
+ def initialize_two(elm, ps) # rubocop:disable Metrics/MethodLength,Naming/MethodParameterName
112
108
  @parser = ps
113
109
  if normal
114
110
  ps.element(elm)
@@ -121,7 +117,6 @@ module Meteor
121
117
  @document = String.new(elm.document)
122
118
  @normal = elm.normal
123
119
  @cx = elm.cx
124
- @childless = elm.childless
125
120
  @origin = elm
126
121
  # @usable = false
127
122
  elm.copy = self
@@ -189,6 +184,25 @@ module Meteor
189
184
 
190
185
  private :clone_one
191
186
 
187
+ #
188
+ # get childless flag (子要素なしフラグを取得する)
189
+ # @return [true,false] childless flag (子要素なしフラグ)
190
+ #
191
+ def childless
192
+ if @childless.nil?
193
+ @res = RE_CHILDLESS.match(mixed_content)
194
+
195
+ @childless = if @res
196
+ true
197
+ else
198
+ false
199
+ end
200
+ end
201
+ @childless
202
+ end
203
+
204
+ alias mono childless
205
+
192
206
  #
193
207
  # set document (ドキュメントをセットする)
194
208
  # @param [String] doc document (ドキュメント)
@@ -208,12 +222,8 @@ module Meteor
208
222
  case @parser.doc_type
209
223
  when Parser::HTML, Parser::HTML4
210
224
  @document = if @cx
211
- # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->'
212
- # << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
213
225
  "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
214
226
  elsif @normal
215
- # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>'
216
- # << elm.mixed_content << '</' << elm.name << '>'
217
227
  "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
218
228
  else
219
229
  String.new('') << '<' << @name << @attributes << '>'
@@ -221,16 +231,12 @@ module Meteor
221
231
  end
222
232
  when Parser::XHTML, Parser::XHTML4, Parser::XML
223
233
  @document = if @cx
224
- # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->'
225
- # << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
226
234
  "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
227
235
  elsif @normal
228
- # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content
229
- # << '</' << elm.name << '>'
230
236
  "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
231
237
  else
232
238
  String.new('') << '<' << @name << @attributes << '/>'
233
- # @document = "<#{@name}#{@attributes}/>"
239
+ # "<#{@name}#{@attributes}/>"
234
240
  end
235
241
  end
236
242
  else
@@ -77,7 +77,7 @@ module Meteor
77
77
  end
78
78
 
79
79
  #
80
- # Elements Class (要素ファクトリ クラス)
80
+ # Elements Factory Class (要素ファクトリ クラス)
81
81
  #
82
82
  ElementFactory = Elements
83
83
  end
@@ -203,8 +203,6 @@ module Meteor
203
203
  end
204
204
  else
205
205
  # normal element search pattern (内容あり要素検索用パターン()
206
- # @pattern_cc = String.new('') << "<" << @_name << '(|\\s[^<>]*)>(((?!(' << @_name
207
- # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
208
206
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
209
207
 
210
208
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -258,8 +256,6 @@ module Meteor
258
256
  # case of void element (空要素の場合(<->内容あり要素の場合))
259
257
  if match?(MATCH_TAG, name)
260
258
  # void element search pattern (空要素検索パターン)
261
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
262
- # @pattern_cc << @_attr_value << '"[^<>]*)>'
263
259
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>"
264
260
 
265
261
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -274,9 +270,6 @@ module Meteor
274
270
  end
275
271
  else
276
272
  # normal element search pattern (内容あり要素検索パターン)
277
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
278
- # @pattern_cc << @_attr_value << '"[^<>]*)>(((?!(' << @_name
279
- # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
280
273
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
281
274
 
282
275
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -314,8 +307,6 @@ module Meteor
314
307
  def element_two(attr_name, attr_value) # rubocop:disable Metrics/MethodLength
315
308
  quote_attribute(attr_name, attr_value)
316
309
 
317
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*' << @_attr_name << '="' << @_attr_value
318
- # @pattern_cc << '"[^<>]*>'
319
310
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>"
320
311
 
321
312
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -349,11 +340,6 @@ module Meteor
349
340
  # case of void element (空要素の場合(<->内容あり要素の場合))
350
341
  if match?(MATCH_TAG, name)
351
342
  # void element search pattern (空要素検索パターン)
352
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
353
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
354
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
355
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
356
- # @pattern_cc << @_attr_value1 << '")[^<>]*)>'
357
343
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
358
344
 
359
345
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -375,12 +361,6 @@ module Meteor
375
361
  end
376
362
  else
377
363
  # normal element search pattern (内容あり要素検索パターン)
378
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
379
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
380
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
381
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
382
- # @pattern_cc << @_attr_value1 << '")[^<>]*)>(((?!(' << @_name
383
- # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
384
364
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
385
365
 
386
366
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -427,11 +407,6 @@ module Meteor
427
407
  def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
428
408
  quote_element_four(attr_name1, attr_value1, attr_name2, attr_value2)
429
409
 
430
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s([^<>]*(' << @_attr_name1 << '="' << @_attr_value1
431
- # @pattern_cc << '"[^<>]*' << @_attr_name2 << '="' << @_attr_value2
432
- # @pattern_cc << '"|' << @_attr_name2 << '="' << @_attr_value2
433
- # @pattern_cc << '"[^<>]*' << @_attr_name1 << '="' << @_attr_value1
434
- # @pattern_cc << '")[^<>]*)>'
435
410
  @pattern_cc = "<([^<>\"]*)\\s([^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
436
411
 
437
412
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
data/lib/meteor.rb CHANGED
@@ -37,11 +37,11 @@ require 'meteor/ml/xml/parser_impl'
37
37
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
38
38
  #
39
39
  # @author Yasumasa Ashida
40
- # @version 0.9.40
40
+ # @version 0.9.42
41
41
  #
42
42
 
43
43
  module Meteor
44
- VERSION = '0.9.40'
44
+ VERSION = '0.9.42'
45
45
 
46
46
  # require 'fileutils'
47
47
 
data/meteor.gemspec CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features|demo)/})
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 4.0.15'
25
+ spec.add_development_dependency 'bundler', '~> 4.0.16'
26
26
  # spec.add_development_dependency "rake"
27
27
  end
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.40
4
+ version: 0.9.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 4.0.15
18
+ version: 4.0.16
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 4.0.15
25
+ version: 4.0.16
26
26
  description: A lightweight (X)HTML & XML parser
27
27
  email: ys.ashida@gmail.com
28
28
  executables: []
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 4.0.15
85
+ rubygems_version: 4.0.16
86
86
  specification_version: 4
87
87
  summary: A lightweight (X)HTML & XML parser
88
88
  test_files: