meteor 0.9.34 → 0.9.35

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: e244c53919093f4fa5aaeb5b0fb3c4becac0e0c5feb213308477494b6e048d3c
4
- data.tar.gz: d7a7294a851bd5b8663102955ac3c0bfc7d4a33feb453c5d15ee0d464d760beb
3
+ metadata.gz: 0f2bbd707164b48645ffb1da10edc17905ba5f538101e22d24349d14b02cf818
4
+ data.tar.gz: 6d4c94a82d5334520187aa73c3005a33f9bfcc61395cd6f381dbdc8f36b51ae8
5
5
  SHA512:
6
- metadata.gz: a18ec4e77104c88fc27a0e7a83efaacbaf79cbaf319a50e7637f8341df3eb9ad8aa77b3faf169d637b381be0053ad2bc98d774cc26e32957190ba1dcebcd8b16
7
- data.tar.gz: 4949cc3d32443fa9faba71a2157f94bc383a5af767e8dc1f063b00733f328d8ebc64c0d872a07f394932f0e5fe7633691c30d98b8093525267187f1d52e840f0
6
+ metadata.gz: 3b7f7375cc3f061f5da1e20045cf18073fe7ea1ef6ec96c72d909e61ec604c335644b72aa2bcbcf0cb1c48ab8b66fd29277a7cedc7ee5ff9f30d2c4c326a0861
7
+ data.tar.gz: b5f8bda1b370990c5fefea263f258c6e66aa514718802d10d81b0fa2d508fafde03d61007064f93aa6a2ad089cd965d1d75d3492ed45c3a30055c4a310506f37
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.35 / 2026-07-07 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactoring
4
+
1
5
  == 0.9.34 / 2026-07-05 Yasumasa Ashida <ys.ashida@gmail.com>
2
6
 
3
7
  * Refactor Meteor::Element
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.34)
4
+ meteor (0.9.35)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -14,43 +14,43 @@ module Meteor
14
14
  # @!attribute [rw] element_hook
15
15
  # @return [Meteor::Element] element (要素)
16
16
  #
17
- class Kernel < Meteor::Parser
17
+ class Kernel < Meteor::Parser # rubocop:disable Metrics/ClassLength
18
18
  # find
19
19
  # E
20
- PATTERN_FIND_one = '^([^,\\[\\]#\\.]+)$'
20
+ PATTERN_FIND_ONE = '^([^,\\[\\]#\\.]+)$'
21
21
  # # id_attribute_value
22
- PATTERN_FIND_two_one = '^#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
22
+ PATTERN_FIND_TWO_ONE = '^#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
23
23
  # .class_attribute_value
24
- PATTERN_FIND_two_two = '^\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
24
+ PATTERN_FIND_TWO_TWO = '^\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
25
25
  # [attribute_name=attribute_value]
26
- PATTERN_FIND_two_three = '^\\[([^\\[\\],]+)=([^\\[\\],]+)\\]$'
26
+ PATTERN_FIND_TWO_THREE = '^\\[([^\\[\\],]+)=([^\\[\\],]+)\\]$'
27
27
  # E[attribute_name=attribute_value]
28
- PATTERN_FIND_three_one = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,\\[\\]]+)=([^,\\[\\]]+)\\]$'
28
+ PATTERN_FIND_THREE_ONE = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,\\[\\]]+)=([^,\\[\\]]+)\\]$'
29
29
  # E# id_attribute_value
30
- PATTERN_FIND_three_two = '^([^\\.,\\[\\]#][^,\\[\\]#]+)#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
30
+ PATTERN_FIND_THREE_TWO = '^([^\\.,\\[\\]#][^,\\[\\]#]+)#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
31
31
  # E.class_attribute_value
32
- PATTERN_FIND_three_three = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
32
+ PATTERN_FIND_THREE_THREE = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
33
33
  # [attribute_name1=attribute_value1][attribute_name2=attribute_value2]
34
- PATTERN_FIND_four = '^\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
34
+ PATTERN_FIND_FOUR = '^\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
35
35
  # E[attribute_name1=attribute_value1][attribute_name2=attribute_value2]
36
- PATTERN_FIND_five = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
36
+ PATTERN_FIND_FIVE = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
37
37
 
38
- @@pattern_find_one = Regexp.new(PATTERN_FIND_one)
39
- @@pattern_find_two_one = Regexp.new(PATTERN_FIND_two_one)
40
- @@pattern_find_two_two = Regexp.new(PATTERN_FIND_two_two)
41
- @@pattern_find_two_three = Regexp.new(PATTERN_FIND_two_three)
42
- @@pattern_find_three_one = Regexp.new(PATTERN_FIND_three_one)
43
- @@pattern_find_three_two = Regexp.new(PATTERN_FIND_three_two)
44
- @@pattern_find_three_three = Regexp.new(PATTERN_FIND_three_three)
45
- @@pattern_find_four = Regexp.new(PATTERN_FIND_four)
46
- @@pattern_find_five = Regexp.new(PATTERN_FIND_five)
38
+ RE_FIND_ONE = Regexp.new(PATTERN_FIND_ONE)
39
+ RE_FIND_TWO_ONE = Regexp.new(PATTERN_FIND_TWO_ONE)
40
+ RE_FIND_TWO_TWO = Regexp.new(PATTERN_FIND_TWO_TWO)
41
+ RE_FIND_TWO_THREE = Regexp.new(PATTERN_FIND_TWO_THREE)
42
+ RE_FIND_THREE_ONE = Regexp.new(PATTERN_FIND_THREE_ONE)
43
+ RE_FIND_THREE_TWO = Regexp.new(PATTERN_FIND_THREE_TWO)
44
+ RE_FIND_THREE_THREE = Regexp.new(PATTERN_FIND_THREE_THREE)
45
+ RE_FIND_FOUR = Regexp.new(PATTERN_FIND_FOUR)
46
+ RE_FIND_FIVE = Regexp.new(PATTERN_FIND_FIVE)
47
47
 
48
- @@pattern_non_nest = Regexp.new('\\A[^<>]*\\Z')
48
+ RE_NON_NEST = Regexp.new('\\A[^<>]*\\Z')
49
49
 
50
- @@pattern_get_attrs_map = Regexp.new('([^\\s]*)="([^\"]*)"')
50
+ RE_GET_ATTRS_MAP = Regexp.new('([^\\s]*)="([^\"]*)"')
51
51
 
52
- @@pattern_clean1 = Regexp.new('<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->')
53
- @@pattern_clean2 = Regexp.new('<!--\\s\\/@[^<>]*(\\s)*-->')
52
+ RE_CLEAN_ONE = Regexp.new('<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->')
53
+ RE_CLEAN_TWO = Regexp.new('<!--\\s\\/@[^<>]*(\\s)*-->')
54
54
 
55
55
  BR = '<br>'
56
56
  BR_RE = BR
@@ -78,12 +78,12 @@ module Meteor
78
78
 
79
79
  PATTERN_ESCAPE = "[&\"'<> ]"
80
80
  PATTERN_ESCAPE_CONTENT = "[&\"'<> \\n]"
81
- @@pattern_escape = Regexp.new(PATTERN_ESCAPE)
82
- @@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
81
+ RE_ESCAPE = Regexp.new(PATTERN_ESCAPE)
82
+ RE_ESCAPE_CONTENT = Regexp.new(PATTERN_ESCAPE_CONTENT)
83
83
 
84
84
  PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt|nbsp);'
85
- @@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
86
- @@pattern_br_two = Regexp.new(BR_RE)
85
+ RE_UNESCAPE = Regexp.new(PATTERN_UNESCAPE)
86
+ RE_BR_TWO = Regexp.new(BR_RE)
87
87
 
88
88
  attr_accessor :element_cache, :doc_type, :document_hook, :element_hook
89
89
 
@@ -428,7 +428,7 @@ module Meteor
428
428
  private :element_three
429
429
 
430
430
  def element_pattern_three
431
- "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
431
+ "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
432
432
  end
433
433
 
434
434
  private :element_pattern_three
@@ -456,7 +456,7 @@ module Meteor
456
456
  # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
457
457
  # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
458
458
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
459
- @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
459
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
460
460
 
461
461
  @elm_.pattern = @pattern_cc
462
462
 
@@ -476,7 +476,7 @@ module Meteor
476
476
  # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
477
477
  # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
478
478
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
479
- @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
479
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
480
480
 
481
481
  @elm_.pattern = @pattern_cc
482
482
 
@@ -527,12 +527,12 @@ module Meteor
527
527
  def element_pattern_normal_three_two
528
528
  # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
529
529
  # @pattern_cc_one << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
530
- @pattern_cc_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
530
+ @pattern_cc_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
531
531
  @pattern_cc_oneb = String.new('') << '<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
532
532
  # @pattern_cc_oneb = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
533
533
  # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
534
534
  # @pattern_cc_one_one << @_attr_value << '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
535
- @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
535
+ @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
536
536
  @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
537
537
  # @pattern_cc_one_two = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
538
538
 
@@ -574,7 +574,8 @@ module Meteor
574
574
  # document (全体)
575
575
  @elm_.document = @res[0]
576
576
  # pattern (空要素検索用パターン)
577
- # @pattern_cc = String.new("") << "<" << @_name << "(\\s[^<>]*" << @_attr_name << "=\"" << @_attr_value << closer
577
+ # @pattern_cc = String.new("") << "<" << @_name << "(\\s[^<>]*"
578
+ # << @_attr_name << "=\"" << @_attr_value << closer
578
579
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}#{closer}"
579
580
  @elm_.pattern = @pattern_cc
580
581
  @elm_.parser = self
@@ -606,7 +607,7 @@ module Meteor
606
607
  @elm_ = nil
607
608
  end
608
609
 
609
- # @pattern_cc_one = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(\\3[^<>]*>)).)*)<\\/\\3>"
610
+ # @pattern_cc_one = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(\\3[^<>]*>)).)*)<\\/\\3>" # rubocop:disable Layout/LineLength
610
611
  #
611
612
  # @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_one)
612
613
  # @res1 = @pattern.match(@root.document)
@@ -671,8 +672,10 @@ module Meteor
671
672
  private :quote_attribute
672
673
 
673
674
  def element_pattern_two
674
- # # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*' << @_attr_name << '="' << @_attr_value << '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
675
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*' << @_attr_name << '="' << @_attr_value << '"'
675
+ # # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
676
+ # << @_attr_name << '="' << @_attr_value << '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
677
+ # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
678
+ # << @_attr_name << '="' << @_attr_value << '"'
676
679
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\""
677
680
  end
678
681
 
@@ -695,7 +698,7 @@ module Meteor
695
698
  # # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
696
699
  # # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
697
700
  # # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
698
- # @ pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
701
+ # @ pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
699
702
  #
700
703
  # @elm_.pattern = @pattern_cc
701
704
  # @elm_.normal = true
@@ -714,7 +717,7 @@ module Meteor
714
717
  # # @pattern_cc = String.new()<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
715
718
  # # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
716
719
  # # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
717
- # @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
720
+ # @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
718
721
  #
719
722
  # @elm_.pattern = @pattern_cc
720
723
  # @elm_.normal = true
@@ -745,7 +748,7 @@ module Meteor
745
748
  # def element_normal_two_two
746
749
  # # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
747
750
  # # @pattern_cc_one << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
748
- # @pattern_cc_one = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
751
+ # @pattern_cc_one = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
749
752
  #
750
753
  # # search of normal element (内容あり要素検索)
751
754
  # @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_one)
@@ -772,7 +775,7 @@ module Meteor
772
775
  #
773
776
  # # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
774
777
  # # @pattern_cc_one_one << @_attr_value << '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
775
- # @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
778
+ # @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
776
779
  # @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
777
780
  # @pattern_cc_two = String.new('') << '<\\/' << @_name << '>'
778
781
  # @pattern_cc_two_one = String.new('') << '.*?<\/' << @_name << '>'
@@ -796,7 +799,7 @@ module Meteor
796
799
  # # document (全体)
797
800
  # @elm_.document = @res[0]
798
801
  # # void element search pattern (空要素検索用パターン)
799
- # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*' << @_attr_name << '="' << @_attr_value << closer
802
+ # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*' << @_attr_name << '="' << @_attr_value << closer # rubocop:disable Layout/LineLength
800
803
  # @elm_.pattern = @pattern_cc
801
804
  # @elm_.parser = self
802
805
  #
@@ -817,7 +820,7 @@ module Meteor
817
820
  def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
818
821
  quote_element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
819
822
 
820
- @pattern_cc_one = "<#{@_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}>"
823
+ @pattern_cc_one = "<#{@_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}>" # rubocop:disable Layout/LineLength
821
824
 
822
825
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_one)
823
826
  @res1 = @pattern.match(@root.document)
@@ -896,7 +899,7 @@ module Meteor
896
899
  # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
897
900
  # @pattern_cc << @_attr_value1 << '")[^<>]*>((?!(' << @_name
898
901
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
899
- @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
902
+ @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
900
903
 
901
904
  @elm_.pattern = @pattern_cc
902
905
  @elm_.normal = true
@@ -917,7 +920,7 @@ module Meteor
917
920
  # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
918
921
  # @pattern_cc << @_attr_value1 << '")[^<>]*>((?!(' << @_name
919
922
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
920
- @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
923
+ @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
921
924
 
922
925
  @elm_.pattern = @pattern_cc
923
926
  @elm_.normal = true
@@ -963,7 +966,7 @@ module Meteor
963
966
  # @pattern_cc_one << @_attr_value2 << '"|' << @_attr_name2 << '="'
964
967
  # @pattern_cc_one << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
965
968
  # @pattern_cc_one << @_attr_value1 << '")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))'
966
- @pattern_cc_one = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))"
969
+ @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
967
970
  @pattern_cc_oneb = String.new('') << '<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
968
971
  # @pattern_cc_oneb = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
969
972
 
@@ -972,7 +975,7 @@ module Meteor
972
975
  # @pattern_cc_one_one << @_attr_value2 << '"|' << @_attr_name2 << '="'
973
976
  # @pattern_cc_one_one << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
974
977
  # @pattern_cc_one_one << @_attr_value1 << '")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
975
- @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
978
+ @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
976
979
  @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
977
980
  @pattern_cc_two = String.new('') << '<\\/' << @_name << '>'
978
981
  @pattern_cc_two_one = String.new('') << '.*?<\\/' << @_name << '>'
@@ -1017,7 +1020,7 @@ module Meteor
1017
1020
  # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
1018
1021
  # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
1019
1022
  # @pattern_cc << @_attr_value1 << closer
1020
- @pattern_cc = "<#{@_name}(\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}"
1023
+ @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
1021
1024
  @elm_.pattern = @pattern_cc
1022
1025
  @elm_.parser = self
1023
1026
 
@@ -1075,7 +1078,7 @@ module Meteor
1075
1078
  # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
1076
1079
  # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
1077
1080
  # @pattern_cc << @_attr_value1 << '"'
1078
- @pattern_cc = "<([^<>\"]*)\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")"
1081
+ @pattern_cc = "<([^<>\"]*)\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")" # rubocop:disable Layout/LineLength
1079
1082
  end
1080
1083
 
1081
1084
  private :element_pattern_four
@@ -1383,31 +1386,31 @@ module Meteor
1383
1386
  case open_count
1384
1387
  when ZERO
1385
1388
  if selector.count('#.').zero?
1386
- elements_(@res[1]) if (@res = @@pattern_find_one.match(selector))
1389
+ elements_(@res[1]) if (@res = RE_FIND_ONE.match(selector))
1387
1390
  elsif selector.count('#') == 1
1388
1391
  if selector[0] == '#'
1389
- elements_('id', @res[1]) if (@res = @@pattern_find_two_one.match(selector))
1390
- elsif (@res = @@pattern_find_three_two.match(selector))
1392
+ elements_('id', @res[1]) if (@res = RE_FIND_TWO_ONE.match(selector))
1393
+ elsif (@res = RE_FIND_THREE_TWO.match(selector))
1391
1394
  elements_(@res[1], 'id', @res[2])
1392
1395
  end
1393
1396
  elsif selector.count('.') == 1
1394
1397
  if selector[0] == '.'
1395
- elements_('class', @res[1]) if (@res = @@pattern_find_two_two.match(selector))
1396
- elsif (@res = @@pattern_find_three_three.match(selector))
1398
+ elements_('class', @res[1]) if (@res = RE_FIND_TWO_TWO.match(selector))
1399
+ elsif (@res = RE_FIND_THREE_THREE.match(selector))
1397
1400
  elements_(@res[1], 'class', @res[2])
1398
1401
  end
1399
1402
  end
1400
1403
 
1401
1404
  when ONE
1402
1405
  if selector[0] == '['
1403
- elements_(@res[1], @res[2]) if (@res = @@pattern_find_two_three.match(selector))
1404
- elsif (@res = @@pattern_find_three_one.match(selector))
1406
+ elements_(@res[1], @res[2]) if (@res = RE_FIND_TWO_THREE.match(selector))
1407
+ elsif (@res = RE_FIND_THREE_ONE.match(selector))
1405
1408
  elements_(@res[1], @res[2], @res[3])
1406
1409
  end
1407
1410
  when 2
1408
1411
  if selector[0] == '['
1409
- elements_(@res[1], @res[2], @res[3], @res[4]) if (@res = @@pattern_find_four.match(selector))
1410
- elsif (@res = @@pattern_find_five.match(selector))
1412
+ elements_(@res[1], @res[2], @res[3], @res[4]) if (@res = RE_FIND_FOUR.match(selector))
1413
+ elsif (@res = RE_FIND_FIVE.match(selector))
1411
1414
  elements_(@res[1], @res[2], @res[3], @res[4], @res[5])
1412
1415
  end
1413
1416
  end
@@ -1573,7 +1576,7 @@ module Meteor
1573
1576
  def get_attrs(elm)
1574
1577
  attrs = {}
1575
1578
 
1576
- elm.attributes.scan(@@pattern_get_attrs_map) do |a, b|
1579
+ elm.attributes.scan(RE_GET_ATTRS_MAP) do |a, b|
1577
1580
  attrs.store(a, unescape(b))
1578
1581
  end
1579
1582
 
@@ -1634,7 +1637,7 @@ module Meteor
1634
1637
  def get_attr_map(elm)
1635
1638
  attrs = Meteor::AttributeMap.new
1636
1639
 
1637
- elm.attributes.scan(@@pattern_get_attrs_map) do |a, b|
1640
+ elm.attributes.scan(RE_GET_ATTRS_MAP) do |a, b|
1638
1641
  attrs.store(a, unescape(b))
1639
1642
  end
1640
1643
 
@@ -1827,8 +1830,8 @@ module Meteor
1827
1830
  # CX tag search pattern (CXタグ検索用パターン)
1828
1831
  # @pattern_cc = String.new('') << "<!--\\s@" << @_name << '\\s([^<>]*id="'
1829
1832
  # @pattern_cc << id << '"[^<>]*)-->(((?!(<!--\\s/@' << @_name << ")).)*)<!--\\s/@" << @_name << "\\s-->"
1830
- # @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s\\/@#{@_name})).)*)<!--\\s\\/@#{@_name}\\s-->"
1831
- @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s/@#{@_name})).)*)<!--\\s/@#{@_name}\\s-->"
1833
+ # @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s\\/@#{@_name})).)*)<!--\\s\\/@#{@_name}\\s-->" # rubocop:disable Layout/LineLength
1834
+ @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s/@#{@_name})).)*)<!--\\s/@#{@_name}\\s-->" # rubocop:disable Layout/LineLength
1832
1835
 
1833
1836
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
1834
1837
  # CX tag search (CXタグ検索)
@@ -1953,9 +1956,10 @@ module Meteor
1953
1956
  # @root.hookDocument << @root.element.mixed_content << '<!-- /@'
1954
1957
  # @root.hookDocument << @root.element.name << ' -->'
1955
1958
  document_hook <<
1956
- "<!-- @#{element_hook.name} #{element_hook.attributes}-->#{element_hook.mixed_content}<!-- /@#{element_hook.name} -->"
1959
+ "<!-- @#{element_hook.name} #{element_hook.attributes}-->#{element_hook.mixed_content}<!-- /@#{element_hook.name} -->" # rubocop:disable Layout/LineLength
1957
1960
 
1958
- # self.document_hook << @root.newline << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
1961
+ # self.document_hook << @root.newline <<
1962
+ # "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->" # rubocop:disable Layout/LineLength
1959
1963
  else
1960
1964
  # @root.hookDocument << "<" << @root.element.name
1961
1965
  # @root.hookDocument << @root.element.attributes << '>' << @root.element.mixed_content
@@ -1963,7 +1967,8 @@ module Meteor
1963
1967
  document_hook <<
1964
1968
  "<#{element_hook.name}#{element_hook.attributes}>#{element_hook.mixed_content}</#{element_hook.name}>"
1965
1969
 
1966
- # self.document_hook << @root.newline << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
1970
+ # self.document_hook << @root.newline <<
1971
+ # "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>" # rubocop:disable Layout/LineLength
1967
1972
  end
1968
1973
 
1969
1974
  else
@@ -1978,7 +1983,7 @@ module Meteor
1978
1983
  document_hook <<
1979
1984
  "<!-- @#{element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{element_hook.name} -->"
1980
1985
 
1981
- # self.document_hook << @root.newline << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
1986
+ # self.document_hook << @root.newline << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->" # rubocop:disable Layout/LineLength
1982
1987
  else
1983
1988
  # @root.hookDocument << "<" << @root.element.name
1984
1989
  # @root.hookDocument << @_attributes << '>' << @root.document
@@ -1986,7 +1991,7 @@ module Meteor
1986
1991
  document_hook <<
1987
1992
  "<#{element_hook.name}#{@_attributes}>#{@root.document}</#{element_hook.name}>"
1988
1993
 
1989
- # self.document_hook << @root.newline << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
1994
+ # self.document_hook << @root.newline << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>" # rubocop:disable Layout/LineLength
1990
1995
  end
1991
1996
 
1992
1997
  end
@@ -2000,10 +2005,10 @@ module Meteor
2000
2005
 
2001
2006
  def clean
2002
2007
  # replace CX start tag (CX開始タグ置換)
2003
- @pattern = @@pattern_clean1
2008
+ @pattern = RE_CLEAN_ONE
2004
2009
  @root.document.gsub!(@pattern, '')
2005
2010
  # rplace CX end tag (CX終了タグ置換)
2006
- @pattern = @@pattern_clean2
2011
+ @pattern = RE_CLEAN_TWO
2007
2012
  @root.document.gsub!(@pattern, '')
2008
2013
  # @root.document << "<!-- Powered by Meteor (C)Yasumasa Ashida -->"
2009
2014
  end
@@ -2040,29 +2045,29 @@ module Meteor
2040
2045
  # private :shadow
2041
2046
 
2042
2047
  def non_nest=(elm)
2043
- @res = @@pattern_non_nest.match(elm.mixed_content)
2048
+ @res = RE_NON_NEST.match(elm.mixed_content)
2044
2049
 
2045
2050
  elm.non_nest = true if @res
2046
2051
  end
2047
2052
 
2048
2053
  private :non_nest=
2049
2054
 
2050
- def is_match(regex, str)
2055
+ def match?(regex, str)
2051
2056
  case regex
2052
2057
  when Regexp
2053
- is_match_r(regex, str)
2058
+ match_r?(regex, str)
2054
2059
  when Array
2055
- is_match_a(regex, str)
2060
+ match_a?(regex, str)
2056
2061
  when String
2057
- regex == str.downcase
2062
+ match_s?(regex, str)
2058
2063
  else
2059
2064
  raise ArgumentError
2060
2065
  end
2061
2066
  end
2062
2067
 
2063
- private :is_match
2068
+ private :match?
2064
2069
 
2065
- def is_match_r(regex, str)
2070
+ def match_r?(regex, str)
2066
2071
  if regex.match(str.downcase)
2067
2072
  true
2068
2073
  else
@@ -2070,9 +2075,9 @@ module Meteor
2070
2075
  end
2071
2076
  end
2072
2077
 
2073
- private :is_match_r
2078
+ private :match_r?
2074
2079
 
2075
- def is_match_a(regex, str)
2080
+ def match_a?(regex, str)
2076
2081
  str = str.downcase
2077
2082
  regex.each do |item|
2078
2083
  return true if item == str
@@ -2081,26 +2086,22 @@ module Meteor
2081
2086
  false
2082
2087
  end
2083
2088
 
2084
- private :is_match_a
2089
+ private :match_a?
2085
2090
 
2086
- def is_match_s(regex, str)
2087
- if regex.match(str.downcase)
2088
- true
2089
- else
2090
- false
2091
- end
2091
+ def match_s?(regex, str)
2092
+ regex == str.downcase
2092
2093
  end
2093
2094
 
2094
- private :is_match_s
2095
+ private :match_s?
2095
2096
 
2096
2097
  def escape(content)
2097
2098
  # replace special character (特殊文字の置換)
2098
- content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
2099
+ content.gsub(RE_ESCAPE, TABLE_FOR_ESCAPE_)
2099
2100
  end
2100
2101
 
2101
2102
  def escape_content(content, _elm)
2102
2103
  # replace special character (特殊文字の置換)
2103
- content.gsub(@@pattern_escape_content, TABLE_FOR_ESCAPE_CONTENT_)
2104
+ content.gsub(RE_ESCAPE_CONTENT, TABLE_FOR_ESCAPE_CONTENT_)
2104
2105
  end
2105
2106
 
2106
2107
  private :escape
@@ -2113,7 +2114,7 @@ module Meteor
2113
2114
  # 「"」<-「&quotl」
2114
2115
  # 「 」<-「&nbsp;」
2115
2116
  # 「&」<-「&amp;」
2116
- content.gsub(@@pattern_unescape) do
2117
+ content.gsub(RE_UNESCAPE) do
2117
2118
  case ::Regexp.last_match(1)
2118
2119
  when 'amp'
2119
2120
  '&'
@@ -2136,10 +2137,10 @@ module Meteor
2136
2137
  private :unescape
2137
2138
 
2138
2139
  def br_to_newline(content)
2139
- return unless (elm.cx || !is_match(@@match_tag_two, elm.name)) && content.include?(BR)
2140
+ return unless (elm.cx || !match?(MATCH_TAG_TWO, elm.name)) && content.include?(BR)
2140
2141
 
2141
2142
  # 「<br>」->「¥r?¥n」
2142
- content.gsub!(@@pattern_br_two, @root.newline)
2143
+ content.gsub!(RE_BR_TWO, @root.newline)
2143
2144
  end
2144
2145
 
2145
2146
  private :br_to_newline
@@ -8,7 +8,7 @@ module Meteor
8
8
  # Pattern Cache Class (パターン・キャッシュ クラス)
9
9
  #
10
10
  class PatternCache
11
- @@regex_cache = {}
11
+ @@regex_cache = {} # rubocop:disable Style/ClassVars
12
12
 
13
13
  ##
14
14
  ## intializer (イニシャライザ)
@@ -36,7 +36,7 @@ module Meteor
36
36
  # @!attribute [rw] removed
37
37
  # @return [true,false] deletion flag (削除フラグ)
38
38
  #
39
- class Element
39
+ class Element # rubocop:disable Metrics/ClassLength
40
40
  attr_accessor :name, :attributes, :mixed_content, :raw_content, :pattern, :document_sync, :normal, :cx, :non_nest,
41
41
  :parser, :type_value, :usable, :origin, :copy, :removed
42
42
 
@@ -61,6 +61,7 @@ module Meteor
61
61
  #
62
62
  def initialize(*args)
63
63
  case args.length
64
+ when Meteor::ZERO
64
65
  when Meteor::ONE
65
66
  if args[0].is_a?(String)
66
67
  initialize_s(args[0])
@@ -71,7 +72,6 @@ module Meteor
71
72
  end
72
73
  when Meteor::TWO
73
74
  initialize_two(args[0], args[1])
74
- when Meteor::ZERO
75
75
  else
76
76
  raise ArgumentError
77
77
  end
@@ -207,27 +207,31 @@ module Meteor
207
207
  @document_sync = false
208
208
  case @parser.doc_type
209
209
  when Parser::HTML, Parser::HTML4
210
- if @cx
211
- # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
212
- @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
213
- elsif @normal
214
- # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
215
- @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
216
- else
217
- @document = String.new('') << '<' << @name << @attributes << '>'
218
- # @document = "<#{@name}#{@attributes}>"
219
- end
210
+ @document = if @cx
211
+ # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->'
212
+ # << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
213
+ "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
214
+ elsif @normal
215
+ # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>'
216
+ # << elm.mixed_content << '</' << elm.name << '>'
217
+ "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
218
+ else
219
+ String.new('') << '<' << @name << @attributes << '>'
220
+ # @document = "<#{@name}#{@attributes}>"
221
+ end
220
222
  when Parser::XHTML, Parser::XHTML4, Parser::XML
221
- if @cx
222
- # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
223
- @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
224
- elsif @normal
225
- # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
226
- @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
227
- else
228
- @document = String.new('') << '<' << @name << @attributes << '/>'
229
- # @document = "<#{@name}#{@attributes}/>"
230
- end
223
+ @document = if @cx
224
+ # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->'
225
+ # << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
226
+ "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
227
+ elsif @normal
228
+ # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content
229
+ # << '</' << elm.name << '>'
230
+ "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
231
+ else
232
+ String.new('') << '<' << @name << @attributes << '/>'
233
+ # @document = "<#{@name}#{@attributes}/>"
234
+ end
231
235
  end
232
236
  else
233
237
  @document
@@ -6,7 +6,7 @@ module Meteor
6
6
  # Elements Class (要素ファクトリ クラス)
7
7
  #
8
8
  class Elements
9
- @@pf = Meteor::Parsers.new
9
+ @@pf = Meteor::Parsers.new # rubocop:disable Style/ClassVars
10
10
 
11
11
  #
12
12
  # set options (オプションをセットする)