meteor 0.9.30 → 0.9.32
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 +3 -1
- data/Gemfile.lock +34 -3
- data/demo/html.rb +32 -38
- data/demo/html4.rb +27 -33
- data/demo/xhtml.rb +29 -35
- data/demo/xhtml4.rb +27 -33
- data/demo/xml.rb +20 -20
- data/lib/meteor/attribute.rb +1 -4
- data/lib/meteor/attribute_map.rb +21 -22
- data/lib/meteor/core/kernel.rb +604 -727
- data/lib/meteor/core/util/file_reader.rb +37 -0
- data/lib/meteor/core/util/pattern_cache.rb +7 -7
- data/lib/meteor/element.rb +48 -67
- data/lib/meteor/elements.rb +6 -6
- data/lib/meteor/exception/no_such_element_exception.rb +15 -15
- data/lib/meteor/ml/html/parser_impl.rb +69 -71
- data/lib/meteor/ml/html4/parser_impl.rb +129 -144
- data/lib/meteor/ml/xhtml/parser_impl.rb +44 -46
- data/lib/meteor/ml/xhtml4/parser_impl.rb +85 -87
- data/lib/meteor/ml/xml/parser_impl.rb +29 -29
- data/lib/meteor/parsers.rb +92 -100
- data/lib/meteor/root_element.rb +5 -8
- data/lib/meteor.rb +62 -61
- data/meteor.gemspec +14 -13
- data/test/meteor_test.rb +4 -2
- data/test/test_helper.rb +3 -2
- metadata +4 -4
- data/Rakefile +0 -144
data/lib/meteor/parsers.rb
CHANGED
|
@@ -13,19 +13,17 @@ module Meteor
|
|
|
13
13
|
# @return [String] default character encoding (デフォルトエンコーディング)
|
|
14
14
|
#
|
|
15
15
|
class Parsers
|
|
16
|
-
attr_accessor :type
|
|
17
|
-
attr_accessor :root
|
|
18
|
-
attr_accessor :enc
|
|
16
|
+
attr_accessor :type, :root, :enc
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
alias base_type type
|
|
19
|
+
alias base_type= type=
|
|
20
|
+
alias base_dir root
|
|
21
|
+
alias base_dir= root=
|
|
22
|
+
alias base_enc enc
|
|
23
|
+
alias base_enc= enc=
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
alias base_encoding enc
|
|
26
|
+
alias base_encoding= enc=
|
|
29
27
|
|
|
30
28
|
#
|
|
31
29
|
# initializer (イニシャライザ)
|
|
@@ -43,13 +41,13 @@ module Meteor
|
|
|
43
41
|
def initialize(*args)
|
|
44
42
|
case args.length
|
|
45
43
|
when 0
|
|
46
|
-
|
|
44
|
+
initialize_zero
|
|
47
45
|
when 1
|
|
48
|
-
|
|
46
|
+
initialize_one(args[0])
|
|
49
47
|
when 2
|
|
50
|
-
|
|
48
|
+
initialize_two(args[0], args[1])
|
|
51
49
|
when 3
|
|
52
|
-
|
|
50
|
+
initialize_three(args[0], args[1], args[2])
|
|
53
51
|
else
|
|
54
52
|
raise ArgumentError
|
|
55
53
|
end
|
|
@@ -58,34 +56,34 @@ module Meteor
|
|
|
58
56
|
#
|
|
59
57
|
# initializer (イニシャライザ)
|
|
60
58
|
#
|
|
61
|
-
def
|
|
62
|
-
|
|
59
|
+
def initialize_zero
|
|
60
|
+
initialize_two
|
|
63
61
|
end
|
|
64
62
|
|
|
65
|
-
private :
|
|
63
|
+
private :initialize_zero
|
|
66
64
|
|
|
67
65
|
#
|
|
68
66
|
# initializer (イニシャライザ)
|
|
69
67
|
# @param [String] root root directory (基準ディレクトリ)
|
|
70
68
|
#
|
|
71
|
-
def
|
|
72
|
-
|
|
69
|
+
def initialize_one(root)
|
|
70
|
+
initialize_two(root)
|
|
73
71
|
end
|
|
74
72
|
|
|
75
|
-
private :
|
|
73
|
+
private :initialize_one
|
|
76
74
|
|
|
77
75
|
#
|
|
78
76
|
# initializer (イニシャライザ)
|
|
79
77
|
# @param [String] root root directory (基準ディレクトリ)
|
|
80
78
|
# @param [String] enc default character encoding (デフォルト文字エンコーディング)
|
|
81
79
|
#
|
|
82
|
-
def
|
|
83
|
-
@cache =
|
|
80
|
+
def initialize_two(root = '.', enc = 'UTF-8')
|
|
81
|
+
@cache = {}
|
|
84
82
|
@root = root
|
|
85
83
|
@enc = enc
|
|
86
84
|
end
|
|
87
85
|
|
|
88
|
-
private :
|
|
86
|
+
private :initialize_two
|
|
89
87
|
|
|
90
88
|
#
|
|
91
89
|
# initializer (イニシャライザ)
|
|
@@ -93,14 +91,14 @@ module Meteor
|
|
|
93
91
|
# @param [String] root root directory (基準ディレクトリ)
|
|
94
92
|
# @param [String] enc default character encoding (デフォルト文字エンコーディング)
|
|
95
93
|
#
|
|
96
|
-
def
|
|
97
|
-
@cache =
|
|
94
|
+
def initialize_three(type, root = '.', enc = 'UTF-8')
|
|
95
|
+
@cache = {}
|
|
98
96
|
@type = type
|
|
99
97
|
@root = root
|
|
100
98
|
@enc = enc
|
|
101
99
|
end
|
|
102
100
|
|
|
103
|
-
private :
|
|
101
|
+
private :initialize_three
|
|
104
102
|
|
|
105
103
|
#
|
|
106
104
|
# set options (オプションをセットする)
|
|
@@ -113,46 +111,44 @@ module Meteor
|
|
|
113
111
|
# @option @deprecated opts [Integer | Symbol] :base_type default type of parser (デフォルトのパーサ・タイプ)
|
|
114
112
|
#
|
|
115
113
|
def options=(opts)
|
|
116
|
-
|
|
117
|
-
if opts.include?(:root)
|
|
118
|
-
@root = opts[:root]
|
|
119
|
-
elsif opts.include?(:base_dir)
|
|
120
|
-
@root = opts[:base_dir]
|
|
121
|
-
end
|
|
114
|
+
raise ArgumentError unless opts.is_a?(Hash)
|
|
122
115
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
if opts.include?(:root)
|
|
117
|
+
@root = opts[:root]
|
|
118
|
+
elsif opts.include?(:base_dir)
|
|
119
|
+
@root = opts[:base_dir]
|
|
120
|
+
end
|
|
128
121
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
if opts.include?(:enc)
|
|
123
|
+
@enc = opts[:enc]
|
|
124
|
+
elsif opts.include?(:base_enc)
|
|
125
|
+
@enc = opts[:base_enc]
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if opts.include?(:type)
|
|
129
|
+
@type = opts[:type]
|
|
130
|
+
elsif opts.include?(:base_type)
|
|
131
|
+
@type = opts[:base_type]
|
|
136
132
|
end
|
|
137
133
|
end
|
|
138
134
|
|
|
139
135
|
#
|
|
140
|
-
|
|
136
|
+
# @overload add(relative_path,enc)
|
|
141
137
|
# add parser (パーサを追加する)
|
|
142
138
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
143
139
|
# @param [String] enc character encoding (文字エンコーディング)
|
|
144
140
|
# @return [Meteor::Parser] parser (パーサ)
|
|
145
|
-
|
|
141
|
+
# @overload add(relative_path)
|
|
146
142
|
# add parser (パーサを追加する)
|
|
147
143
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
148
144
|
# @return [Meteor::Parser] parser (パーサ)
|
|
149
|
-
|
|
145
|
+
# @overload add(type,relative_path,enc)
|
|
150
146
|
# add parser (パーサを追加する)
|
|
151
147
|
# @param [Integer,Symbol] type type of parser (パーサ・タイプ)
|
|
152
148
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
153
149
|
# @param [String] enc character encoding (文字エンコーディング)
|
|
154
150
|
# @return [Meteor::Parser] parser (パーサ)
|
|
155
|
-
|
|
151
|
+
# @overload add(type,relative_path)
|
|
156
152
|
# add parser (パーサを追加する)
|
|
157
153
|
# @param [Integer,Symbol] type type of parser (パーサ・タイプ)
|
|
158
154
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
@@ -161,23 +157,23 @@ module Meteor
|
|
|
161
157
|
def add(*args)
|
|
162
158
|
case args.length
|
|
163
159
|
when 1
|
|
164
|
-
|
|
160
|
+
add_file_one(args[0])
|
|
165
161
|
when 2
|
|
166
|
-
if args[0].
|
|
167
|
-
|
|
168
|
-
elsif args[0].
|
|
169
|
-
|
|
162
|
+
if args[0].is_a?(Integer) || args[0].is_a?(Symbol)
|
|
163
|
+
add_file_two_n(args[0], args[1])
|
|
164
|
+
elsif args[0].is_a?(String)
|
|
165
|
+
add_file_two_s(args[0], args[1])
|
|
170
166
|
else
|
|
171
167
|
raise ArgumentError
|
|
172
168
|
end
|
|
173
169
|
when 3
|
|
174
|
-
|
|
170
|
+
add_file_three(args[0], args[1], args[2])
|
|
175
171
|
else
|
|
176
172
|
raise ArgumentError
|
|
177
173
|
end
|
|
178
174
|
end
|
|
179
175
|
|
|
180
|
-
|
|
176
|
+
alias link add
|
|
181
177
|
|
|
182
178
|
#
|
|
183
179
|
# change relative path to relative url (相対パスを相対URLにする)
|
|
@@ -188,16 +184,14 @@ module Meteor
|
|
|
188
184
|
paths = File.split(path)
|
|
189
185
|
|
|
190
186
|
if paths.length == 1
|
|
191
|
-
|
|
187
|
+
File.basename(paths[0], '.*')
|
|
188
|
+
elsif paths[0] == '.'
|
|
189
|
+
paths.delete_at(0)
|
|
190
|
+
paths[paths.length - 1] = File.basename(paths[paths.length - 1], '.*')
|
|
191
|
+
String.new('') << '/' << paths.join('/')
|
|
192
192
|
else
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
|
|
196
|
-
return String.new("") << "/" << paths.join("/")
|
|
197
|
-
else
|
|
198
|
-
paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
|
|
199
|
-
return String.new("") << "/" << paths.join("/")
|
|
200
|
-
end
|
|
193
|
+
paths[paths.length - 1] = File.basename(paths[paths.length - 1], '.*')
|
|
194
|
+
String.new('') << '/' << paths.join('/')
|
|
201
195
|
end
|
|
202
196
|
end
|
|
203
197
|
|
|
@@ -210,15 +204,14 @@ module Meteor
|
|
|
210
204
|
# @param [String] enc character encoding (文字エンコーディング)
|
|
211
205
|
# @return [Meteor::Parser] parser(パーサ)
|
|
212
206
|
#
|
|
213
|
-
def
|
|
214
|
-
ps = new_parser(type)
|
|
215
|
-
ps.read(File.expand_path(relative_path, @root), enc)
|
|
216
|
-
|
|
207
|
+
def add_file_three(type, relative_path, enc = 'UTF-8')
|
|
217
208
|
relative_url = path_to_url(relative_path)
|
|
218
|
-
|
|
209
|
+
|
|
210
|
+
add_template_three(type, relative_url,
|
|
211
|
+
Meteor::Core::Util::FileReader.read(File.expand_path(relative_path, @root), enc))
|
|
219
212
|
end
|
|
220
213
|
|
|
221
|
-
private :
|
|
214
|
+
private :add_file_three
|
|
222
215
|
|
|
223
216
|
#
|
|
224
217
|
# add parser (パーサを追加する)
|
|
@@ -226,11 +219,11 @@ module Meteor
|
|
|
226
219
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
227
220
|
# @return [Meteor::Parser] parser (パーサ)
|
|
228
221
|
#
|
|
229
|
-
def
|
|
230
|
-
|
|
222
|
+
def add_file_two_n(type, relative_path)
|
|
223
|
+
add_file_three(type, relative_path, @enc)
|
|
231
224
|
end
|
|
232
225
|
|
|
233
|
-
private :
|
|
226
|
+
private :add_file_two_n
|
|
234
227
|
|
|
235
228
|
#
|
|
236
229
|
# add parser (パーサを追加する)
|
|
@@ -238,22 +231,22 @@ module Meteor
|
|
|
238
231
|
# @param [String] enc character encoding (文字エンコーディング)
|
|
239
232
|
# @return [Meteor::Parser] parser (パーサ)
|
|
240
233
|
#
|
|
241
|
-
def
|
|
242
|
-
|
|
234
|
+
def add_file_two_s(relative_path, enc)
|
|
235
|
+
add_file_three(@type, relative_path, enc)
|
|
243
236
|
end
|
|
244
237
|
|
|
245
|
-
private :
|
|
238
|
+
private :add_file_two_s
|
|
246
239
|
|
|
247
240
|
#
|
|
248
241
|
# add parser (パーサを追加する)
|
|
249
242
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
250
243
|
# @return [Meteor::Parser] parser (パーサ)
|
|
251
244
|
#
|
|
252
|
-
def
|
|
253
|
-
|
|
245
|
+
def add_file_one(relative_path)
|
|
246
|
+
add_file_three(@type, relative_path, @enc)
|
|
254
247
|
end
|
|
255
248
|
|
|
256
|
-
private :
|
|
249
|
+
private :add_file_one
|
|
257
250
|
|
|
258
251
|
#
|
|
259
252
|
# @overload add_template(type, relative_url, doc)
|
|
@@ -271,9 +264,9 @@ module Meteor
|
|
|
271
264
|
def add_template(*args)
|
|
272
265
|
case args.length
|
|
273
266
|
when 2
|
|
274
|
-
|
|
267
|
+
add_template_two(args[0], args[1])
|
|
275
268
|
when 3
|
|
276
|
-
|
|
269
|
+
add_template_three(args[0], args[1], args[2])
|
|
277
270
|
else
|
|
278
271
|
raise ArgumentError
|
|
279
272
|
end
|
|
@@ -286,15 +279,14 @@ module Meteor
|
|
|
286
279
|
# @param [String] doc document (ドキュメント)
|
|
287
280
|
# @return [Meteor::Parser] parser (パーサ)
|
|
288
281
|
#
|
|
289
|
-
def
|
|
282
|
+
def add_template_three(type, relative_url, doc)
|
|
290
283
|
ps = new_parser(type)
|
|
291
284
|
ps.document = doc
|
|
292
|
-
ps.parse
|
|
293
285
|
|
|
294
286
|
@cache[relative_url] = ps
|
|
295
287
|
end
|
|
296
288
|
|
|
297
|
-
private :
|
|
289
|
+
private :add_template_three
|
|
298
290
|
|
|
299
291
|
#
|
|
300
292
|
# add parser (パーサを追加する)
|
|
@@ -302,29 +294,29 @@ module Meteor
|
|
|
302
294
|
# @param [String] doc document (ドキュメント)
|
|
303
295
|
# @return [Meteor::Parser] parser (パーサ)
|
|
304
296
|
#
|
|
305
|
-
def
|
|
306
|
-
|
|
297
|
+
def add_template_two(relative_url, doc)
|
|
298
|
+
add_template_three(@type, relative_url, doc)
|
|
307
299
|
end
|
|
308
300
|
|
|
309
|
-
private :
|
|
301
|
+
private :add_template_two
|
|
310
302
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
303
|
+
alias link_str add_template
|
|
304
|
+
alias add_str add_template
|
|
305
|
+
alias parser_str add_template
|
|
314
306
|
|
|
315
307
|
#
|
|
316
|
-
|
|
308
|
+
# @overload parser(key)
|
|
317
309
|
# get parser (パーサを取得する)
|
|
318
310
|
# @param [String,Symbol] key identifier (キー)
|
|
319
311
|
# @return [Meteor::Parser] parser (パーサ)
|
|
320
|
-
|
|
312
|
+
# @overload parser(type,relative_path,enc)
|
|
321
313
|
# add parser (パーサを追加する)
|
|
322
314
|
# @param [Integer] type type of parser (パーサ・タイプ)
|
|
323
315
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
324
316
|
# @param [String] enc character encoding (エンコーディング)
|
|
325
317
|
# @return [Meteor::Parser] parser (パーサ)
|
|
326
318
|
# @deprecated
|
|
327
|
-
|
|
319
|
+
# @overload parser(type,relative_path)
|
|
328
320
|
# add parser (パーサを追加する)
|
|
329
321
|
# @param [Integer] type type of parser (パーサ・タイプ)
|
|
330
322
|
# @param [String] relative_path relative file path (相対ファイルパス)
|
|
@@ -333,11 +325,11 @@ module Meteor
|
|
|
333
325
|
def parser(*args)
|
|
334
326
|
case args.length
|
|
335
327
|
when 1
|
|
336
|
-
|
|
328
|
+
parser_one(args[0])
|
|
337
329
|
when 2, 3
|
|
338
330
|
add(args)
|
|
339
331
|
end
|
|
340
|
-
#
|
|
332
|
+
# parser_one(key)
|
|
341
333
|
end
|
|
342
334
|
|
|
343
335
|
#
|
|
@@ -345,7 +337,7 @@ module Meteor
|
|
|
345
337
|
# @param [String] key identifier (キー)
|
|
346
338
|
# @return [Meteor::Parser] parser (パーサ)
|
|
347
339
|
#
|
|
348
|
-
def
|
|
340
|
+
def parser_one(key)
|
|
349
341
|
@pif = @cache[key.to_s]
|
|
350
342
|
case @pif.doc_type
|
|
351
343
|
when Meteor::Parser::HTML
|
|
@@ -361,7 +353,7 @@ module Meteor
|
|
|
361
353
|
end
|
|
362
354
|
end
|
|
363
355
|
|
|
364
|
-
private :
|
|
356
|
+
private :parser_one
|
|
365
357
|
|
|
366
358
|
#
|
|
367
359
|
# get root element (ルート要素を取得する)
|
|
@@ -369,7 +361,7 @@ module Meteor
|
|
|
369
361
|
# @return [Meteor::RootElement] root element (ルート要素)
|
|
370
362
|
#
|
|
371
363
|
def element(key)
|
|
372
|
-
|
|
364
|
+
parser_one(key).root_element
|
|
373
365
|
end
|
|
374
366
|
|
|
375
367
|
def new_parser(type)
|
|
@@ -406,7 +398,7 @@ module Meteor
|
|
|
406
398
|
# @return [Meteor::Parser] parser (パーサ)
|
|
407
399
|
#
|
|
408
400
|
def [](key)
|
|
409
|
-
|
|
401
|
+
parser(key)
|
|
410
402
|
end
|
|
411
403
|
end
|
|
412
404
|
|
data/lib/meteor/root_element.rb
CHANGED
|
@@ -15,16 +15,13 @@ module Meteor
|
|
|
15
15
|
# @return [String] character encoding (文字エンコーディング)
|
|
16
16
|
#
|
|
17
17
|
class RootElement < Element
|
|
18
|
-
attr_accessor :content_type
|
|
19
|
-
attr_accessor :newline
|
|
20
|
-
attr_accessor :charset
|
|
21
|
-
attr_accessor :enc
|
|
18
|
+
attr_accessor :content_type, :newline, :charset, :enc
|
|
22
19
|
# attr_accessor :document #[String] document (ドキュメント)
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
alias character_encoding enc
|
|
22
|
+
alias character_encoding= enc=
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
alias kaigyo_code newline
|
|
25
|
+
alias kaigyo_code= newline=
|
|
29
26
|
end
|
|
30
27
|
end
|
data/lib/meteor.rb
CHANGED
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
# -* coding: UTF-8 -*-
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
10
|
-
require
|
|
11
|
-
require
|
|
12
|
-
require
|
|
13
|
-
require
|
|
14
|
-
require
|
|
15
|
-
require
|
|
16
|
-
require
|
|
17
|
-
require
|
|
18
|
-
require
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
# the
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
# @
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
# -* coding: UTF-8 -*-
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'meteor/element'
|
|
5
|
+
require 'meteor/root_element'
|
|
6
|
+
require 'meteor/attribute'
|
|
7
|
+
require 'meteor/attribute_map'
|
|
8
|
+
require 'meteor/parser'
|
|
9
|
+
require 'meteor/parsers'
|
|
10
|
+
require 'meteor/elements'
|
|
11
|
+
require 'meteor/exception/no_such_element_exception'
|
|
12
|
+
require 'meteor/core/kernel'
|
|
13
|
+
require 'meteor/core/util/file_reader'
|
|
14
|
+
require 'meteor/core/util/pattern_cache'
|
|
15
|
+
require 'meteor/ml/html4/parser_impl'
|
|
16
|
+
require 'meteor/ml/html/parser_impl'
|
|
17
|
+
require 'meteor/ml/xhtml4/parser_impl'
|
|
18
|
+
require 'meteor/ml/xhtml/parser_impl'
|
|
19
|
+
require 'meteor/ml/xml/parser_impl'
|
|
20
|
+
|
|
21
|
+
# Meteor - A lightweight (X)HTML(5) & XML parser
|
|
22
|
+
#
|
|
23
|
+
# Copyright (C) 2008-present Yasumasa Ashida.
|
|
24
|
+
#
|
|
25
|
+
# This program is free software; you can redistribute it and/or modify
|
|
26
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
27
|
+
# the Free Software Foundation; either version 2.1 of the License, or
|
|
28
|
+
# (at your option) any later version.
|
|
29
|
+
#
|
|
30
|
+
# This program is distributed in the hope that it will be useful,
|
|
31
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
32
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
33
|
+
# GNU Lesser General Public License for more details.
|
|
34
|
+
#
|
|
35
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
36
|
+
# along with this program; if not, write to the Free Software
|
|
37
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
38
|
+
#
|
|
39
|
+
# @author Yasumasa Ashida
|
|
40
|
+
# @version 0.9.32
|
|
41
|
+
#
|
|
42
|
+
|
|
43
|
+
module Meteor
|
|
44
|
+
VERSION = '0.9.32'
|
|
45
|
+
|
|
46
|
+
# require 'fileutils'
|
|
47
|
+
|
|
48
|
+
ZERO = 0
|
|
49
|
+
ONE = 1
|
|
50
|
+
TWO = 2
|
|
51
|
+
THREE = 3
|
|
52
|
+
FOUR = 4
|
|
53
|
+
FIVE = 5
|
|
54
|
+
SIX = 6
|
|
55
|
+
SEVEN = 7
|
|
56
|
+
|
|
57
|
+
HTML = ZERO
|
|
58
|
+
XHTML = ONE
|
|
59
|
+
HTML4 = TWO
|
|
60
|
+
XHTML4 = THREE
|
|
61
|
+
XML = FOUR
|
|
62
|
+
end
|
data/meteor.gemspec
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'English'
|
|
4
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
6
|
require 'meteor'
|
|
5
7
|
|
|
6
8
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
9
|
+
spec.name = 'meteor'
|
|
8
10
|
spec.version = Meteor::VERSION
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email =
|
|
11
|
-
spec.description =
|
|
12
|
-
spec.summary =
|
|
13
|
-
spec.homepage =
|
|
11
|
+
spec.authors = ['Yasumasa Ashida']
|
|
12
|
+
spec.email = 'ys.ashida@gmail.com'
|
|
13
|
+
spec.description = 'A lightweight (X)HTML & XML parser'
|
|
14
|
+
spec.summary = 'A lightweight (X)HTML & XML parser'
|
|
15
|
+
spec.homepage = 'https://github.com/asip/meteor'
|
|
14
16
|
spec.license = 'LGPL-2.1-only'
|
|
15
17
|
|
|
16
|
-
spec.required_ruby_version =
|
|
18
|
+
spec.required_ruby_version = '>=3.0'
|
|
17
19
|
|
|
18
|
-
spec.files = `git ls-files`.split(
|
|
20
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
|
19
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
20
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features|demo)/})
|
|
21
|
-
spec.require_paths = [
|
|
23
|
+
spec.require_paths = ['lib']
|
|
22
24
|
|
|
23
|
-
spec.add_development_dependency
|
|
25
|
+
spec.add_development_dependency 'bundler', '~> 4.0.13'
|
|
24
26
|
# spec.add_development_dependency "rake"
|
|
25
|
-
|
|
26
27
|
end
|
data/test/meteor_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
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.
|
|
4
|
+
version: 0.9.32
|
|
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.
|
|
18
|
+
version: 4.0.13
|
|
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.
|
|
25
|
+
version: 4.0.13
|
|
26
26
|
description: A lightweight (X)HTML & XML parser
|
|
27
27
|
email: ys.ashida@gmail.com
|
|
28
28
|
executables: []
|
|
@@ -34,7 +34,6 @@ files:
|
|
|
34
34
|
- Gemfile
|
|
35
35
|
- Gemfile.lock
|
|
36
36
|
- README.md
|
|
37
|
-
- Rakefile
|
|
38
37
|
- demo/html.rb
|
|
39
38
|
- demo/html4.rb
|
|
40
39
|
- demo/ml/sample.xml
|
|
@@ -49,6 +48,7 @@ files:
|
|
|
49
48
|
- lib/meteor/attribute.rb
|
|
50
49
|
- lib/meteor/attribute_map.rb
|
|
51
50
|
- lib/meteor/core/kernel.rb
|
|
51
|
+
- lib/meteor/core/util/file_reader.rb
|
|
52
52
|
- lib/meteor/core/util/pattern_cache.rb
|
|
53
53
|
- lib/meteor/element.rb
|
|
54
54
|
- lib/meteor/elements.rb
|