meteor 0.9.21 → 0.9.22

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: 26f1f916c420b56e221c808cbd966f43af6c89c4e49485162850bd263a48e8b0
4
- data.tar.gz: 376bad56c8afbc0292267ecae987138ceb01fb95620ce1bb37c23a59a7104831
3
+ metadata.gz: ec1fa5d45083f5b41c12374b02afa97f609abfd602cadb73b5b02634ef7eb899
4
+ data.tar.gz: c23916a4fb90c750ae8a7cec4566bd8fa264b12eb02b31fdd28f638d7aedf21d
5
5
  SHA512:
6
- metadata.gz: 99db703f1582e1caaa7dcc3777c59248c88f6b0d743162754938235ea08283df2b947ed0d5d42c2988caf4d1f7eca4123939dc221b48221528f80fc63529b57f
7
- data.tar.gz: f74e0197d2246b8c70491d876f8c9b68c92fffa05baade469517e40678096163935ff2e0b53dd05bcaf4ff8c12a60b47202bd0b299eb7014640df0e3143d2bfc
6
+ metadata.gz: 2001c1c0e0308fbebd123f242e2f553e3231f22ba7f6b2e8ceed25ef438a1cd6d758d955f64e07edecfaa1ad85ddb8454a139eca0cc8bc5f1c608cab72fa0616
7
+ data.tar.gz: 5af3fa38323c059cd3308a6aa3e80d804081233486956aec32bd816d79b3e3a42ae541506eaf8ca0dc0f721765ae5d9c234b124b22695b673e263f5cecfbf1b7
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.22 / 2026-06-21 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactoring
4
+
1
5
  == 0.9.21 / 2026-06-20 Yasumasa Ashida <ys.ashida@gmail.com>
2
6
 
3
7
  * Refactoring
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.21)
4
+ meteor (0.9.22)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -52,6 +52,39 @@ module Meteor
52
52
  @@pattern_clean1 = Regexp.new("<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->")
53
53
  @@pattern_clean2 = Regexp.new("<!--\\s\\/@[^<>]*(\\s)*-->")
54
54
 
55
+ BR = "<br>"
56
+ BR_RE = BR
57
+
58
+ TABLE_FOR_ESCAPE_ = {
59
+ "&" => "&amp;",
60
+ "\"" => "&quot;",
61
+ "'" => "&apos;",
62
+ "<" => "&lt;",
63
+ ">" => "&gt;",
64
+ " " => "&nbsp;"
65
+ }
66
+
67
+ TABLE_FOR_ESCAPE_CONTENT_ = {
68
+ "&" => "&amp;",
69
+ "\"" => "&quot;",
70
+ "'" => "&apos;",
71
+ "<" => "&lt;",
72
+ ">" => "&gt;",
73
+ " " => "&nbsp;",
74
+ "\r\n" => BR,
75
+ "\r" => BR,
76
+ "\n" => BR
77
+ }
78
+
79
+ PATTERN_ESCAPE = "[&\"'<> ]"
80
+ PATTERN_ESCAPE_CONTENT = "[&\"'<> \\n]"
81
+ @@pattern_escape = Regexp.new(PATTERN_ESCAPE)
82
+ @@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
83
+
84
+ PATTERN_UNESCAPE = "&(amp|quot|apos|gt|lt|nbsp);"
85
+ @@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
86
+ @@pattern_br_2 = Regexp.new(BR_RE)
87
+
55
88
  attr_accessor :element_cache
56
89
  attr_accessor :doc_type
57
90
  attr_accessor :document_hook
@@ -2194,6 +2227,71 @@ module Meteor
2194
2227
  end
2195
2228
 
2196
2229
  private :create
2230
+
2231
+ def escape(content)
2232
+ # replace special character (特殊文字の置換)
2233
+ content = content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
2234
+
2235
+ content
2236
+ end
2237
+
2238
+ def escape_content(content, elm)
2239
+ # replace special character (特殊文字の置換)
2240
+ content = content.gsub(@@pattern_escape_content, TABLE_FOR_ESCAPE_CONTENT_)
2241
+
2242
+ content
2243
+ end
2244
+
2245
+ private :escape
2246
+ private :escape_content
2247
+
2248
+ def unescape(content)
2249
+ # replace special character (特殊文字の置換)
2250
+ # 「<」<-「&lt;」
2251
+ # 「>」<-「&gt;」
2252
+ # 「"」<-「&quotl」
2253
+ # 「 」<-「&nbsp;」
2254
+ # 「&」<-「&amp;」
2255
+ content.gsub(@@pattern_unescape) do
2256
+ case $1
2257
+ when "amp"
2258
+ "&"
2259
+ when "quot"
2260
+ "\""
2261
+ when "apos"
2262
+ "'"
2263
+ when "gt"
2264
+ ">"
2265
+ when "lt"
2266
+ "<"
2267
+ when "nbsp"
2268
+ " "
2269
+ end
2270
+ end
2271
+
2272
+ content
2273
+ end
2274
+
2275
+ private :unescape
2276
+
2277
+ def br_to_newline(content)
2278
+ if (elm.cx || !is_match(@@match_tag_2, elm.name)) && content.include?(BR)
2279
+ # 「<br>」->「¥r?¥n」
2280
+ content.gsub!(@@pattern_br_2, @root.kaigyo_code)
2281
+ end
2282
+ end
2283
+
2284
+ private :br_to_newline
2285
+
2286
+ def unescape_content(content, elm)
2287
+ content_ = unescape(content)
2288
+
2289
+ br_to_newline(content_)
2290
+
2291
+ content_
2292
+ end
2293
+
2294
+ private :unescape_content
2197
2295
  end
2198
2296
  end
2199
2297
  end
@@ -24,13 +24,13 @@ module Meteor
24
24
 
25
25
  #
26
26
  #@overload add(type,relative_path,enc)
27
- # generate parser (パーサを作成する)
27
+ # add parser (パーサを追加する)
28
28
  # @param [Integer] type type of parser (パーサ・タイプ)
29
29
  # @param [String] relative_path relative file path (相対ファイルパス)
30
30
  # @param [String] enc character encoding (エンコーディング)
31
31
  # @return [Meteor::Parser] parser (パーサ)
32
32
  #@overload add(type,relative_path)
33
- # generate parser (パーサを作成する)
33
+ # add parser (パーサを追加する)
34
34
  # @param [Integer] type type of parser (パーサ・タイプ)
35
35
  # @param [String] relative_path relative file path (相対ファイルパス)
36
36
  # @return [Meteor::Parser] parser (パーサ)
@@ -41,13 +41,13 @@ module Meteor
41
41
 
42
42
  #
43
43
  # @overload add_str(type, relative_url, doc)
44
- # generate parser (パーサを作成する)
44
+ # add parser (パーサを追加する)
45
45
  # @param [Integer] type type of parser (パーサ・タイプ)
46
46
  # @param [String] relative_url relative URL (相対URL)
47
47
  # @param [String] doc document (ドキュメント)
48
48
  # @return [Meteor::Parser] parser (パーサ)
49
49
  # @overload add_str(relative_url, doc)
50
- # generate parser (パーサを作成する)
50
+ # add parser (パーサを追加する)
51
51
  # @param [String] relative_url relative URL (相対URL)
52
52
  # @param [String] doc document (ドキュメント)
53
53
  # @return [Meteor::Parser] parser (パーサ)
@@ -12,6 +12,7 @@ module Meteor
12
12
  # KAIGYO_CODE = "\r\n|\n|\r"
13
13
  KAIGYO_CODE = ["\r\n", "\n", "\r"]
14
14
  BR = "<br>"
15
+ BR_RE = BR
15
16
 
16
17
  # @@match_tag = "br|hr|img|input|meta|base"
17
18
  #[Array] void elemets (空要素)
@@ -70,36 +71,6 @@ module Meteor
70
71
  # @@pattern_match_tag = Regexp.new(@@match_tag)
71
72
  # @@pattern_match_tag2 = Regexp.new(@@match_tag_2)
72
73
 
73
- TABLE_FOR_ESCAPE_ = {
74
- "&" => "&amp;",
75
- "\"" => "&quot;",
76
- "'" => "&apos;",
77
- "<" => "&lt;",
78
- ">" => "&gt;",
79
- " " => "&nbsp;"
80
- }
81
-
82
- TABLE_FOR_ESCAPE_CONTENT_ = {
83
- "&" => "&amp;",
84
- "\"" => "&quot;",
85
- "'" => "&apos;",
86
- "<" => "&lt;",
87
- ">" => "&gt;",
88
- " " => "&nbsp;",
89
- "\r\n" => "<br>",
90
- "\r" => "<br>",
91
- "\n" => "<br>"
92
- }
93
-
94
- PATTERN_ESCAPE = "[&\"'<> ]"
95
- PATTERN_ESCAPE_CONTENT = "[&\"'<> \\n]"
96
- @@pattern_escape = Regexp.new(PATTERN_ESCAPE)
97
- @@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
98
-
99
- PATTERN_UNESCAPE = "&(amp|quot|apos|gt|lt|nbsp);"
100
- @@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
101
- @@pattern_br_2 = Regexp.new(BR)
102
-
103
74
  #
104
75
  # initializer (イニシャライザ)
105
76
  # @overload initialize
@@ -645,71 +616,6 @@ module Meteor
645
616
  end
646
617
 
647
618
  private :remove_attrs_
648
-
649
- def escape(content)
650
- # replace special character (特殊文字の置換)
651
- content = content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
652
-
653
- content
654
- end
655
-
656
- def escape_content(content, elm)
657
- # replace special character (特殊文字の置換)
658
- content = content.gsub(@@pattern_escape_content, TABLE_FOR_ESCAPE_CONTENT_)
659
-
660
- content
661
- end
662
-
663
- private :escape
664
- private :escape_content
665
-
666
- def unescape(content)
667
- # replace special character (特殊文字の置換)
668
- # 「<」<-「&lt;」
669
- # 「>」<-「&gt;」
670
- # 「"」<-「&quotl」
671
- # 「 」<-「&nbsp;」
672
- # 「&」<-「&amp;」
673
- content.gsub(@@pattern_unescape) do
674
- case $1
675
- when "amp"
676
- "&"
677
- when "quot"
678
- "\""
679
- when "apos"
680
- "'"
681
- when "gt"
682
- ">"
683
- when "lt"
684
- "<"
685
- when "nbsp"
686
- " "
687
- end
688
- end
689
-
690
- content
691
- end
692
-
693
- private :unescape
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
-
704
- def unescape_content(content, elm)
705
- content_ = unescape(content)
706
-
707
- br_to_newline(content_)
708
-
709
- content_
710
- end
711
-
712
- private :unescape_content
713
619
  end
714
620
  end
715
621
  end
@@ -11,6 +11,7 @@ module Meteor
11
11
  # KAIGYO_CODE = "\r?\n|\r"
12
12
  KAIGYO_CODE = ["\r\n", "\n", "\r"]
13
13
  BR = "<br/>"
14
+ BR_RE = "<br\\/>"
14
15
 
15
16
  # @@match_tag_2 = "textarea|option|pre"
16
17
  #[Array] elements where line breaks do not need to be converted to <br> (改行を<br/>に変換する必要のない要素)
@@ -66,36 +67,6 @@ module Meteor
66
67
  # @@pattern_match_tag = Regexp.new(@@match_tag)
67
68
  # @@pattern_match_tag2 = Regexp.new(@@match_tag_2)
68
69
 
69
- TABLE_FOR_ESCAPE_ = {
70
- "&" => "&amp;",
71
- "\"" => "&quot;",
72
- "'" => "&apos;",
73
- "<" => "&lt;",
74
- ">" => "&gt;",
75
- " " => "&nbsp;"
76
- }
77
-
78
- TABLE_FOR_ESCAPE_CONTENT_ = {
79
- "&" => "&amp;",
80
- "\"" => "&quot;",
81
- "'" => "&apos;",
82
- "<" => "&lt;",
83
- ">" => "&gt;",
84
- " " => "&nbsp;",
85
- "\r\n" => "<br/>",
86
- "\r" => "<br/>",
87
- "\n" => "<br/>"
88
- }
89
-
90
- PATTERN_ESCAPE = "[&\"'<> ]"
91
- PATTERN_ESCAPE_CONTENT = "[&\"'<> \\n]"
92
- @@pattern_escape = Regexp.new(PATTERN_ESCAPE)
93
- @@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
94
-
95
- PATTERN_UNESCAPE = "&(amp|quot|apos|gt|lt|nbsp);"
96
- @@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
97
- @@pattern_br_2 = Regexp.new("<br\\/>")
98
-
99
70
  #
100
71
  # initializer (イニシャライザ)
101
72
  # @overload initialize
@@ -228,7 +199,7 @@ module Meteor
228
199
  @res = match_p.match(elm.attributes)
229
200
 
230
201
  if !@res
231
- # add and attribute to attributes (属性文字列の最後に新規の属性を追加する)
202
+ # add an attribute to attributes (属性文字列の最後に新規の属性を追加する)
232
203
  if elm.attributes != ""
233
204
  elm.attributes = String.new("") << " " << elm.attributes.strip
234
205
  # else
@@ -236,12 +207,12 @@ module Meteor
236
207
 
237
208
  elm.attributes << " " << replace_update
238
209
  else
239
- # reolace attribute (属性の置換)
210
+ # replace attribute (属性の置換)
240
211
  elm.attributes.gsub!(replace_regex, replace_update)
241
212
  end
242
213
  elsif false.equal?(attr_value) || is_match("false", attr_value)
243
214
  # delete if attribute_name attrubute exeists (attr_name属性が存在するなら削除)
244
- # reolace attribute (属性の置換)
215
+ # replace attribute (属性の置換)
245
216
  elm.attributes.gsub!(replace_regex, "")
246
217
  end
247
218
  end
@@ -338,69 +309,6 @@ module Meteor
338
309
  end
339
310
 
340
311
  private :get_attr_map
341
-
342
- def escape(content)
343
- # replace special character (特殊文字の置換)
344
- content = content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
345
-
346
- content
347
- end
348
-
349
- def escape_content(content, elm)
350
- # replace special character (特殊文字の置換)
351
- content = content.gsub(@@pattern_escape_content, TABLE_FOR_ESCAPE_CONTENT_)
352
-
353
- content
354
- end
355
-
356
- private :escape
357
- private :escape_content
358
-
359
- def unescape(content)
360
- # replace special character (特殊文字の置換)
361
- # 「<」<-「&lt;」
362
- # 「>」<-「&gt;」
363
- # 「"」<-「&quotl」
364
- # 「 」<-「&nbsp;」
365
- # 「&」<-「&amp;」
366
- content.gsub(@@pattern_unescape) do
367
- case $1
368
- when "amp"
369
- "&"
370
- when "quot"
371
- "\""
372
- when "apos"
373
- "'"
374
- when "gt"
375
- ">"
376
- when "lt"
377
- "<"
378
- when "nbsp"
379
- " "
380
- end
381
- end
382
-
383
- content
384
- end
385
-
386
- private :unescape
387
-
388
- def br_to_newline(content)
389
- if (elm.cx || !is_match(@@match_tag_2, elm.name)) && content.include?(BR)
390
- # 「<br>」->「¥r?¥n」
391
- content.gsub!(@@pattern_br_2, @root.kaigyo_code)
392
- end
393
- end
394
-
395
- def unescape_content(content, elm)
396
- content_ = unescape(content)
397
-
398
- br_to_newline(content_)
399
-
400
- content_
401
- end
402
-
403
- private :unescape_content
404
312
  end
405
313
  end
406
314
  end
@@ -138,22 +138,22 @@ module Meteor
138
138
 
139
139
  #
140
140
  #@overload add(relative_path,enc)
141
- # generate parser (パーサを作成する)
141
+ # add parser (パーサを追加する)
142
142
  # @param [String] relative_path relative file path (相対ファイルパス)
143
143
  # @param [String] enc character encoding (文字エンコーディング)
144
144
  # @return [Meteor::Parser] parser (パーサ)
145
145
  #@overload add(relative_path)
146
- # generate parser (パーサを作成する)
146
+ # add parser (パーサを追加する)
147
147
  # @param [String] relative_path relative file path (相対ファイルパス)
148
148
  # @return [Meteor::Parser] parser (パーサ)
149
149
  #@overload add(type,relative_path,enc)
150
- # generate parser (パーサを作成する)
150
+ # add parser (パーサを追加する)
151
151
  # @param [Integer,Symbol] type type of parser (パーサ・タイプ)
152
152
  # @param [String] relative_path relative file path (相対ファイルパス)
153
153
  # @param [String] enc character encoding (文字エンコーディング)
154
154
  # @return [Meteor::Parser] parser (パーサ)
155
155
  #@overload add(type,relative_path)
156
- # generate parser (パーサを作成する)
156
+ # add parser (パーサを追加する)
157
157
  # @param [Integer,Symbol] type type of parser (パーサ・タイプ)
158
158
  # @param [String] relative_path relative file path (相対ファイルパス)
159
159
  # @return [Meteor::Parser] parser (パーサ)
@@ -204,7 +204,7 @@ module Meteor
204
204
  private :path_to_url
205
205
 
206
206
  #
207
- # generate parser (パーサを作成する)
207
+ # add parser (パーサを追加する)
208
208
  # @param [Integer,Symbol] type type of parser (パーサ・タイプ)
209
209
  # @param [String] relative_path relative file path (相対ファイルパス)
210
210
  # @param [String] enc character encoding (文字エンコーディング)
@@ -221,7 +221,7 @@ module Meteor
221
221
  private :add_3
222
222
 
223
223
  #
224
- # generate parser (パーサを作成する)
224
+ # add parser (パーサを追加する)
225
225
  # @param [Integer,Symbol] type type of parser(パーサ・タイプ)
226
226
  # @param [String] relative_path relative file path (相対ファイルパス)
227
227
  # @return [Meteor::Parser] parser (パーサ)
@@ -233,7 +233,7 @@ module Meteor
233
233
  private :add_2_n
234
234
 
235
235
  #
236
- # generate parser (パーサを作成する)
236
+ # add parser (パーサを追加する)
237
237
  # @param [String] relative_path relative file path (相対ファイルパス)
238
238
  # @param [String] enc character encoding (文字エンコーディング)
239
239
  # @return [Meteor::Parser] parser (パーサ)
@@ -245,7 +245,7 @@ module Meteor
245
245
  private :add_2_s
246
246
 
247
247
  #
248
- # generate parser (パーサを作成する)
248
+ # add parser (パーサを追加する)
249
249
  # @param [String] relative_path relative file path (相対ファイルパス)
250
250
  # @return [Meteor::Parser] parser (パーサ)
251
251
  #
@@ -261,14 +261,14 @@ module Meteor
261
261
  # @param [String,Symbol] key identifier (キー)
262
262
  # @return [Meteor::Parser] parser (パーサ)
263
263
  #@overload parser(type,relative_path,enc)
264
- # generate parser (パーサを作成する)
264
+ # add parser (パーサを追加する)
265
265
  # @param [Integer] type type of parser (パーサ・タイプ)
266
266
  # @param [String] relative_path relative file path (相対ファイルパス)
267
267
  # @param [String] enc character encoding (エンコーディング)
268
268
  # @return [Meteor::Parser] parser (パーサ)
269
269
  # @deprecated
270
270
  #@overload parser(type,relative_path)
271
- # generate parser (パーサを作成する)
271
+ # add parser (パーサを追加する)
272
272
  # @param [Integer] type type of parser (パーサ・タイプ)
273
273
  # @param [String] relative_path relative file path (相対ファイルパス)
274
274
  # @return [Meteor::Parser] parser (パーサ)
@@ -317,13 +317,13 @@ module Meteor
317
317
 
318
318
  #
319
319
  # @overload add_str(type, relative_url, doc)
320
- # generate parser (パーサを作成する)
320
+ # add parser (パーサを追加する)
321
321
  # @param [Integer] type type of parser (パーサ・タイプ)
322
322
  # @param [String] relative_url relative URL (相対URL)
323
323
  # @param [String] doc document (ドキュメント)
324
324
  # @return [Meteor::Parser] parser (パーサ)
325
325
  # @overload add_str(relative_url, doc)
326
- # generate parser (パーサを作成する)
326
+ # add parser (パーサを追加する)
327
327
  # @param [String] relative_url relative URL (相対URL)
328
328
  # @param [String] doc document (ドキュメント)
329
329
  # @return [Meteor::Parser] parser (パーサ)
@@ -340,7 +340,7 @@ module Meteor
340
340
  end
341
341
 
342
342
  #
343
- # generate parser (パーサを作成する)
343
+ # add parser (パーサを追加する)
344
344
  # @param [Integer,Symbol] type type of parser (パーサ・タイプ)
345
345
  # @param [String] relative_url relative URL (相対URL)
346
346
  # @param [String] doc document (ドキュメント)
@@ -357,7 +357,7 @@ module Meteor
357
357
  private :add_str_3
358
358
 
359
359
  #
360
- # generate parser (パーサを作成する)
360
+ # add parser (パーサを追加する)
361
361
  # @param [String] relative_url relative URL (相対URL)
362
362
  # @param [String] doc document (ドキュメント)
363
363
  # @return [Meteor::Parser] parser (パーサ)
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.21
39
+ # @version 0.9.22
40
40
  #
41
41
 
42
42
  module Meteor
43
- VERSION = "0.9.21"
43
+ VERSION = "0.9.22"
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.21
4
+ version: 0.9.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida