meteor 0.9.25 → 0.9.26
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 +20 -17
- data/lib/meteor/element.rb +12 -21
- data/lib/meteor/ml/html4/parser_impl.rb +1 -1
- data/lib/meteor/parsers.rb +1 -1
- 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: a6776307290552674dcb55922ddc18ed004c4b79c1176c80ddd9f60ad87b0b1d
|
|
4
|
+
data.tar.gz: ec1e5797f5e09c537603b7ac67866cd51ab0cbbd80f6dd30074d9e43642b0fb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9b7bdd39d61dc47cf3929eda3a4b9a08399d3b72223b6ac9a392ebce76566b11872bb6a186e73f793fa58e2b897ead3fd2e4aeb3cac08c8a08f3eae5731c9d6
|
|
7
|
+
data.tar.gz: 940e99265e10e13149cc4fc0bd50732d8ee9b1f3c7a66dfcc2ecf012fc8e7602b016041ae6453b444085dfcdfe97be6fb6f7fc4818050015c06df5872925c5f0
|
data/ChangeLog
CHANGED
data/Gemfile.lock
CHANGED
data/lib/meteor/core/kernel.rb
CHANGED
|
@@ -111,18 +111,22 @@ module Meteor
|
|
|
111
111
|
# set character encoding (文字エンコーディングをセットする)
|
|
112
112
|
# @param [String] enc character encoding (文字エンコーディング)
|
|
113
113
|
#
|
|
114
|
-
def
|
|
115
|
-
@root.
|
|
114
|
+
def enc=(enc)
|
|
115
|
+
@root.enc = enc
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
+
alias_method :character_encoding=, :enc=
|
|
119
|
+
|
|
118
120
|
#
|
|
119
121
|
# get character encoding (文字エンコーディングを取得する)
|
|
120
122
|
# @return [String] character encoding (文字エンコーディング)
|
|
121
123
|
#
|
|
122
|
-
def
|
|
123
|
-
@root.
|
|
124
|
+
def enc
|
|
125
|
+
@root.enc
|
|
124
126
|
end
|
|
125
127
|
|
|
128
|
+
alias_method :character_encoding, :enc
|
|
129
|
+
|
|
126
130
|
#
|
|
127
131
|
# get root element (ルート要素を取得する)
|
|
128
132
|
# @return [Meteor::RootElement] root element (ルート要素)
|
|
@@ -158,23 +162,25 @@ module Meteor
|
|
|
158
162
|
#
|
|
159
163
|
def read(file_path, enc)
|
|
160
164
|
# try {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
io = File.open(file_path, "r:UTF-8")
|
|
165
|
+
self.enc = enc
|
|
166
|
+
mode = if enc == "UTF-8"
|
|
167
|
+
# String.new("") << "r:" << enc
|
|
168
|
+
"r:UTF-8"
|
|
166
169
|
else
|
|
167
|
-
|
|
170
|
+
String.new("") << "r:" << enc << ":utf-8"
|
|
168
171
|
end
|
|
169
172
|
|
|
173
|
+
# open file (ファイルのオープン)
|
|
174
|
+
io = File.open(file_path, mode)
|
|
175
|
+
|
|
170
176
|
# load and save (読込及び格納)
|
|
171
177
|
@root.document = io.read
|
|
172
178
|
|
|
173
|
-
parse
|
|
174
|
-
|
|
175
179
|
# close file (ファイルのクローズ)
|
|
176
180
|
io.close
|
|
177
181
|
|
|
182
|
+
parse
|
|
183
|
+
|
|
178
184
|
return @root.document
|
|
179
185
|
end
|
|
180
186
|
|
|
@@ -2148,7 +2154,6 @@ module Meteor
|
|
|
2148
2154
|
# private :shadow
|
|
2149
2155
|
|
|
2150
2156
|
def set_mono_info(elm)
|
|
2151
|
-
|
|
2152
2157
|
@res = @@pattern_set_mono1.match(elm.mixed_content)
|
|
2153
2158
|
|
|
2154
2159
|
if @res
|
|
@@ -2164,7 +2169,7 @@ module Meteor
|
|
|
2164
2169
|
elsif regex.kind_of?(Array)
|
|
2165
2170
|
is_match_a(regex, str)
|
|
2166
2171
|
elsif regex.kind_of?(String)
|
|
2167
|
-
if regex
|
|
2172
|
+
if regex == str.downcase
|
|
2168
2173
|
true
|
|
2169
2174
|
else
|
|
2170
2175
|
false
|
|
@@ -2189,9 +2194,7 @@ module Meteor
|
|
|
2189
2194
|
def is_match_a(regex, str)
|
|
2190
2195
|
str = str.downcase
|
|
2191
2196
|
regex.each do |item|
|
|
2192
|
-
if item
|
|
2193
|
-
return true
|
|
2194
|
-
end
|
|
2197
|
+
return true if item == str
|
|
2195
2198
|
end
|
|
2196
2199
|
|
|
2197
2200
|
false
|
data/lib/meteor/element.rb
CHANGED
|
@@ -112,11 +112,20 @@ module Meteor
|
|
|
112
112
|
# @param [Meteor::Element] elm element (要素)
|
|
113
113
|
#
|
|
114
114
|
def initialize_e(elm)
|
|
115
|
+
initialize_2(elm, elm.parser)
|
|
116
|
+
@usable = true
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
private :initialize_e
|
|
120
|
+
|
|
121
|
+
def initialize_2(elm, ps)
|
|
122
|
+
@parser = ps
|
|
115
123
|
if self.normal
|
|
116
|
-
|
|
124
|
+
ps.element(elm)
|
|
117
125
|
else
|
|
118
126
|
@name = elm.name
|
|
119
127
|
@attributes = String.new(elm.attributes)
|
|
128
|
+
@mixed_content = String.new(elm.mixed_content)
|
|
120
129
|
# @pattern = String.new(elm.pattern)
|
|
121
130
|
@pattern = elm.pattern
|
|
122
131
|
@document = String.new(elm.document)
|
|
@@ -124,29 +133,11 @@ module Meteor
|
|
|
124
133
|
@cx = elm.cx
|
|
125
134
|
@mono = elm.mono
|
|
126
135
|
@origin = elm
|
|
127
|
-
@
|
|
128
|
-
|
|
136
|
+
# @usable = false
|
|
137
|
+
elm.copy = self
|
|
129
138
|
end
|
|
130
139
|
end
|
|
131
140
|
|
|
132
|
-
private :initialize_e
|
|
133
|
-
|
|
134
|
-
def initialize_2(elm, ps)
|
|
135
|
-
@name = elm.name
|
|
136
|
-
@attributes = String.new(elm.attributes)
|
|
137
|
-
@mixed_content = String.new(elm.mixed_content)
|
|
138
|
-
# @pattern = String.new(elm.pattern)
|
|
139
|
-
@pattern = elm.pattern
|
|
140
|
-
@document = String.new(elm.document)
|
|
141
|
-
@normal = elm.normal
|
|
142
|
-
@cx = elm.cx
|
|
143
|
-
@mono = elm.mono
|
|
144
|
-
@parser = ps
|
|
145
|
-
# @usable = false
|
|
146
|
-
@origin = elm
|
|
147
|
-
elm.copy = self
|
|
148
|
-
end
|
|
149
|
-
|
|
150
141
|
private :initialize_2
|
|
151
142
|
|
|
152
143
|
#
|
|
@@ -493,7 +493,7 @@ module Meteor
|
|
|
493
493
|
@res = match_p.match(elm.attributes)
|
|
494
494
|
|
|
495
495
|
if !@res
|
|
496
|
-
if
|
|
496
|
+
if elm.attributes != "" && elm.attributes.strip != ""
|
|
497
497
|
elm.attributes = String.new("") << " " << elm.attributes.strip
|
|
498
498
|
else
|
|
499
499
|
elm.attributes = String.new("")
|
data/lib/meteor/parsers.rb
CHANGED
|
@@ -190,7 +190,7 @@ module Meteor
|
|
|
190
190
|
if paths.length == 1
|
|
191
191
|
return File.basename(paths[0], ".*")
|
|
192
192
|
else
|
|
193
|
-
if
|
|
193
|
+
if paths[0] == "."
|
|
194
194
|
paths.delete_at(0)
|
|
195
195
|
paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
|
|
196
196
|
return String.new("") << "/" << paths.join("/")
|
data/lib/meteor/root_element.rb
CHANGED
|
@@ -11,14 +11,17 @@ module Meteor
|
|
|
11
11
|
# @return [String] newline (改行コード)
|
|
12
12
|
# @!attribute [rw] charset
|
|
13
13
|
# @return [String] charset (文字コード)
|
|
14
|
-
# @!attribute [rw]
|
|
14
|
+
# @!attribute [rw] enc
|
|
15
15
|
# @return [String] character encoding (文字エンコーディング)
|
|
16
16
|
#
|
|
17
17
|
class RootElement < Element
|
|
18
18
|
attr_accessor :content_type
|
|
19
19
|
attr_accessor :kaigyo_code
|
|
20
20
|
attr_accessor :charset
|
|
21
|
-
attr_accessor :
|
|
21
|
+
attr_accessor :enc
|
|
22
22
|
# attr_accessor :document #[String] document (ドキュメント)
|
|
23
|
+
|
|
24
|
+
alias_method :character_encoding, :enc
|
|
25
|
+
alias_method :character_encoding=, :enc=
|
|
23
26
|
end
|
|
24
27
|
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.26
|
|
40
40
|
#
|
|
41
41
|
|
|
42
42
|
module Meteor
|
|
43
|
-
VERSION = "0.9.
|
|
43
|
+
VERSION = "0.9.26"
|
|
44
44
|
|
|
45
45
|
# require 'fileutils'
|
|
46
46
|
|