meteor 0.9.43 → 0.9.45
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 +9 -0
- data/Gemfile.lock +1 -1
- data/lib/meteor/core/kernel.rb +21 -28
- data/lib/meteor/element.rb +6 -2
- data/lib/meteor/ml/html4/parser_impl.rb +58 -48
- 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: 21bdbec821d662353316ee76eb7cc543b346e846038e559abf3f28767547ef76
|
|
4
|
+
data.tar.gz: 305b0b9321a7b42a09173e1c18bf31aa25117efa2873dcf03e37a19db416f7e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83741d83f88f90a88af4908ddc796f24906667385f48c7c301292aa40eb1206663a8257f0fe7e225e66863626824a7817e50f9e9cb125671133ce03f32b43739
|
|
7
|
+
data.tar.gz: cbb0bbc96389681332574749f0092e6b9243f8be73a2429f5d7aa251f175725047655bf8c3408e2a0fb02e28f39e4bd8f0c7958107f5f665082b3a7838c3c788
|
data/ChangeLog
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
== 0.9.45 / 2026-08-05 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
|
+
|
|
3
|
+
* Refactor Meteor::Ml::Html4::ParserImpl
|
|
4
|
+
* Fix Meteor::Element#document
|
|
5
|
+
|
|
6
|
+
== 0.9.44 / 2026-07-26 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
7
|
+
|
|
8
|
+
* Refactor Meteor::Core::Kernel
|
|
9
|
+
|
|
1
10
|
== 0.9.43 / 2026-07-22 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
11
|
|
|
3
12
|
* Refactor Meteor::Core::Kernel
|
data/Gemfile.lock
CHANGED
data/lib/meteor/core/kernel.rb
CHANGED
|
@@ -393,11 +393,8 @@ module Meteor
|
|
|
393
393
|
# @param [true,false] quote flag (クオート・フラグ)
|
|
394
394
|
# @return [Meteor::Element] element (要素)
|
|
395
395
|
def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
else
|
|
399
|
-
quote_name(name)
|
|
400
|
-
end
|
|
396
|
+
quote_name(name)
|
|
397
|
+
quote_attribute(attr_name, attr_value) if quote
|
|
401
398
|
|
|
402
399
|
@pattern_cc_one = element_pattern_three
|
|
403
400
|
|
|
@@ -455,15 +452,8 @@ module Meteor
|
|
|
455
452
|
|
|
456
453
|
private :element_pattern_three
|
|
457
454
|
|
|
458
|
-
def quote_element_three(name, attr_name, attr_value)
|
|
459
|
-
quote_name(name)
|
|
460
|
-
quote_attribute(attr_name, attr_value)
|
|
461
|
-
end
|
|
462
|
-
|
|
463
|
-
private :quote_element_three
|
|
464
|
-
|
|
465
455
|
def element_normal_three_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
466
|
-
# puts
|
|
456
|
+
# puts @res.captures.length
|
|
467
457
|
case @res.captures.length
|
|
468
458
|
when FOUR
|
|
469
459
|
# element (要素)
|
|
@@ -816,7 +806,8 @@ module Meteor
|
|
|
816
806
|
# @return [Meteor::Element] element (要素)
|
|
817
807
|
#
|
|
818
808
|
def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
819
|
-
|
|
809
|
+
quote_name(name)
|
|
810
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
820
811
|
|
|
821
812
|
@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
|
|
822
813
|
|
|
@@ -868,15 +859,26 @@ module Meteor
|
|
|
868
859
|
|
|
869
860
|
private :element_five
|
|
870
861
|
|
|
871
|
-
def
|
|
872
|
-
|
|
862
|
+
def quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
863
|
+
quote_attribute_one(attr_name1, attr_value1)
|
|
864
|
+
quote_attribute_two(attr_name2, attr_value2)
|
|
865
|
+
end
|
|
866
|
+
|
|
867
|
+
private :quote_attribute_one_two
|
|
868
|
+
|
|
869
|
+
def quote_attribute_one(attr_name1, attr_value1)
|
|
873
870
|
@_attr_name1 = Regexp.quote(attr_name1)
|
|
874
|
-
@_attr_name2 = Regexp.quote(attr_name2)
|
|
875
871
|
@_attr_value1 = Regexp.quote(attr_value1)
|
|
872
|
+
end
|
|
873
|
+
|
|
874
|
+
private :quote_attribute_one
|
|
875
|
+
|
|
876
|
+
def quote_attribute_two(attr_name2, attr_value2)
|
|
876
877
|
@_attr_value2 = Regexp.quote(attr_value2)
|
|
878
|
+
@_attr_name2 = Regexp.quote(attr_name2)
|
|
877
879
|
end
|
|
878
880
|
|
|
879
|
-
private :
|
|
881
|
+
private :quote_attribute_two
|
|
880
882
|
|
|
881
883
|
def element_normal_five_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
882
884
|
# @res.to_a.each_with_index do |capture, i|
|
|
@@ -1013,7 +1015,7 @@ module Meteor
|
|
|
1013
1015
|
# @return [Meteor::Element] element (要素)
|
|
1014
1016
|
#
|
|
1015
1017
|
def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
|
|
1016
|
-
|
|
1018
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
1017
1019
|
|
|
1018
1020
|
element_pattern_four
|
|
1019
1021
|
|
|
@@ -1038,15 +1040,6 @@ module Meteor
|
|
|
1038
1040
|
|
|
1039
1041
|
private :element_four
|
|
1040
1042
|
|
|
1041
|
-
def quote_element_four(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
1042
|
-
@_attr_name1 = Regexp.quote(attr_name1)
|
|
1043
|
-
@_attr_name2 = Regexp.quote(attr_name2)
|
|
1044
|
-
@_attr_value1 = Regexp.quote(attr_value1)
|
|
1045
|
-
@_attr_value2 = Regexp.quote(attr_value2)
|
|
1046
|
-
end
|
|
1047
|
-
|
|
1048
|
-
private :quote_element_four
|
|
1049
|
-
|
|
1050
1043
|
def element_pattern_four
|
|
1051
1044
|
@pattern_cc = "<([^<>\"]*)\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")" # rubocop:disable Layout/LineLength
|
|
1052
1045
|
end
|
data/lib/meteor/element.rb
CHANGED
|
@@ -216,10 +216,14 @@ module Meteor
|
|
|
216
216
|
# get document (ドキュメントを取得する)
|
|
217
217
|
# @return [String] document (ドキュメント)
|
|
218
218
|
#
|
|
219
|
-
def document # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
219
|
+
def document # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Metrics/AbcSize
|
|
220
220
|
if @document_sync
|
|
221
221
|
@document_sync = false
|
|
222
|
-
@_mixed_content =
|
|
222
|
+
@_mixed_content = if @mixed_content
|
|
223
|
+
childless ? Regexp.quote(@mixed_content) : @mixed_content
|
|
224
|
+
else
|
|
225
|
+
''
|
|
226
|
+
end
|
|
223
227
|
case @parser.doc_type
|
|
224
228
|
when Parser::HTML, Parser::HTML4
|
|
225
229
|
@document = if @cx
|
|
@@ -223,11 +223,8 @@ module Meteor
|
|
|
223
223
|
# @return [Meteor::Element] element (要素)
|
|
224
224
|
#
|
|
225
225
|
def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
else
|
|
229
|
-
quote_name(name)
|
|
230
|
-
end
|
|
226
|
+
quote_name(name)
|
|
227
|
+
quote_attribute(attr_name, attr_value) if quote
|
|
231
228
|
|
|
232
229
|
# case of void element (空要素の場合(<->内容あり要素の場合))
|
|
233
230
|
if match?(MATCH_TAG, name)
|
|
@@ -310,60 +307,46 @@ module Meteor
|
|
|
310
307
|
# @param [String] attr_value2 attribute value2 (属性値2)
|
|
311
308
|
# @return [Meteor::Element] element (要素)
|
|
312
309
|
#
|
|
313
|
-
def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
314
|
-
|
|
310
|
+
def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
311
|
+
quote_name(name)
|
|
312
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
315
313
|
|
|
316
314
|
# case of void element (空要素の場合(<->内容あり要素の場合))
|
|
317
315
|
if match?(MATCH_TAG, name)
|
|
318
|
-
|
|
319
|
-
@pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
|
|
320
|
-
|
|
321
|
-
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
|
322
|
-
# void element search (空要素検索)
|
|
323
|
-
@res = @pattern.match(@root.document)
|
|
324
|
-
|
|
325
|
-
if @res
|
|
326
|
-
element_void_five(name)
|
|
327
|
-
else
|
|
328
|
-
if @error_check
|
|
329
|
-
puts(
|
|
330
|
-
Meteor::Exception::NoSuchElementException
|
|
331
|
-
.new(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
332
|
-
.message
|
|
333
|
-
)
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
@elm_ = nil
|
|
337
|
-
end
|
|
316
|
+
element_five_void(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
338
317
|
else
|
|
339
|
-
|
|
340
|
-
|
|
318
|
+
element_five_normal(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
319
|
+
end
|
|
341
320
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
@res = @pattern.match(@root.document)
|
|
321
|
+
@elm_
|
|
322
|
+
end
|
|
345
323
|
|
|
346
|
-
|
|
324
|
+
private :element_five
|
|
347
325
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if @error_check
|
|
352
|
-
puts(
|
|
353
|
-
Meteor::Exception::NoSuchElementException
|
|
354
|
-
.new(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
355
|
-
.message
|
|
356
|
-
)
|
|
357
|
-
end
|
|
326
|
+
def element_five_void(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
|
|
327
|
+
# void element search pattern (空要素検索パターン)
|
|
328
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
|
|
358
329
|
|
|
359
|
-
|
|
330
|
+
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
|
331
|
+
# void element search (空要素検索)
|
|
332
|
+
@res = @pattern.match(@root.document)
|
|
333
|
+
|
|
334
|
+
if @res
|
|
335
|
+
element_void_five(name)
|
|
336
|
+
else
|
|
337
|
+
if @error_check
|
|
338
|
+
puts(
|
|
339
|
+
Meteor::Exception::NoSuchElementException
|
|
340
|
+
.new(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
341
|
+
.message
|
|
342
|
+
)
|
|
360
343
|
end
|
|
361
|
-
end
|
|
362
344
|
|
|
363
|
-
|
|
345
|
+
@elm_ = nil
|
|
346
|
+
end
|
|
364
347
|
end
|
|
365
348
|
|
|
366
|
-
private :
|
|
349
|
+
private :element_five_void
|
|
367
350
|
|
|
368
351
|
def element_void_five(name)
|
|
369
352
|
element_void_five_one(name, '")[^<>]*)>')
|
|
@@ -371,6 +354,33 @@ module Meteor
|
|
|
371
354
|
|
|
372
355
|
private :element_void_five
|
|
373
356
|
|
|
357
|
+
def element_five_normal(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
|
|
358
|
+
# normal element search pattern (内容あり要素検索パターン)
|
|
359
|
+
@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
|
|
360
|
+
|
|
361
|
+
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
|
362
|
+
# search of normal element (内容あり要素検索)
|
|
363
|
+
@res = @pattern.match(@root.document)
|
|
364
|
+
|
|
365
|
+
@res = element_normal_five_two if !@res && !match?(MATCH_TAG_NNE, name)
|
|
366
|
+
|
|
367
|
+
if @res
|
|
368
|
+
element_normal_five_one(name)
|
|
369
|
+
else
|
|
370
|
+
if @error_check
|
|
371
|
+
puts(
|
|
372
|
+
Meteor::Exception::NoSuchElementException
|
|
373
|
+
.new(name, attr_name1, attr_value1, attr_name2, attr_value2)
|
|
374
|
+
.message
|
|
375
|
+
)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
@elm_ = nil
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
private :element_five_normal
|
|
383
|
+
|
|
374
384
|
#
|
|
375
385
|
# get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で検索し、要素を取得する)
|
|
376
386
|
#
|
|
@@ -381,7 +391,7 @@ module Meteor
|
|
|
381
391
|
# @return [Meteor::Element] element (要素)
|
|
382
392
|
#
|
|
383
393
|
def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
|
|
384
|
-
|
|
394
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
385
395
|
|
|
386
396
|
@pattern_cc = "<([^<>\"]*)\\s([^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
|
|
387
397
|
|
data/lib/meteor.rb
CHANGED
|
@@ -37,11 +37,11 @@ require 'meteor/ml/xml/parser_impl'
|
|
|
37
37
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
38
38
|
#
|
|
39
39
|
# @author Yasumasa Ashida
|
|
40
|
-
# @version 0.9.
|
|
40
|
+
# @version 0.9.45
|
|
41
41
|
#
|
|
42
42
|
|
|
43
43
|
module Meteor
|
|
44
|
-
VERSION = '0.9.
|
|
44
|
+
VERSION = '0.9.45'
|
|
45
45
|
|
|
46
46
|
# require 'fileutils'
|
|
47
47
|
|