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 +4 -4
- data/ChangeLog +4 -0
- data/Gemfile.lock +1 -1
- data/lib/meteor/core/kernel.rb +91 -90
- data/lib/meteor/core/util/pattern_cache.rb +1 -1
- data/lib/meteor/element.rb +26 -22
- data/lib/meteor/elements.rb +1 -1
- data/lib/meteor/ml/html/parser_impl.rb +30 -35
- data/lib/meteor/ml/html4/parser_impl.rb +68 -65
- data/lib/meteor/ml/xhtml/parser_impl.rb +31 -34
- data/lib/meteor/ml/xhtml4/parser_impl.rb +50 -50
- data/lib/meteor/ml/xml/parser_impl.rb +5 -4
- data/lib/meteor.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f2bbd707164b48645ffb1da10edc17905ba5f538101e22d24349d14b02cf818
|
|
4
|
+
data.tar.gz: 6d4c94a82d5334520187aa73c3005a33f9bfcc61395cd6f381dbdc8f36b51ae8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b7f7375cc3f061f5da1e20045cf18073fe7ea1ef6ec96c72d909e61ec604c335644b72aa2bcbcf0cb1c48ab8b66fd29277a7cedc7ee5ff9f30d2c4c326a0861
|
|
7
|
+
data.tar.gz: b5f8bda1b370990c5fefea263f258c6e66aa514718802d10d81b0fa2d508fafde03d61007064f93aa6a2ad089cd965d1d75d3492ed45c3a30055c4a310506f37
|
data/ChangeLog
CHANGED
data/Gemfile.lock
CHANGED
data/lib/meteor/core/kernel.rb
CHANGED
|
@@ -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
|
-
|
|
20
|
+
PATTERN_FIND_ONE = '^([^,\\[\\]#\\.]+)$'
|
|
21
21
|
# # id_attribute_value
|
|
22
|
-
|
|
22
|
+
PATTERN_FIND_TWO_ONE = '^#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
|
23
23
|
# .class_attribute_value
|
|
24
|
-
|
|
24
|
+
PATTERN_FIND_TWO_TWO = '^\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
|
25
25
|
# [attribute_name=attribute_value]
|
|
26
|
-
|
|
26
|
+
PATTERN_FIND_TWO_THREE = '^\\[([^\\[\\],]+)=([^\\[\\],]+)\\]$'
|
|
27
27
|
# E[attribute_name=attribute_value]
|
|
28
|
-
|
|
28
|
+
PATTERN_FIND_THREE_ONE = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,\\[\\]]+)=([^,\\[\\]]+)\\]$'
|
|
29
29
|
# E# id_attribute_value
|
|
30
|
-
|
|
30
|
+
PATTERN_FIND_THREE_TWO = '^([^\\.,\\[\\]#][^,\\[\\]#]+)#([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
|
31
31
|
# E.class_attribute_value
|
|
32
|
-
|
|
32
|
+
PATTERN_FIND_THREE_THREE = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\.([^\\.,\\[\\]#][^,\\[\\]#]*)$'
|
|
33
33
|
# [attribute_name1=attribute_value1][attribute_name2=attribute_value2]
|
|
34
|
-
|
|
34
|
+
PATTERN_FIND_FOUR = '^\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
|
|
35
35
|
# E[attribute_name1=attribute_value1][attribute_name2=attribute_value2]
|
|
36
|
-
|
|
36
|
+
PATTERN_FIND_FIVE = '^([^\\.,\\[\\]#][^,\\[\\]#]+)\\[([^,]+)=([^,]+)\\]\\[([^,]+)=([^,]+)\\]$'
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
48
|
+
RE_NON_NEST = Regexp.new('\\A[^<>]*\\Z')
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
RE_GET_ATTRS_MAP = Regexp.new('([^\\s]*)="([^\"]*)"')
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
82
|
-
|
|
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
|
-
|
|
86
|
-
|
|
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[^<>]*"
|
|
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[^<>]*'
|
|
675
|
-
#
|
|
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 =
|
|
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 =
|
|
1390
|
-
elsif (@res =
|
|
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 =
|
|
1396
|
-
elsif (@res =
|
|
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 =
|
|
1404
|
-
elsif (@res =
|
|
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 =
|
|
1410
|
-
elsif (@res =
|
|
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(
|
|
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(
|
|
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 <<
|
|
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 <<
|
|
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 =
|
|
2008
|
+
@pattern = RE_CLEAN_ONE
|
|
2004
2009
|
@root.document.gsub!(@pattern, '')
|
|
2005
2010
|
# rplace CX end tag (CX終了タグ置換)
|
|
2006
|
-
@pattern =
|
|
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 =
|
|
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
|
|
2055
|
+
def match?(regex, str)
|
|
2051
2056
|
case regex
|
|
2052
2057
|
when Regexp
|
|
2053
|
-
|
|
2058
|
+
match_r?(regex, str)
|
|
2054
2059
|
when Array
|
|
2055
|
-
|
|
2060
|
+
match_a?(regex, str)
|
|
2056
2061
|
when String
|
|
2057
|
-
regex
|
|
2062
|
+
match_s?(regex, str)
|
|
2058
2063
|
else
|
|
2059
2064
|
raise ArgumentError
|
|
2060
2065
|
end
|
|
2061
2066
|
end
|
|
2062
2067
|
|
|
2063
|
-
private :
|
|
2068
|
+
private :match?
|
|
2064
2069
|
|
|
2065
|
-
def
|
|
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 :
|
|
2078
|
+
private :match_r?
|
|
2074
2079
|
|
|
2075
|
-
def
|
|
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 :
|
|
2089
|
+
private :match_a?
|
|
2085
2090
|
|
|
2086
|
-
def
|
|
2087
|
-
|
|
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 :
|
|
2095
|
+
private :match_s?
|
|
2095
2096
|
|
|
2096
2097
|
def escape(content)
|
|
2097
2098
|
# replace special character (特殊文字の置換)
|
|
2098
|
-
content.gsub(
|
|
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(
|
|
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
|
# 「"」<-「"l」
|
|
2114
2115
|
# 「 」<-「 」
|
|
2115
2116
|
# 「&」<-「&」
|
|
2116
|
-
content.gsub(
|
|
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 || !
|
|
2140
|
+
return unless (elm.cx || !match?(MATCH_TAG_TWO, elm.name)) && content.include?(BR)
|
|
2140
2141
|
|
|
2141
2142
|
# 「<br>」->「¥r?¥n」
|
|
2142
|
-
content.gsub!(
|
|
2143
|
+
content.gsub!(RE_BR_TWO, @root.newline)
|
|
2143
2144
|
end
|
|
2144
2145
|
|
|
2145
2146
|
private :br_to_newline
|
data/lib/meteor/element.rb
CHANGED
|
@@ -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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
|