meteor 0.9.13 → 0.9.14

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.
@@ -42,16 +42,16 @@ module Meteor
42
42
  #
43
43
  def initialize(*args)
44
44
  case args.length
45
- when 0
46
- initialize_0
47
- when 1
48
- initialize_1(args[0])
49
- when 2
50
- initialize_2(args[0], args[1])
51
- when 3
52
- initialize_3(args[0],args[1],args[2])
53
- else
54
- raise ArgumentError
45
+ when 0
46
+ initialize_0
47
+ when 1
48
+ initialize_1(args[0])
49
+ when 2
50
+ initialize_2(args[0], args[1])
51
+ when 3
52
+ initialize_3(args[0], args[1], args[2])
53
+ else
54
+ raise ArgumentError
55
55
  end
56
56
  end
57
57
 
@@ -97,7 +97,7 @@ module Meteor
97
97
  # @param [String] root root directory (基準ディレクトリ)
98
98
  # @param [String] enc default character encoding (デフォルト文字エンコーディング)
99
99
  #
100
- def initialize_3(type , root, enc)
100
+ def initialize_3(type, root, enc)
101
101
  @cache = Hash.new
102
102
  @type = type
103
103
  @root = root
@@ -123,11 +123,13 @@ module Meteor
123
123
  elsif opts.include?(:base_dir)
124
124
  @root = opts[:base_dir]
125
125
  end
126
+
126
127
  if opts.include?(:enc)
127
128
  @enc = opts[:enc]
128
129
  elsif opts.include?(:base_enc)
129
130
  @enc = opts[:base_enc]
130
131
  end
132
+
131
133
  if opts.include?(:type)
132
134
  @type = opts[:type]
133
135
  elsif opts.include?(:base_type)
@@ -162,20 +164,21 @@ module Meteor
162
164
  #
163
165
  def link(*args)
164
166
  case args.length
165
- when 1
166
- link_1(args[0])
167
- when 2
168
- if args[0].kind_of?(Fixnum) || args[0].kind_of?(Symbol)
169
- link_2_n(args[0], args[1])
170
- elsif args[0].kind_of?(String)
171
- link_2_s(args[0], args[1])
172
- else
173
- raise ArgumentError
174
- end
175
- when 3
176
- link_3(args[0], args[1], args[2])
167
+ when 1
168
+ link_1(args[0])
169
+ when 2
170
+ if args[0].kind_of?(Fixnum) || args[0].kind_of?(Symbol)
171
+ link_2_n(args[0], args[1])
172
+ elsif args[0].kind_of?(String)
173
+ link_2_s(args[0], args[1])
177
174
  else
178
175
  raise ArgumentError
176
+ end
177
+
178
+ when 3
179
+ link_3(args[0], args[1], args[2])
180
+ else
181
+ raise ArgumentError
179
182
  end
180
183
  end
181
184
 
@@ -188,15 +191,15 @@ module Meteor
188
191
  paths = File.split(path)
189
192
 
190
193
  if paths.length == 1
191
- return File.basename(paths[0], '.*')
194
+ return File.basename(paths[0], ".*")
192
195
  else
193
196
  if ".".eql?(paths[0])
194
- paths.delete_at 0
195
- paths[paths.length - 1] = File.basename(paths[paths.length - 1], '.*')
196
- return String.new('') << "/" << paths.join("/")
197
+ paths.delete_at(0)
198
+ paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
199
+ return String.new("") << "/" << paths.join("/")
197
200
  else
198
- paths[paths.length - 1] = File.basename(paths[paths.length - 1], '.*')
199
- return String.new('') << "/" << paths.join("/")
201
+ paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
202
+ return String.new("") << "/" << paths.join("/")
200
203
  end
201
204
  end
202
205
  end
@@ -215,26 +218,26 @@ module Meteor
215
218
  relative_url = path_to_url(relative_path)
216
219
 
217
220
  case type
218
- when Parser::HTML4, :html4
219
- html4 = Meteor::Ml::Html4::ParserImpl.new
220
- html.read(File.expand_path(relative_path, @root), enc)
221
- @cache[relative_url] = html4
222
- when Parser::XHTML4, :xhtml4
223
- xhtml4 = Meteor::Ml::Xhtml4::ParserImpl.new
224
- xhtml4.read(File.expand_path(relative_path, @root), enc)
225
- @cache[relative_url] = xhtml4
226
- when Parser::HTML, :html, :html5
227
- html = Meteor::Ml::Html::ParserImpl.new
228
- html.read(File.expand_path(relative_path, @root), enc)
229
- @cache[relative_url] = html
230
- when Parser::XHTML, :xhtml, :xhtml5
231
- xhtml = Meteor::Ml::Xhtml::ParserImpl.new
232
- xhtml.read(File.expand_path(relative_path, @root), enc)
233
- @cache[relative_url] = xhtml
234
- when Parser::XML, :xml
235
- xml = Meteor::Ml::Xml::ParserImpl.new
236
- xml.read(File.expand_path(relative_path, @root), enc)
237
- @cache[relative_url] = xml
221
+ when Parser::HTML, :html, :html5
222
+ html = Meteor::Ml::Html::ParserImpl.new
223
+ html.read(File.expand_path(relative_path, @root), enc)
224
+ @cache[relative_url] = html
225
+ when Parser::XML, :xml
226
+ xml = Meteor::Ml::Xml::ParserImpl.new
227
+ xml.read(File.expand_path(relative_path, @root), enc)
228
+ @cache[relative_url] = xml
229
+ when Parser::XHTML, :xhtml, :xhtml5
230
+ xhtml = Meteor::Ml::Xhtml::ParserImpl.new
231
+ xhtml.read(File.expand_path(relative_path, @root), enc)
232
+ @cache[relative_url] = xhtml
233
+ when Parser::HTML4, :html4
234
+ html4 = Meteor::Ml::Html4::ParserImpl.new
235
+ html.read(File.expand_path(relative_path, @root), enc)
236
+ @cache[relative_url] = html4
237
+ when Parser::XHTML4, :xhtml4
238
+ xhtml4 = Meteor::Ml::Xhtml4::ParserImpl.new
239
+ xhtml4.read(File.expand_path(relative_path, @root), enc)
240
+ @cache[relative_url] = xhtml4
238
241
  end
239
242
  end
240
243
 
@@ -251,21 +254,20 @@ module Meteor
251
254
  relative_url = path_to_url(relative_path)
252
255
 
253
256
  case type
254
- when Parser::HTML4, :html4
255
- ps = Meteor::Ml::Html4::ParserImpl.new
256
- when Parser::XHTML4, :xhtml4
257
- ps = Meteor::Ml::Xhtml4::ParserImpl.new
258
- when Parser::HTML, :html, :html5
259
- ps = Meteor::Ml::Html::ParserImpl.new
260
- when Parser::XHTML, :xhtml, :xhtml5
261
- ps = Meteor::Ml::Xhtml::ParserImpl.new
262
- when Parser::XML, :xml
263
- ps = Meteor::Ml::Xml::ParserImpl.new
257
+ when Parser::HTML, :html, :html5
258
+ ps = Meteor::Ml::Html::ParserImpl.new
259
+ when Parser::XML, :xml
260
+ ps = Meteor::Ml::Xml::ParserImpl.new
261
+ when Parser::XHTML, :xhtml, :xhtml5
262
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
263
+ when Parser::HTML4, :html4
264
+ ps = Meteor::Ml::Html4::ParserImpl.new
265
+ when Parser::XHTML4, :xhtml4
266
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
264
267
  end
265
268
 
266
269
  ps.read(File.expand_path(relative_path, @root), @enc)
267
270
  @cache[relative_url] = ps
268
-
269
271
  end
270
272
 
271
273
  private :link_2_n
@@ -276,26 +278,25 @@ module Meteor
276
278
  # @param [String] enc character encoding (文字エンコーディング)
277
279
  # @return [Meteor::Parser] parser (パーサ)
278
280
  #
279
- def link_2_s(relative_path,enc)
281
+ def link_2_s(relative_path, enc)
280
282
 
281
283
  relative_url = path_to_url(relative_path)
282
284
 
283
285
  case @type
284
- when Parser::HTML4, :html4
285
- ps = Meteor::Ml::Html4::ParserImpl.new
286
- when Parser::XHTML4, :xhtml4
287
- ps = Meteor::Ml::Xhtml4::ParserImpl.new
288
- when Parser::HTML, :html
289
- ps = Meteor::Ml::Html::ParserImpl.new
290
- when Parser::XHTML, :xhtml
291
- ps = Meteor::Ml::Xhtml::ParserImpl.new
292
- when Parser::XML, :xml
293
- ps = Meteor::Ml::Xml::ParserImpl.new
286
+ when Parser::HTML, :html
287
+ ps = Meteor::Ml::Html::ParserImpl.new
288
+ when Parser::XML, :xml
289
+ ps = Meteor::Ml::Xml::ParserImpl.new
290
+ when Parser::XHTML, :xhtml
291
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
292
+ when Parser::HTML4, :html4
293
+ ps = Meteor::Ml::Html4::ParserImpl.new
294
+ when Parser::XHTML4, :xhtml4
295
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
294
296
  end
295
297
 
296
298
  ps.read(File.expand_path(relative_path, @root), enc)
297
299
  @cache[relative_url] = ps
298
-
299
300
  end
300
301
 
301
302
  private :link_2_s
@@ -310,23 +311,22 @@ module Meteor
310
311
  relative_url = path_to_url(relative_path)
311
312
 
312
313
  case @type
313
- when Parser::HTML4, :html4
314
- ps = Meteor::Ml::Html4::ParserImpl.new
315
- when Parser::XHTML, :xhtml
316
- ps = Meteor::Ml::Xhtml4::ParserImpl.new
317
- when Parser::HTML, :html
318
- ps = Meteor::Ml::Html::ParserImpl.new
319
- when Parser::XHTML, :xhtml
320
- ps = Meteor::Ml::Xhtml::ParserImpl.new
321
- when Parser::XML, :xml
322
- ps = Meteor::Ml::Xml::ParserImpl.new
323
- else
324
- raise ArgumentError
314
+ when Parser::HTML, :html
315
+ ps = Meteor::Ml::Html::ParserImpl.new
316
+ when Parser::XML, :xml
317
+ ps = Meteor::Ml::Xml::ParserImpl.new
318
+ when Parser::XHTML, :xhtml
319
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
320
+ when Parser::HTML4, :html4
321
+ ps = Meteor::Ml::Html4::ParserImpl.new
322
+ when Parser::XHTML4, :xhtml4
323
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
324
+ else
325
+ raise ArgumentError
325
326
  end
326
327
 
327
328
  ps.read(File.expand_path(relative_path, @root), @enc)
328
329
  @cache[relative_url] = ps
329
-
330
330
  end
331
331
 
332
332
  private :link_1
@@ -351,10 +351,10 @@ module Meteor
351
351
  # @deprecated
352
352
  def parser(*args)
353
353
  case args.length
354
- when 1
355
- parser_1(args[0])
356
- when 2,3
357
- link(args)
354
+ when 1
355
+ parser_1(args[0])
356
+ when 2, 3
357
+ link(args)
358
358
  end
359
359
  # parser_1(key)
360
360
  end
@@ -367,16 +367,16 @@ module Meteor
367
367
  def parser_1(key)
368
368
  @pif = @cache[key.to_s]
369
369
  case @pif.doc_type
370
- when Meteor::Parser::HTML4
371
- Meteor::Ml::Html4::ParserImpl.new(@pif)
372
- when Meteor::Parser::XHTML4
373
- Meteor::Ml::Xhtml4::ParserImpl.new(@pif)
374
- when Meteor::Parser::HTML
375
- Meteor::Ml::Html::ParserImpl.new(@pif)
376
- when Meteor::Parser::XHTML
377
- Meteor::Ml::Xhtml::ParserImpl.new(@pif)
378
- when Meteor::Parser::XML
379
- Meteor::Ml::Xml::ParserImpl.new(@pif)
370
+ when Meteor::Parser::HTML
371
+ Meteor::Ml::Html::ParserImpl.new(@pif)
372
+ when Meteor::Parser::XML
373
+ Meteor::Ml::Xml::ParserImpl.new(@pif)
374
+ when Meteor::Parser::XHTML
375
+ Meteor::Ml::Xhtml::ParserImpl.new(@pif)
376
+ when Meteor::Parser::HTML4
377
+ Meteor::Ml::Html4::ParserImpl.new(@pif)
378
+ when Meteor::Parser::XHTML4
379
+ Meteor::Ml::Xhtml4::ParserImpl.new(@pif)
380
380
  end
381
381
  end
382
382
 
@@ -406,12 +406,12 @@ module Meteor
406
406
  #
407
407
  def link_str(*args)
408
408
  case args.length
409
- when 2
410
- link_str_2(args[0],args[1])
411
- when 3
412
- link_str_3(args[0],args[1],args[2])
413
- else
414
- raise ArgumentError
409
+ when 2
410
+ link_str_2(args[0], args[1])
411
+ when 3
412
+ link_str_3(args[0], args[1], args[2])
413
+ else
414
+ raise ArgumentError
415
415
  end
416
416
  end
417
417
 
@@ -424,16 +424,16 @@ module Meteor
424
424
  #
425
425
  def link_str_3(type, relative_url, doc)
426
426
  case type
427
- when Parser::HTML4, :html
428
- ps = Meteor::Ml::Html4::ParserImpl.new
429
- when Parser::XHTML4, :xhtml4
430
- ps = Meteor::Ml::Xhtml4::ParserImpl.new
431
- when Parser::HTML, :html
432
- ps = Meteor::Ml::Html::ParserImpl.new
433
- when Parser::XHTML, :xhtml
434
- ps = Meteor::Ml::Xhtml::ParserImpl.new
435
- when Parser::XML, :xml
436
- ps = Meteor::Ml::Xml::ParserImpl.new
427
+ when Parser::HTML, :html
428
+ ps = Meteor::Ml::Html::ParserImpl.new
429
+ when Parser::XML, :xml
430
+ ps = Meteor::Ml::Xml::ParserImpl.new
431
+ when Parser::XHTML, :xhtml
432
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
433
+ when Parser::HTML4, :html4
434
+ ps = Meteor::Ml::Html4::ParserImpl.new
435
+ when Parser::XHTML4, :xhtml4
436
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
437
437
  end
438
438
 
439
439
  ps.dcument = doc
@@ -451,16 +451,16 @@ module Meteor
451
451
  #
452
452
  def link_str_2(relative_url, doc)
453
453
  case @type
454
- when Parser::HTML4, :html4
455
- ps = Meteor::Ml::Html4::ParserImpl.new
456
- when Parser::XHTML, :xhtml
457
- ps = Meteor::Ml::Xhtml4::ParserImpl.new
458
- when Parser::HTML, :html
459
- ps = Meteor::Ml::Html::ParserImpl.new
460
- when Parser::XHTML, :xhtml
461
- ps = Meteor::Ml::Xhtml::ParserImpl.new
462
- when Parser::XML, :xml
463
- ps = Meteor::Ml::Xml::ParserImpl.new
454
+ when Parser::HTML, :html
455
+ ps = Meteor::Ml::Html::ParserImpl.new
456
+ when Parser::XML, :xml
457
+ ps = Meteor::Ml::Xml::ParserImpl.new
458
+ when Parser::XHTML, :xhtml
459
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
460
+ when Parser::HTML4, :html4
461
+ ps = Meteor::Ml::Html4::ParserImpl.new
462
+ when Parser::XHTML4, :xhtml4
463
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
464
464
  end
465
465
 
466
466
  ps.document = doc
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.13
39
+ # @version 0.9.14
40
40
  #
41
41
 
42
42
  module Meteor
43
- VERSION = '0.9.13'
43
+ VERSION = "0.9.14"
44
44
 
45
45
  # require 'fileutils'
46
46
 
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.13
4
+ version: 0.9.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 4.0.11
85
+ rubygems_version: 4.0.13
86
86
  specification_version: 4
87
87
  summary: A lightweight (X)HTML & XML parser
88
88
  test_files: