meteor 0.9.19 → 0.9.21

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: a5cd092814ce42dc2c43a909cdaba66fdade6e6c843478ac090aac5a2d4f487e
4
- data.tar.gz: f48b7cb7e1e159bd6f94d77a7140219a7f5e323812bd072a8368261fc3459200
3
+ metadata.gz: 26f1f916c420b56e221c808cbd966f43af6c89c4e49485162850bd263a48e8b0
4
+ data.tar.gz: 376bad56c8afbc0292267ecae987138ceb01fb95620ce1bb37c23a59a7104831
5
5
  SHA512:
6
- metadata.gz: '0689acb2f048912e05a831f94977c45239c5b35cfca707c2eaf8313956452fdc397d897e93ff7005e4944815145c13e77747c90af029d5d16985de43890c9944'
7
- data.tar.gz: 850cbdc875e5845b5cd1bd424b27759d2e2ee4fb3515c86019234940371ee147f2e40ff8a3982460f195b963e9ae0b1137e0ad595919c863461861c9a8bdc19d
6
+ metadata.gz: 99db703f1582e1caaa7dcc3777c59248c88f6b0d743162754938235ea08283df2b947ed0d5d42c2988caf4d1f7eca4123939dc221b48221528f80fc63529b57f
7
+ data.tar.gz: f74e0197d2246b8c70491d876f8c9b68c92fffa05baade469517e40678096163935ff2e0b53dd05bcaf4ff8c12a60b47202bd0b299eb7014640df0e3143d2bfc
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.21 / 2026-06-20 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactoring
4
+
5
+ == 0.9.20 / 2026-06-20 Yasumasa Ashida <ys.ashida@gmail.com>
6
+
7
+ * Refactoring
8
+
1
9
  == 0.9.19 / 2026-06-20 Yasumasa Ashida <ys.ashida@gmail.com>
2
10
 
3
11
  * Refactoring
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.19)
4
+ meteor (0.9.21)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -284,7 +284,7 @@ module Meteor
284
284
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>|<#{@_name}((?:|\\s[^<>]*))>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
285
285
 
286
286
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
287
- # search of element with content (内容あり要素検索)
287
+ # search of content-rich element (内容あり要素検索)
288
288
  @res = @pattern.match(@root.document)
289
289
 
290
290
  if @res
@@ -323,7 +323,7 @@ module Meteor
323
323
  # document (全体)
324
324
  @elm_.document = @res[0]
325
325
  end
326
- # search pattern of element with content (内容あり要素検索用パターン)
326
+ # content-rich element search pattern (内容あり要素検索用パターン)
327
327
  # @pattern_cc = String.new('') << "<" << @_name << '(?:|\\s[^<>]*)>((?!(' << @_name
328
328
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
329
329
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
@@ -441,15 +441,15 @@ module Meteor
441
441
  # puts @res.captures.length
442
442
  case @res.captures.length
443
443
  when FOUR
444
- # 要素
444
+ # element (要素)
445
445
  @elm_ = Meteor::Element.new(name)
446
- # 属性
446
+ # attribute (属性)
447
447
  @elm_.attributes = @res[1]
448
- # 内容
448
+ # content (内容)
449
449
  @elm_.mixed_content = @res[2]
450
- # 全体
450
+ # document (全体)
451
451
  @elm_.document = @res[0]
452
- # 内容あり要素検索用パターン
452
+ # content-rich element search pattern (内容あり要素検索用パターン)
453
453
  # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
454
454
  # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
455
455
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
@@ -469,7 +469,7 @@ module Meteor
469
469
  @elm_.mixed_content = @res[3]
470
470
  # document (全体)
471
471
  @elm_.document = @res[0]
472
- # search pattern of element with content (内容あり要素検索用パターン)
472
+ # content-rich element search pattern (内容あり要素検索用パターン)
473
473
  # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
474
474
  # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
475
475
  # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
@@ -497,7 +497,7 @@ module Meteor
497
497
  end
498
498
  # document (全体)
499
499
  @elm_.document = @res[0]
500
- # search pattern of element with content (内容あり要素検索用パターン)
500
+ # content-rich element search pattern (内容あり要素検索用パターン)
501
501
  @elm_.pattern = @pattern_cc
502
502
 
503
503
  @elm_.empty = true
@@ -544,7 +544,7 @@ module Meteor
544
544
  @pattern_cc_2_2 = String.new("") << ".*?)<\\/" << @_name << ">"
545
545
  # @pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
546
546
 
547
- # search of element with content (内容あり要素検索)
547
+ # search of content-rich element (内容あり要素検索)
548
548
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
549
549
 
550
550
  @sbuf = String.new("")
@@ -753,7 +753,7 @@ module Meteor
753
753
  # @pattern_cc_1 << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
754
754
  @pattern_cc_1 = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
755
755
 
756
- # search of element with content (内容あり要素検索)
756
+ # search of content-rich element (内容あり要素検索)
757
757
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
758
758
  @sbuf = String.new('')
759
759
 
@@ -942,7 +942,7 @@ module Meteor
942
942
  @elm_.mixed_content = @res[3]
943
943
  # document (全体)
944
944
  @elm_.document = @res[0]
945
- # search pattern of element with content (要素ありタグ検索用パターン)
945
+ # content-rich element search pattern (要素ありタグ検索用パターン)
946
946
  @elm_.pattern = @pattern_cc
947
947
 
948
948
  @elm_.empty = true
@@ -996,7 +996,7 @@ module Meteor
996
996
  # @pattern_cc_2_1 = ".*?<\\/#{@_name}>"
997
997
  # @pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
998
998
 
999
- # search of element with content (内容あり要素検索)
999
+ # search of content-rich element (内容あり要素検索)
1000
1000
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
1001
1001
 
1002
1002
  @sbuf = String.new("")
@@ -2069,7 +2069,6 @@ module Meteor
2069
2069
  else
2070
2070
  reflect
2071
2071
  @element_cache.clear
2072
- # フック判定が"false"の場合
2073
2072
  clean
2074
2073
  end
2075
2074
  end
@@ -2094,7 +2093,7 @@ module Meteor
2094
2093
  #
2095
2094
  def shadow(elm)
2096
2095
  if elm.empty
2097
- # case of element with content (内容あり要素の場合)
2096
+ # case of content-rich element (内容あり要素の場合)
2098
2097
  set_mono_info(elm)
2099
2098
 
2100
2099
  pif2 = create(self)
@@ -76,10 +76,10 @@ module Meteor
76
76
  # end
77
77
 
78
78
  ##
79
- ## パターンを取得する
80
- ## @param [String] regex 正規表現
81
- ## @param [Integer] option オプション
82
- ## @return [Regexp] パターン
79
+ ## get pattern (パターンを取得する)
80
+ ## @param [String] regex (正規表現)
81
+ ## @param [Integer] option (オプション)
82
+ ## @return [Regexp] psttern (パターン)
83
83
  ##
84
84
  # def self.get_2(regex, option)
85
85
  # ## pattern = @@regex_cache[regex]
@@ -33,7 +33,7 @@ module Meteor
33
33
  ]
34
34
 
35
35
  #[Array] boolean attributes (論理値で指定する属性)
36
- ATTR_LOGIC = ["disabled", "readonly", "checked", "selected", "multiple", "required"]
36
+ ATTR_BOOL = ["disabled", "readonly", "checked", "selected", "multiple", "required"]
37
37
 
38
38
  #[Array] elements with the disabled attribute (disabled属性のある要素)
39
39
  DISABLE_ELEMENT = ["input", "textarea", "select", "optgroup", "fieldset"]
@@ -58,7 +58,7 @@ module Meteor
58
58
  super()
59
59
  @@match_tag = MATCH_TAG
60
60
  @@MATCH_TAG_NNE = MATCH_TAG_NNE
61
- @@attr_logic = ATTR_LOGIC
61
+ @@attr_bool = ATTR_BOOL
62
62
  @doc_type = Parser::HTML
63
63
  case args.length
64
64
  when ZERO
@@ -21,10 +21,10 @@ module Meteor
21
21
  @@match_tag_2 = ["textarea", "option", "pre"]
22
22
 
23
23
  #[Array] non-nestable elements (入れ子にできない要素)
24
- @@match_tag_sng = ["texarea", "select", "option", "form", "fieldset"]
24
+ @@match_tag_nne = ["texarea", "select", "option", "form", "fieldset"]
25
25
 
26
26
  #[Array] boolean attributes (論理値で指定する属性)
27
- @@attr_logic = ["disabled", "readonly", "checked", "selected", "multiple"]
27
+ @@attr_bool = ["disabled", "readonly", "checked", "selected", "multiple"]
28
28
 
29
29
  # DISABLE_ELEMENT = "input|textarea|select|optgroup"
30
30
  #[Array] elements with the disabled attribute (disabled属性のある要素)
@@ -52,7 +52,6 @@ module Meteor
52
52
  # @@pattern_true = Regexp.new("true")
53
53
  # @@pattern_false = Regexp.new("false")
54
54
 
55
-
56
55
  GET_ATTRS_MAP2 = "\\s(disabled|readonly|checked|selected|multiple)"
57
56
 
58
57
  @@pattern_selected_m = Regexp.new(SELECTED_M)
@@ -234,15 +233,15 @@ module Meteor
234
233
  @elm_ = nil
235
234
  end
236
235
  else
237
- # search pattern of element with content (内容あり要素検索用パターン()
236
+ # content-rich element search pattern (内容あり要素検索用パターン()
238
237
  # @pattern_cc = String.new('') << "<" << @_name << '(|\\s[^<>]*)>(((?!(' << @_name
239
238
  # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
240
239
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{tag}[^<>]*>)).)*)<\\/#{@_name}>"
241
240
 
242
241
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
243
- # search of element with content (内容あり要素検索)
242
+ # search of content-rich element (内容あり要素検索)
244
243
  @res = @pattern.match(@root.document)
245
- # case of element with content (内容あり要素の場合)
244
+ # case of content-rich element (内容あり要素の場合)
246
245
  if @res
247
246
  element_with_1(name)
248
247
  else
@@ -308,17 +307,17 @@ module Meteor
308
307
  @elm_ = nil
309
308
  end
310
309
  else
311
- # search pattern of element with content (内容あり要素検索パターン)
310
+ # content-rich element search pattern (内容あり要素検索パターン)
312
311
  # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
313
312
  # @pattern_cc << @_attr_value << '"[^<>]*)>(((?!(' << @_name
314
313
  # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
315
314
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
316
315
 
317
316
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
318
- # search of element with content (内容あり要素検索)
317
+ # search of content-rich element (内容あり要素検索)
319
318
  @res = @pattern.match(@root.document)
320
319
 
321
- if !@res && !is_match(@@match_tag_sng, name)
320
+ if !@res && !is_match(@@match_tag_nne, name)
322
321
  @res = element_with_3_2
323
322
  end
324
323
 
@@ -387,7 +386,7 @@ module Meteor
387
386
  def element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
388
387
  quote_element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
389
388
 
390
- # 空要素の場合(<->内容あり要素の場合)
389
+ # case of void element (空要素の場合(<->内容あり要素の場合))
391
390
  if is_match(@@match_tag, name)
392
391
  # void element search pattern (空要素検索パターン)
393
392
  # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
@@ -415,7 +414,7 @@ module Meteor
415
414
  @elm_ = nil
416
415
  end
417
416
  else
418
- # search pattern of element with content (内容あり要素検索パターン)
417
+ # content-rich element search pattern (内容あり要素検索パターン)
419
418
  # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
420
419
  # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
421
420
  # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
@@ -425,10 +424,10 @@ module Meteor
425
424
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
426
425
 
427
426
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
428
- # search of element with content (内容あり要素検索)
427
+ # search of content-rich element (内容あり要素検索)
429
428
  @res = @pattern.match(@root.document)
430
429
 
431
- if !@res && !is_match(@@match_tag_sng, tag)
430
+ if !@res && !is_match(@@match_tag_nne, tag)
432
431
  @res = element_with_5_2
433
432
  end
434
433
 
@@ -633,7 +632,7 @@ module Meteor
633
632
  private :get_attr_map
634
633
 
635
634
  def remove_attrs_(elm, attr_name)
636
- if !is_match(@@attr_logic, attr_name)
635
+ if !is_match(@@attr_bool, attr_name)
637
636
  # attribute search pattern (属性検索用パターン)
638
637
  @pattern = Meteor::Core::Util::PatternCache.get(String.new("") << attr_name << "=\"[^\"]*\"\\s?")
639
638
  # @pattern = Meteor::Core::Util::PatternCache.get("#{attr_name}=\"[^\"]*\"\\s?")
@@ -693,15 +692,19 @@ module Meteor
693
692
 
694
693
  private :unescape
695
694
 
695
+ def br_to_newline(content)
696
+ if (elm.cx || !is_match(@@match_tag_2, elm.name)) && content.include?(BR)
697
+ # 「<br>」->「¥r?¥n」
698
+ content.gsub!(@@pattern_br_2, @root.kaigyo_code)
699
+ end
700
+ end
701
+
702
+ private :br_to_newline
703
+
696
704
  def unescape_content(content, elm)
697
705
  content_ = unescape(content)
698
706
 
699
- if elm.cx || !is_match(@@match_tag_2, elm.name)
700
- if content.include?(BR)
701
- # 「<br>」->「¥r?¥n」
702
- content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
703
- end
704
- end
707
+ br_to_newline(content_)
705
708
 
706
709
  content_
707
710
  end
@@ -9,7 +9,7 @@ module Meteor
9
9
  #
10
10
  class ParserImpl < Meteor::Ml::Xhtml4::ParserImpl
11
11
  #[Array] boolean attributes (論理値で指定する属性)
12
- ATTR_LOGIC = ["disabled", "readonly", "checked", "selected", "multiple", "required"]
12
+ ATTR_BOOL = ["disabled", "readonly", "checked", "selected", "multiple", "required"]
13
13
 
14
14
  #[Array] elements with the disabled attribute (disabled属性のある要素)
15
15
  DISABLE_ELEMENT = ["input", "textarea", "select", "optgroup", "fieldset"]
@@ -34,7 +34,7 @@ module Meteor
34
34
  #
35
35
  def initialize(*args)
36
36
  super()
37
- @@attr_logic = ATTR_LOGIC
37
+ @@attr_bool = ATTR_BOOL
38
38
  @doc_type = Parser::XHTML
39
39
  case args.length
40
40
  when ZERO
@@ -8,17 +8,16 @@ module Meteor
8
8
  # XHTML4 parser (XHTML4パーサ)
9
9
  #
10
10
  class ParserImpl < Meteor::Core::Kernel
11
-
12
11
  # KAIGYO_CODE = "\r?\n|\r"
13
12
  KAIGYO_CODE = ["\r\n", "\n", "\r"]
14
13
  BR = "<br/>"
15
14
 
16
15
  # @@match_tag_2 = "textarea|option|pre"
17
- #[Array] 改行を<br/>に変換する必要のない要素
16
+ #[Array] elements where line breaks do not need to be converted to <br> (改行を<br/>に変換する必要のない要素)
18
17
  @@match_tag_2 = ["textarea", "option", "pre"]
19
18
 
20
19
  #[Array] boolean attributes (論理値で指定する属性)
21
- @@attr_logic = ["disabled", "readonly", "checked", "selected", "multiple"]
20
+ @@attr_bool = ["disabled", "readonly", "checked", "selected", "multiple"]
22
21
 
23
22
  # DISABLE_ELEMENT = "input|textarea|select|optgroup"
24
23
  #[Array] element with disablled attribute (disabled属性のある要素)
@@ -326,7 +325,7 @@ module Meteor
326
325
  attrs = Meteor::AttributeMap.new
327
326
 
328
327
  elm.attributes.scan(@@pattern_get_attrs_map) do |a, b|
329
- if is_match(@@attr_logic, a) && a == b
328
+ if is_match(@@attr_bool, a) && a == b
330
329
  attrs.store(a, "true")
331
330
  else
332
331
  attrs.store(a, unescape(b))
@@ -386,13 +385,17 @@ module Meteor
386
385
 
387
386
  private :unescape
388
387
 
389
- def unescape_content(content, elm)
390
- content_ = unescape(content)
391
-
388
+ def br_to_newline(content)
392
389
  if (elm.cx || !is_match(@@match_tag_2, elm.name)) && content.include?(BR)
393
390
  # 「<br>」->「¥r?¥n」
394
- content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
391
+ content.gsub!(@@pattern_br_2, @root.kaigyo_code)
395
392
  end
393
+ end
394
+
395
+ def unescape_content(content, elm)
396
+ content_ = unescape(content)
397
+
398
+ br_to_newline(content_)
396
399
 
397
400
  content_
398
401
  end
@@ -65,7 +65,7 @@ module Meteor
65
65
  private :initialize_0
66
66
 
67
67
  #
68
- # イニシャライザ
68
+ # initializer (イニシャライザ)
69
69
  # @param [String] root root directory (基準ディレクトリ)
70
70
  #
71
71
  def initialize_1(root)
@@ -75,7 +75,7 @@ module Meteor
75
75
  private :initialize_1
76
76
 
77
77
  #
78
- # イニシャライザ
78
+ # initializer (イニシャライザ)
79
79
  # @param [String] root root directory (基準ディレクトリ)
80
80
  # @param [String] enc default character encoding (デフォルト文字エンコーディング)
81
81
  #
@@ -88,7 +88,7 @@ module Meteor
88
88
  private :initialize_2
89
89
 
90
90
  #
91
- # イニシャライザ
91
+ # initializer (イニシャライザ)
92
92
  # @param [Integer,Symbol] type default type of parser (デフォルトのパーサ・タイプ)
93
93
  # @param [String] root root directory (基準ディレクトリ)
94
94
  # @param [String] enc default character encoding (デフォルト文字エンコーディング)
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.19
39
+ # @version 0.9.21
40
40
  #
41
41
 
42
42
  module Meteor
43
- VERSION = "0.9.19"
43
+ VERSION = "0.9.21"
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.19
4
+ version: 0.9.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida