meteor 0.9.28 → 0.9.30
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 +8 -0
- data/Gemfile.lock +1 -1
- data/lib/meteor/core/kernel.rb +7 -7
- data/lib/meteor/core/util/pattern_cache.rb +30 -64
- data/lib/meteor/ml/html/parser_impl.rb +1 -1
- data/lib/meteor/ml/html4/parser_impl.rb +3 -3
- data/lib/meteor/ml/xhtml/parser_impl.rb +1 -1
- data/lib/meteor/ml/xhtml4/parser_impl.rb +2 -2
- data/lib/meteor/ml/xml/parser_impl.rb +3 -3
- data/lib/meteor/root_element.rb +5 -2
- 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: 50c95ae971722d36e7d3e198d73f043fd44e65be5f7fc0ccd437d813d6a172e0
|
|
4
|
+
data.tar.gz: 6797ee8ac69369f4dd2b5b369bddded751bc6feb9d039c03a0346903bc417543
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9015aa8aa74e4dc6684196694c1af631bda8f2cf809f8c4012d92609d5d33aa3e8b9945cd8374fe6ffe1825a01925f148ed85c7af783b7888ef5dff851a3dc65
|
|
7
|
+
data.tar.gz: 2ce12093acf7b2dff79106714bc912318a287dc31b196f9a79e6bddaebebda2bc31ce7851e10e9a976c565dffdcbddde38bcbc1aae3b284a4fc8e2b9c7438ef2
|
data/ChangeLog
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
== 0.9.30 / 2026-07-02 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
|
+
|
|
3
|
+
* Refactor Meteor::Core::Util::PatternCache
|
|
4
|
+
|
|
5
|
+
== 0.9.29 / 2026-07-02 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
6
|
+
|
|
7
|
+
* Refactor Meteor::RootElement
|
|
8
|
+
|
|
1
9
|
== 0.9.28 / 2026-07-01 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
10
|
|
|
3
11
|
* Fix Meteor::Elements
|
data/Gemfile.lock
CHANGED
data/lib/meteor/core/kernel.rb
CHANGED
|
@@ -1581,7 +1581,7 @@ module Meteor
|
|
|
1581
1581
|
# attribute search (属性検索)
|
|
1582
1582
|
# @res = @pattern.match(elm.attributes)
|
|
1583
1583
|
|
|
1584
|
-
#
|
|
1584
|
+
# Attribute existence check (属性の存在判定)
|
|
1585
1585
|
if elm.attributes.include?(String.new(" ") << attr_name << "=\"")
|
|
1586
1586
|
@_attr_value = attr_value
|
|
1587
1587
|
|
|
@@ -2068,7 +2068,7 @@ module Meteor
|
|
|
2068
2068
|
self.document_hook <<
|
|
2069
2069
|
"<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
|
|
2070
2070
|
|
|
2071
|
-
# self.document_hook << @root.
|
|
2071
|
+
# self.document_hook << @root.newline << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
|
|
2072
2072
|
else
|
|
2073
2073
|
# @root.hookDocument << "<" << @root.element.name
|
|
2074
2074
|
# @root.hookDocument << @root.element.attributes << '>' << @root.element.mixed_content
|
|
@@ -2076,7 +2076,7 @@ module Meteor
|
|
|
2076
2076
|
self.document_hook <<
|
|
2077
2077
|
"<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
|
|
2078
2078
|
|
|
2079
|
-
# self.document_hook << @root.
|
|
2079
|
+
# self.document_hook << @root.newline << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
|
|
2080
2080
|
end
|
|
2081
2081
|
|
|
2082
2082
|
self.element_hook = self.element_hook.origin.clone(self)
|
|
@@ -2092,7 +2092,7 @@ module Meteor
|
|
|
2092
2092
|
self.document_hook <<
|
|
2093
2093
|
"<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
|
|
2094
2094
|
|
|
2095
|
-
# self.document_hook << @root.
|
|
2095
|
+
# self.document_hook << @root.newline << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
|
|
2096
2096
|
else
|
|
2097
2097
|
# @root.hookDocument << "<" << @root.element.name
|
|
2098
2098
|
# @root.hookDocument << @_attributes << '>' << @root.document
|
|
@@ -2100,7 +2100,7 @@ module Meteor
|
|
|
2100
2100
|
self.document_hook <<
|
|
2101
2101
|
"<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
|
|
2102
2102
|
|
|
2103
|
-
# self.document_hook << @root.
|
|
2103
|
+
# self.document_hook << @root.newline << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
|
|
2104
2104
|
end
|
|
2105
2105
|
|
|
2106
2106
|
self.element_hook = self.element_hook.origin.clone(self)
|
|
@@ -2145,7 +2145,7 @@ module Meteor
|
|
|
2145
2145
|
pif2.root_element.document = String.new(elm.document)
|
|
2146
2146
|
end
|
|
2147
2147
|
|
|
2148
|
-
pif2.root_element.
|
|
2148
|
+
pif2.root_element.newline = elm.parser.root_element.newline
|
|
2149
2149
|
|
|
2150
2150
|
@elm_
|
|
2151
2151
|
end
|
|
@@ -2261,7 +2261,7 @@ module Meteor
|
|
|
2261
2261
|
def br_to_newline(content)
|
|
2262
2262
|
if (elm.cx || !is_match(@@match_tag_2, elm.name)) && content.include?(BR)
|
|
2263
2263
|
# 「<br>」->「¥r?¥n」
|
|
2264
|
-
content.gsub!(@@pattern_br_2, @root.
|
|
2264
|
+
content.gsub!(@@pattern_br_2, @root.newline)
|
|
2265
2265
|
end
|
|
2266
2266
|
end
|
|
2267
2267
|
|
|
@@ -29,79 +29,45 @@ module Meteor
|
|
|
29
29
|
def self.get(*args)
|
|
30
30
|
case args.length
|
|
31
31
|
when ONE
|
|
32
|
-
|
|
33
|
-
if @@regex_cache[args[0].to_sym]
|
|
34
|
-
@@regex_cache[args[0].to_sym]
|
|
35
|
-
else
|
|
36
|
-
@@regex_cache[args[0].to_sym] = Regexp.new(args[0], Regexp::MULTILINE)
|
|
37
|
-
end
|
|
38
|
-
|
|
32
|
+
get_1(args[0])
|
|
39
33
|
when TWO
|
|
40
|
-
|
|
41
|
-
if @@regex_cache[args[0].to_sym]
|
|
42
|
-
@@regex_cache[args[0].to_sym]
|
|
43
|
-
else
|
|
44
|
-
@@regex_cache[args[0].to_sym] = Regexp.new(args[0], args[1])
|
|
45
|
-
end
|
|
34
|
+
get_2(args[0], args[1])
|
|
46
35
|
else
|
|
47
36
|
raise ArgumentError
|
|
48
37
|
end
|
|
49
38
|
end
|
|
50
39
|
|
|
51
|
-
##
|
|
52
|
-
## get pattern (パターンを取得する)
|
|
53
|
-
## @param [String] regex regular expression (正規表現)
|
|
54
|
-
## @return [Regexp] pattern (パターン)
|
|
55
|
-
##
|
|
56
|
-
# def self.get_1(regex)
|
|
57
|
-
# ## pattern = @@regex_cache[regex]
|
|
58
|
-
# ##
|
|
59
|
-
# ## if pattern == nil
|
|
60
|
-
# # if regex.kind_of?(String)
|
|
61
|
-
# if !@@regex_cache[regex.to_sym]
|
|
62
|
-
# # pattern = Regexp.new(regex)
|
|
63
|
-
# # @@regex_cache[regex] = pattern
|
|
64
|
-
# @@regex_cache[regex.to_sym] = Regexp.new(regex, Regexp::MULTILINE)
|
|
65
|
-
# end
|
|
66
40
|
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
41
|
+
# get pattern (パターンを取得する)
|
|
42
|
+
# @param [String] regex regular expression (正規表現)
|
|
43
|
+
# @return [Regexp] pattern (パターン)
|
|
44
|
+
#
|
|
45
|
+
def self.get_1(regex)
|
|
46
|
+
if @@regex_cache[regex.to_sym]
|
|
47
|
+
@@regex_cache[regex.to_sym]
|
|
48
|
+
else
|
|
49
|
+
@@regex_cache[regex.to_sym] = Regexp.new(regex, Regexp::MULTILINE)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
77
52
|
|
|
78
|
-
##
|
|
79
|
-
## get pattern (パターンを取得する)
|
|
80
|
-
## @param [String] regex (正規表現)
|
|
81
|
-
## @param [Integer] option (オプション)
|
|
82
|
-
## @return [Regexp] psttern (パターン)
|
|
83
|
-
##
|
|
84
|
-
# def self.get_2(regex, option)
|
|
85
|
-
# ## pattern = @@regex_cache[regex]
|
|
86
|
-
# ##
|
|
87
|
-
# ## if pattern == nil
|
|
88
|
-
# # if regex.kind_of?(String)
|
|
89
|
-
# if !@@regex_cache[regex.to_sym]
|
|
90
|
-
# # pattern = Regexp.new(regex)
|
|
91
|
-
# # @@regex_cache[regex] = pattern
|
|
92
|
-
# @@regex_cache[regex.to_sym] = Regexp.new(regex, option,"UTF-8")
|
|
93
|
-
# end
|
|
94
53
|
#
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
#
|
|
98
|
-
#
|
|
99
|
-
#
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
54
|
+
# get pattern (パターンを取得する)
|
|
55
|
+
# @param [String] regex (正規表現)
|
|
56
|
+
# @param [Integer] option (オプション)
|
|
57
|
+
# @return [Regexp] psttern (パターン)
|
|
58
|
+
#
|
|
59
|
+
def self.get_2(regex, option)
|
|
60
|
+
if @@regex_cache[regex.to_sym]
|
|
61
|
+
@@regex_cache[regex.to_sym]
|
|
62
|
+
else
|
|
63
|
+
@@regex_cache[regex.to_sym] = Regexp.new(regex, option)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class << self
|
|
68
|
+
private :get_1
|
|
69
|
+
private :get_2
|
|
70
|
+
end
|
|
105
71
|
end
|
|
106
72
|
end
|
|
107
73
|
end
|
|
@@ -87,7 +87,7 @@ module Meteor
|
|
|
87
87
|
self.document_hook = String.new(ps.document_hook)
|
|
88
88
|
@root.content_type = String.new(ps.root_element.content_type)
|
|
89
89
|
@root.charset = ps.root_element.charset
|
|
90
|
-
@root.
|
|
90
|
+
@root.newline = ps.root_element.newline
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
private :initialize_1
|
|
@@ -107,7 +107,7 @@ module Meteor
|
|
|
107
107
|
self.document_hook = String.new(ps.document_hook)
|
|
108
108
|
@root.content_type = String.new(ps.root_element.content_type)
|
|
109
109
|
@root.charset = ps.root_element.charset
|
|
110
|
-
@root.
|
|
110
|
+
@root.newline = ps.root_element.newline
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
private :initialize_1
|
|
@@ -171,8 +171,8 @@ module Meteor
|
|
|
171
171
|
def analyze_newline
|
|
172
172
|
for a in KAIGYO_CODE
|
|
173
173
|
if @root.document.include?(a)
|
|
174
|
-
@root.
|
|
175
|
-
# puts "kaigyo:" << @root.
|
|
174
|
+
@root.newline = a
|
|
175
|
+
# puts "kaigyo:" << @root.newline
|
|
176
176
|
end
|
|
177
177
|
end
|
|
178
178
|
end
|
|
@@ -63,7 +63,7 @@ module Meteor
|
|
|
63
63
|
self.document_hook = String.new(ps.document_hook)
|
|
64
64
|
@root.content_type = String.new(ps.root_element.content_type)
|
|
65
65
|
@root.charset = ps.root_element.charset
|
|
66
|
-
@root.
|
|
66
|
+
@root.newline = ps.root_element.newline
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
private :initialize_1
|
|
@@ -103,7 +103,7 @@ module Meteor
|
|
|
103
103
|
self.document_hook = String.new(ps.document_hook)
|
|
104
104
|
@root.content_type = String.new(ps.root_element.content_type)
|
|
105
105
|
@root.charset = ps.root_element.charset
|
|
106
|
-
@root.
|
|
106
|
+
@root.newline = ps.root_element.newline
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
private :initialize_1
|
|
@@ -166,7 +166,7 @@ module Meteor
|
|
|
166
166
|
def analyze_newline
|
|
167
167
|
for a in KAIGYO_CODE
|
|
168
168
|
if @root.document.include?(a)
|
|
169
|
-
@root.
|
|
169
|
+
@root.newline = a
|
|
170
170
|
end
|
|
171
171
|
end
|
|
172
172
|
end
|
|
@@ -60,7 +60,7 @@ module Meteor
|
|
|
60
60
|
@root.document = String.new(ps.document)
|
|
61
61
|
ps.document_hook = String.new(ps.document_hook)
|
|
62
62
|
@root.content_type = String.new(ps.root_element.content_type)
|
|
63
|
-
@root.
|
|
63
|
+
@root.newline = ps.root_element.newline
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
private :initialize_1
|
|
@@ -98,8 +98,8 @@ module Meteor
|
|
|
98
98
|
def analyze_newline
|
|
99
99
|
for a in KAIGYO_CODE
|
|
100
100
|
if @root.document.include?(a)
|
|
101
|
-
@root.
|
|
102
|
-
# puts "kaigyo:" << @root.
|
|
101
|
+
@root.newline = a
|
|
102
|
+
# puts "kaigyo:" << @root.newline
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
end
|
data/lib/meteor/root_element.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Meteor
|
|
|
7
7
|
#
|
|
8
8
|
# @!attribute [rw] content_type
|
|
9
9
|
# @return [String] content type (コンテントタイプ)
|
|
10
|
-
# @!attribute [rw]
|
|
10
|
+
# @!attribute [rw] newline
|
|
11
11
|
# @return [String] newline (改行コード)
|
|
12
12
|
# @!attribute [rw] charset
|
|
13
13
|
# @return [String] charset (文字コード)
|
|
@@ -16,12 +16,15 @@ module Meteor
|
|
|
16
16
|
#
|
|
17
17
|
class RootElement < Element
|
|
18
18
|
attr_accessor :content_type
|
|
19
|
-
attr_accessor :
|
|
19
|
+
attr_accessor :newline
|
|
20
20
|
attr_accessor :charset
|
|
21
21
|
attr_accessor :enc
|
|
22
22
|
# attr_accessor :document #[String] document (ドキュメント)
|
|
23
23
|
|
|
24
24
|
alias_method :character_encoding, :enc
|
|
25
25
|
alias_method :character_encoding=, :enc=
|
|
26
|
+
|
|
27
|
+
alias_method :kaigyo_code, :newline
|
|
28
|
+
alias_method :kaigyo_code=, :newline=
|
|
26
29
|
end
|
|
27
30
|
end
|
data/lib/meteor.rb
CHANGED
|
@@ -36,11 +36,11 @@ require "meteor/ml/xml/parser_impl"
|
|
|
36
36
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
37
37
|
#
|
|
38
38
|
# @author Yasumasa Ashida
|
|
39
|
-
# @version 0.9.
|
|
39
|
+
# @version 0.9.30
|
|
40
40
|
#
|
|
41
41
|
|
|
42
42
|
module Meteor
|
|
43
|
-
VERSION = "0.9.
|
|
43
|
+
VERSION = "0.9.30"
|
|
44
44
|
|
|
45
45
|
# require 'fileutils'
|
|
46
46
|
|