meteor 0.9.44 → 0.9.46

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebd554983ecc3081fd55707f6282c3a639609c5cd6e100b7e75d0e7c46b457bb
4
- data.tar.gz: 3c6734e06ac743d78871fc71efda67a3a1bbd9d6bac519563d02c45a4b90daee
3
+ metadata.gz: da1a40f7b01242df1d91e5a5c9fbe36a606393ebc787874ea9e87ebf4a50fc80
4
+ data.tar.gz: 38a522602a2634d109714bad2a27fbe60c1e9173f0c9730f27ab7dcc9eb7aa78
5
5
  SHA512:
6
- metadata.gz: da148763b7573f7700eac92e3873c45be1c3cc474e10aaf823c1725c178d54500553d7940d65d00ef62b183fd7b003ad5a101583ca2b847ec35466f754d110f1
7
- data.tar.gz: 1e1ab49831f262ea795e14d3e0a786cdfce3f63799888fda983fdb14d90e778bdd8d86d0c44b158c45e4fbea154d17938a605ff6b741190d41a3abd26f437f23
6
+ metadata.gz: 6be1372ef96ba157c1ef6e9803fcf4cefa916915034e3448945dcc353ce56c1e78f1c6535264e60baf515f0c1eb11550483881cbf15c5489acf31024e84d2495
7
+ data.tar.gz: f50a8ddde335d672a00c6313f189d6b9d7398f00a509ed249afcb8c8d3da40574fbd43fe0c670c565eb211107ba42c1114dba7d27e9e9f21df7a5f3a011a38f2
data/ChangeLog CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.9.46 / 2026-08-06 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactor Meteor::Ml::(Html4|Xhtml4)::ParserImpl
4
+
5
+ == 0.9.45 / 2026-08-05 Yasumasa Ashida <ys.ashida@gmail.com>
6
+
7
+ * Refactor Meteor::Ml::Html4::ParserImpl
8
+ * Fix Meteor::Element#document
9
+
1
10
  == 0.9.44 / 2026-07-26 Yasumasa Ashida <ys.ashida@gmail.com>
2
11
 
3
12
  * Refactor Meteor::Core::Kernel
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.44)
4
+ meteor (0.9.46)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -453,7 +453,7 @@ module Meteor
453
453
  private :element_pattern_three
454
454
 
455
455
  def element_normal_three_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
456
- # puts @res.captures.length
456
+ # puts @res.captures.length
457
457
  case @res.captures.length
458
458
  when FOUR
459
459
  # element (要素)
@@ -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 = @mixed_content ? Regexp.quote(@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
@@ -160,39 +160,14 @@ module Meteor
160
160
  # @param [String] name tag name (タグ名)
161
161
  # @return [Meteor::Element] element (要素)
162
162
  #
163
- def element_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
163
+ def element_one(name)
164
164
  quote_name(name)
165
165
 
166
166
  # case of void element (空要素の場合(<->内容あり要素の場合))
167
167
  if match?(MATCH_TAG, name)
168
- # void element search pattern (空要素検索用パターン)
169
- @pattern_cc = String.new('') << '<' << @_name << '(|\\s[^<>]*)>'
170
- # @pattern_cc = "<#{@_name}(|\\s[^<>]*)>"
171
- @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
172
- @res = @pattern.match(@root.document)
173
- if @res
174
- element_void_one(name)
175
- else
176
- puts(Meteor::Exception::NoSuchElementException.new(name).message) if @error_check
177
-
178
- @elm_ = nil
179
- end
168
+ element_one_void(name)
180
169
  else
181
- # normal element search pattern (内容あり要素検索用パターン()
182
- @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
183
-
184
- @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
185
- # search of normal element (内容あり要素検索)
186
- @res = @pattern.match(@root.document)
187
- # case of normal element (内容あり要素の場合)
188
- if @res
189
- @on_search = true
190
- element_normal_one(name)
191
- else
192
- puts(Meteor::Exception::NoSuchElementException.new(name).message) if @error_check
193
-
194
- @elm_ = nil
195
- end
170
+ element_one_normal(name)
196
171
  end
197
172
 
198
173
  @elm_
@@ -200,6 +175,41 @@ module Meteor
200
175
 
201
176
  private :element_one
202
177
 
178
+ def element_one_void(name)
179
+ # void element search pattern (空要素検索用パターン)
180
+ @pattern_cc = String.new('') << '<' << @_name << '(|\\s[^<>]*)>'
181
+ # @pattern_cc = "<#{@_name}(|\\s[^<>]*)>"
182
+ @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
183
+ @res = @pattern.match(@root.document)
184
+ if @res
185
+ element_void_one(name)
186
+ else
187
+ puts(Meteor::Exception::NoSuchElementException.new(name).message) if @error_check
188
+
189
+ @elm_ = nil
190
+ end
191
+ end
192
+
193
+ private :element_one_void
194
+
195
+ def element_one_normal(name)
196
+ # normal element search pattern (内容あり要素検索用パターン()
197
+ @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
198
+
199
+ @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
200
+ # search of normal element (内容あり要素検索)
201
+ @res = @pattern.match(@root.document)
202
+ # case of normal element (内容あり要素の場合)
203
+ if @res
204
+ @on_search = true
205
+ element_normal_one(name)
206
+ else
207
+ puts(Meteor::Exception::NoSuchElementException.new(name).message) if @error_check
208
+
209
+ @elm_ = nil
210
+ end
211
+ end
212
+
203
213
  def element_void_one(name)
204
214
  @elm_ = Meteor::Element.new(name)
205
215
  # attribute (属性)
@@ -222,48 +232,39 @@ module Meteor
222
232
  # @param [true,false] quote quote flag (クオート・フラグ)
223
233
  # @return [Meteor::Element] element (要素)
224
234
  #
225
- def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
235
+ def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Style/OptionalBooleanParameter
226
236
  quote_name(name)
227
237
  quote_attribute(attr_name, attr_value) if quote
228
238
 
229
239
  # case of void element (空要素の場合(<->内容あり要素の場合))
230
240
  if match?(MATCH_TAG, name)
231
- # void element search pattern (空要素検索パターン)
232
- @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>"
233
-
234
- @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
235
- # void element search (空要素検索)
236
- @res = @pattern.match(@root.document)
237
- if @res
238
- element_void_three(name)
239
- else
240
- puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message) if @error_check
241
-
242
- @elm_ = nil
243
- end
241
+ element_three_void(name, attr_name, attr_value)
244
242
  else
245
- # normal element search pattern (内容あり要素検索パターン)
246
- @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
243
+ element_three_normal(name, attr_name, attr_value)
244
+ end
247
245
 
248
- @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
249
- # search of normal element (内容あり要素検索)
250
- @res = @pattern.match(@root.document)
246
+ @elm_
247
+ end
251
248
 
252
- @res = element_normal_three_two if !@res && !match?(MATCH_TAG_NNE, name)
249
+ private :element_three
253
250
 
254
- if @res
255
- element_normal_three_one(name)
256
- else
257
- puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message) if @error_check
251
+ def element_three_void(name, attr_name, attr_value)
252
+ # void element search pattern (空要素検索パターン)
253
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>"
258
254
 
259
- @elm_ = nil
260
- end
261
- end
255
+ @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
256
+ # void element search (空要素検索)
257
+ @res = @pattern.match(@root.document)
258
+ if @res
259
+ element_void_three(name)
260
+ else
261
+ puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message) if @error_check
262
262
 
263
- @elm_
263
+ @elm_ = nil
264
+ end
264
265
  end
265
266
 
266
- private :element_three
267
+ private :element_three_void
267
268
 
268
269
  def element_void_three(name)
269
270
  element_void_three_one(name, '"[^<>]*)>')
@@ -271,6 +272,27 @@ module Meteor
271
272
 
272
273
  private :element_void_three
273
274
 
275
+ def element_three_normal(name, attr_name, attr_value)
276
+ # normal element search pattern (内容あり要素検索パターン)
277
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
278
+
279
+ @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
280
+ # search of normal element (内容あり要素検索)
281
+ @res = @pattern.match(@root.document)
282
+
283
+ @res = element_normal_three_two if !@res && !match?(MATCH_TAG_NNE, name)
284
+
285
+ if @res
286
+ element_normal_three_one(name)
287
+ else
288
+ puts(Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message) if @error_check
289
+
290
+ @elm_ = nil
291
+ end
292
+ end
293
+
294
+ private :element_three_normal
295
+
274
296
  #
275
297
  # get element using attribute(name="value") (属性(属性名="属性値")で検索し、要素を取得する)
276
298
  # @param [String] attr_name attribute name (属性名)
@@ -307,55 +329,15 @@ module Meteor
307
329
  # @param [String] attr_value2 attribute value2 (属性値2)
308
330
  # @return [Meteor::Element] element (要素)
309
331
  #
310
- def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
332
+ def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
311
333
  quote_name(name)
312
334
  quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
313
335
 
314
336
  # case of void element (空要素の場合(<->内容あり要素の場合))
315
337
  if match?(MATCH_TAG, name)
316
- # void element search pattern (空要素検索パターン)
317
- @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
318
-
319
- @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
320
- # void element search (空要素検索)
321
- @res = @pattern.match(@root.document)
322
-
323
- if @res
324
- element_void_five(name)
325
- else
326
- if @error_check
327
- puts(
328
- Meteor::Exception::NoSuchElementException
329
- .new(name, attr_name1, attr_value1, attr_name2, attr_value2)
330
- .message
331
- )
332
- end
333
-
334
- @elm_ = nil
335
- end
338
+ element_five_void(name, attr_name1, attr_value1, attr_name2, attr_value2)
336
339
  else
337
- # normal element search pattern (内容あり要素検索パターン)
338
- @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
339
-
340
- @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
341
- # search of normal element (内容あり要素検索)
342
- @res = @pattern.match(@root.document)
343
-
344
- @res = element_normal_five_two if !@res && !match?(MATCH_TAG_NNE, name)
345
-
346
- if @res
347
- element_normal_five_one(name)
348
- else
349
- if @error_check
350
- puts(
351
- Meteor::Exception::NoSuchElementException
352
- .new(name, attr_name1, attr_value1, attr_name2, attr_value2)
353
- .message
354
- )
355
- end
356
-
357
- @elm_ = nil
358
- end
340
+ element_five_normal(name, attr_name1, attr_value1, attr_name2, attr_value2)
359
341
  end
360
342
 
361
343
  @elm_
@@ -363,12 +345,64 @@ module Meteor
363
345
 
364
346
  private :element_five
365
347
 
348
+ def element_five_void(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
349
+ # void element search pattern (空要素検索パターン)
350
+ @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
351
+
352
+ @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
353
+ # void element search (空要素検索)
354
+ @res = @pattern.match(@root.document)
355
+
356
+ if @res
357
+ element_void_five(name)
358
+ else
359
+ if @error_check
360
+ puts(
361
+ Meteor::Exception::NoSuchElementException
362
+ .new(name, attr_name1, attr_value1, attr_name2, attr_value2)
363
+ .message
364
+ )
365
+ end
366
+
367
+ @elm_ = nil
368
+ end
369
+ end
370
+
371
+ private :element_five_void
372
+
366
373
  def element_void_five(name)
367
374
  element_void_five_one(name, '")[^<>]*)>')
368
375
  end
369
376
 
370
377
  private :element_void_five
371
378
 
379
+ def element_five_normal(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
380
+ # normal element search pattern (内容あり要素検索パターン)
381
+ @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
382
+
383
+ @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
384
+ # search of normal element (内容あり要素検索)
385
+ @res = @pattern.match(@root.document)
386
+
387
+ @res = element_normal_five_two if !@res && !match?(MATCH_TAG_NNE, name)
388
+
389
+ if @res
390
+ element_normal_five_one(name)
391
+ else
392
+ if @error_check
393
+ puts(
394
+ Meteor::Exception::NoSuchElementException
395
+ .new(name, attr_name1, attr_value1, attr_name2, attr_value2)
396
+ .message
397
+ )
398
+ end
399
+
400
+ @elm_ = nil
401
+ end
402
+ end
403
+
404
+ private :element_five_normal
405
+
372
406
  #
373
407
  # get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で検索し、要素を取得する)
374
408
  #
@@ -133,8 +133,6 @@ module Meteor
133
133
 
134
134
  element_three('meta', 'http-equiv', 'Content-Type')
135
135
 
136
- element_three('meta', 'http-equiv', 'Content-Type') unless @elm_
137
-
138
136
  @error_check = true
139
137
 
140
138
  if @elm_
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.44
40
+ # @version 0.9.46
41
41
  #
42
42
 
43
43
  module Meteor
44
- VERSION = '0.9.44'
44
+ VERSION = '0.9.46'
45
45
 
46
46
  # require 'fileutils'
47
47
 
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.44
4
+ version: 0.9.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida