meteor 0.9.42 → 0.9.44
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 +10 -0
- data/Gemfile.lock +1 -1
- data/demo/xml.rb +2 -2
- data/lib/meteor/core/kernel.rb +54 -33
- data/lib/meteor/element.rb +5 -4
- data/lib/meteor/ml/html4/parser_impl.rb +7 -33
- data/lib/meteor/ml/xhtml4/parser_impl.rb +1 -23
- data/lib/meteor/ml/xml/parser_impl.rb +1 -25
- 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: ebd554983ecc3081fd55707f6282c3a639609c5cd6e100b7e75d0e7c46b457bb
|
|
4
|
+
data.tar.gz: 3c6734e06ac743d78871fc71efda67a3a1bbd9d6bac519563d02c45a4b90daee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da148763b7573f7700eac92e3873c45be1c3cc474e10aaf823c1725c178d54500553d7940d65d00ef62b183fd7b003ad5a101583ca2b847ec35466f754d110f1
|
|
7
|
+
data.tar.gz: 1e1ab49831f262ea795e14d3e0a786cdfce3f63799888fda983fdb14d90e778bdd8d86d0c44b158c45e4fbea154d17938a605ff6b741190d41a3abd26f437f23
|
data/ChangeLog
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
== 0.9.44 / 2026-07-26 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
|
+
|
|
3
|
+
* Refactor Meteor::Core::Kernel
|
|
4
|
+
|
|
5
|
+
== 0.9.43 / 2026-07-22 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
6
|
+
|
|
7
|
+
* Refactor Meteor::Core::Kernel
|
|
8
|
+
* Fix Meteor::Element#document
|
|
9
|
+
* Refactor Meteor::Element#element
|
|
10
|
+
|
|
1
11
|
== 0.9.42 / 2026-07-21 Yasumasa Ashida <ys.ashida@gmail.com>
|
|
2
12
|
|
|
3
13
|
* Refactor Meteor::Element
|
data/Gemfile.lock
CHANGED
data/demo/xml.rb
CHANGED
|
@@ -32,7 +32,7 @@ elm7 = root.element('kobe')
|
|
|
32
32
|
# elm8 = root.element(manbo: "mango")
|
|
33
33
|
# elm8 = root.element(momo: "momo")
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
elm9 = root.element('hamachi', id: 'aa', id2: 'bb')
|
|
36
36
|
# elm_c1 = root.cxtag("cs")
|
|
37
37
|
|
|
38
38
|
# puts elm8.name
|
|
@@ -43,7 +43,7 @@ elm7 = root.element('kobe')
|
|
|
43
43
|
# elm1["id2"] = "cc"
|
|
44
44
|
|
|
45
45
|
# elm8['mango'] = "mangoo" # elm8.attr(manbo: "mangoo")
|
|
46
|
-
|
|
46
|
+
elm9.content = '\\1' # elm9.content("\\1")
|
|
47
47
|
|
|
48
48
|
# elm2.attr(id3: 'cc')
|
|
49
49
|
|
data/lib/meteor/core/kernel.rb
CHANGED
|
@@ -50,6 +50,9 @@ module Meteor
|
|
|
50
50
|
RE_CLEAN_ONE = Regexp.new('<!--\\s@[^<>]*\\s[^<>]*(\\s)*-->')
|
|
51
51
|
RE_CLEAN_TWO = Regexp.new('<!--\\s\\/@[^<>]*(\\s)*-->')
|
|
52
52
|
|
|
53
|
+
# NEWLINE = "\r?\n|\r"
|
|
54
|
+
NEWLINE = ["\r\n", "\n", "\r"].freeze
|
|
55
|
+
|
|
53
56
|
BR = '<br>'
|
|
54
57
|
BR_RE = BR
|
|
55
58
|
|
|
@@ -170,10 +173,32 @@ module Meteor
|
|
|
170
173
|
# parse document (ドキュメントを解析する)
|
|
171
174
|
# @param [String] document document (ドキュメント)
|
|
172
175
|
#
|
|
173
|
-
def parse
|
|
176
|
+
def parse
|
|
177
|
+
analyze_ml
|
|
178
|
+
end
|
|
174
179
|
|
|
175
180
|
protected :parse
|
|
176
181
|
|
|
182
|
+
#
|
|
183
|
+
# analyze document (ドキュメントをパースする)
|
|
184
|
+
#
|
|
185
|
+
def analyze_ml
|
|
186
|
+
analyze_newline
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
protected :analyze_ml
|
|
190
|
+
|
|
191
|
+
#
|
|
192
|
+
# analyze document , set newline (ドキュメントをパースし、改行コードをセットする)
|
|
193
|
+
#
|
|
194
|
+
def analyze_newline
|
|
195
|
+
NEWLINE.each do |a|
|
|
196
|
+
@root.newline = a if @root.document.include?(a)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
private :analyze_newline
|
|
201
|
+
|
|
177
202
|
#
|
|
178
203
|
# get element (要素を取得する)
|
|
179
204
|
# @overload element(name)
|
|
@@ -368,11 +393,8 @@ module Meteor
|
|
|
368
393
|
# @param [true,false] quote flag (クオート・フラグ)
|
|
369
394
|
# @return [Meteor::Element] element (要素)
|
|
370
395
|
def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
else
|
|
374
|
-
quote_name(name)
|
|
375
|
-
end
|
|
396
|
+
quote_name(name)
|
|
397
|
+
quote_attribute(attr_name, attr_value) if quote
|
|
376
398
|
|
|
377
399
|
@pattern_cc_one = element_pattern_three
|
|
378
400
|
|
|
@@ -430,13 +452,6 @@ module Meteor
|
|
|
430
452
|
|
|
431
453
|
private :element_pattern_three
|
|
432
454
|
|
|
433
|
-
def quote_element_three(name, attr_name, attr_value)
|
|
434
|
-
quote_name(name)
|
|
435
|
-
quote_attribute(attr_name, attr_value)
|
|
436
|
-
end
|
|
437
|
-
|
|
438
|
-
private :quote_element_three
|
|
439
|
-
|
|
440
455
|
def element_normal_three_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
441
456
|
# puts @res.captures.length
|
|
442
457
|
case @res.captures.length
|
|
@@ -669,7 +684,7 @@ module Meteor
|
|
|
669
684
|
# case @res.captures.length
|
|
670
685
|
# when FOUR
|
|
671
686
|
# @_name = @res[1]
|
|
672
|
-
# #
|
|
687
|
+
# # element (要素)
|
|
673
688
|
# @elm_ = Element.new(@_name)
|
|
674
689
|
# # attribute (属性)
|
|
675
690
|
# @elm_.attributes = @res[2]
|
|
@@ -791,7 +806,8 @@ module Meteor
|
|
|
791
806
|
# @return [Meteor::Element] element (要素)
|
|
792
807
|
#
|
|
793
808
|
def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
794
|
-
|
|
809
|
+
quote_name(name)
|
|
810
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
795
811
|
|
|
796
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
|
|
797
813
|
|
|
@@ -843,21 +859,36 @@ module Meteor
|
|
|
843
859
|
|
|
844
860
|
private :element_five
|
|
845
861
|
|
|
846
|
-
def
|
|
847
|
-
|
|
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)
|
|
848
870
|
@_attr_name1 = Regexp.quote(attr_name1)
|
|
849
|
-
@_attr_name2 = Regexp.quote(attr_name2)
|
|
850
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)
|
|
851
877
|
@_attr_value2 = Regexp.quote(attr_value2)
|
|
878
|
+
@_attr_name2 = Regexp.quote(attr_name2)
|
|
852
879
|
end
|
|
853
880
|
|
|
854
|
-
private :
|
|
881
|
+
private :quote_attribute_two
|
|
855
882
|
|
|
856
883
|
def element_normal_five_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
884
|
+
# @res.to_a.each_with_index do |capture, i|
|
|
885
|
+
# puts i
|
|
886
|
+
# puts capture
|
|
887
|
+
# end
|
|
857
888
|
# puts @res.captures.length
|
|
858
889
|
case @res.captures.length
|
|
859
890
|
when FOUR
|
|
860
|
-
#
|
|
891
|
+
# element (要素)
|
|
861
892
|
@elm_ = Meteor::Element.new(name)
|
|
862
893
|
# attribute (属性)
|
|
863
894
|
@elm_.attributes = @res[1]
|
|
@@ -966,7 +997,7 @@ module Meteor
|
|
|
966
997
|
# document (全体)
|
|
967
998
|
@elm_.document = @res[0]
|
|
968
999
|
# pattern (空要素検索用パターン)
|
|
969
|
-
@pattern_cc = "<#{@_name}(\\s[^<>]*(
|
|
1000
|
+
@pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}" # rubocop:disable Layout/LineLength
|
|
970
1001
|
@elm_.pattern = @pattern_cc
|
|
971
1002
|
@elm_.parser = self
|
|
972
1003
|
|
|
@@ -984,7 +1015,7 @@ module Meteor
|
|
|
984
1015
|
# @return [Meteor::Element] element (要素)
|
|
985
1016
|
#
|
|
986
1017
|
def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
|
|
987
|
-
|
|
1018
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
988
1019
|
|
|
989
1020
|
element_pattern_four
|
|
990
1021
|
|
|
@@ -1009,17 +1040,8 @@ module Meteor
|
|
|
1009
1040
|
|
|
1010
1041
|
private :element_four
|
|
1011
1042
|
|
|
1012
|
-
def quote_element_four(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
1013
|
-
@_attr_name1 = Regexp.quote(attr_name1)
|
|
1014
|
-
@_attr_name2 = Regexp.quote(attr_name2)
|
|
1015
|
-
@_attr_value1 = Regexp.quote(attr_value1)
|
|
1016
|
-
@_attr_value2 = Regexp.quote(attr_value2)
|
|
1017
|
-
end
|
|
1018
|
-
|
|
1019
|
-
private :quote_element_four
|
|
1020
|
-
|
|
1021
1043
|
def element_pattern_four
|
|
1022
|
-
@pattern_cc = "<([^<>\"]*)\\s[^<>]*(
|
|
1044
|
+
@pattern_cc = "<([^<>\"]*)\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")" # rubocop:disable Layout/LineLength
|
|
1023
1045
|
end
|
|
1024
1046
|
|
|
1025
1047
|
private :element_pattern_four
|
|
@@ -1283,7 +1305,6 @@ module Meteor
|
|
|
1283
1305
|
else
|
|
1284
1306
|
element_void_one(@elm_.name)
|
|
1285
1307
|
end
|
|
1286
|
-
|
|
1287
1308
|
when TWO, THREE
|
|
1288
1309
|
if @elm_.normal
|
|
1289
1310
|
element_normal_three_one(@elm_.name)
|
data/lib/meteor/element.rb
CHANGED
|
@@ -219,21 +219,22 @@ module Meteor
|
|
|
219
219
|
def document # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
220
220
|
if @document_sync
|
|
221
221
|
@document_sync = false
|
|
222
|
+
@_mixed_content = @mixed_content ? Regexp.quote(@mixed_content) : ''
|
|
222
223
|
case @parser.doc_type
|
|
223
224
|
when Parser::HTML, Parser::HTML4
|
|
224
225
|
@document = if @cx
|
|
225
|
-
"<!-- @#{@name} #{@attributes} -->#{@
|
|
226
|
+
"<!-- @#{@name} #{@attributes} -->#{@_mixed_content}<!-- /@#{@name} -->"
|
|
226
227
|
elsif @normal
|
|
227
|
-
"<#{@name}#{@attributes}>#{@
|
|
228
|
+
"<#{@name}#{@attributes}>#{@_mixed_content}</#{@name}>"
|
|
228
229
|
else
|
|
229
230
|
String.new('') << '<' << @name << @attributes << '>'
|
|
230
231
|
# @document = "<#{@name}#{@attributes}>"
|
|
231
232
|
end
|
|
232
233
|
when Parser::XHTML, Parser::XHTML4, Parser::XML
|
|
233
234
|
@document = if @cx
|
|
234
|
-
"<!-- @#{@name} #{@attributes} -->#{@
|
|
235
|
+
"<!-- @#{@name} #{@attributes} -->#{@_mixed_content}<!-- /@#{@name} -->"
|
|
235
236
|
elsif @normal
|
|
236
|
-
"<#{@name}#{@attributes}>#{@
|
|
237
|
+
"<#{@name}#{@attributes}>#{@_mixed_content}</#{@name}>"
|
|
237
238
|
else
|
|
238
239
|
String.new('') << '<' << @name << @attributes << '/>'
|
|
239
240
|
# "<#{@name}#{@attributes}/>"
|
|
@@ -8,9 +8,6 @@ module Meteor
|
|
|
8
8
|
# HTML4 parser (HTMLパーサ)
|
|
9
9
|
#
|
|
10
10
|
class ParserImpl < Meteor::Core::Kernel # rubocop:disable Metrics/ClassLength
|
|
11
|
-
# NEWLINE = "\r?\n|\r"
|
|
12
|
-
# NEWLINE = "\r\n|\n|\r"
|
|
13
|
-
NEWLINE = ["\r\n", "\n", "\r"].freeze
|
|
14
11
|
BR = '<br>'
|
|
15
12
|
BR_RE = BR
|
|
16
13
|
|
|
@@ -117,22 +114,12 @@ module Meteor
|
|
|
117
114
|
|
|
118
115
|
private :initialize_one
|
|
119
116
|
|
|
120
|
-
#
|
|
121
|
-
# parse document (ドキュメントを解析する)
|
|
122
|
-
#
|
|
123
|
-
def parse
|
|
124
|
-
analyze_ml
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
protected :parse
|
|
128
|
-
|
|
129
117
|
#
|
|
130
118
|
# analyze document (ドキュメントをパースする)
|
|
131
119
|
#
|
|
132
120
|
def analyze_ml
|
|
121
|
+
super
|
|
133
122
|
analyze_content_type
|
|
134
|
-
analyze_newline
|
|
135
|
-
|
|
136
123
|
@res = nil
|
|
137
124
|
end
|
|
138
125
|
|
|
@@ -168,17 +155,6 @@ module Meteor
|
|
|
168
155
|
|
|
169
156
|
protected :analyze_content_type
|
|
170
157
|
|
|
171
|
-
#
|
|
172
|
-
# analuze document , set newline (ドキュメントをパースし、改行コードをセットする)
|
|
173
|
-
#
|
|
174
|
-
def analyze_newline
|
|
175
|
-
NEWLINE.each do |a|
|
|
176
|
-
@root.newline = a if @root.document.include?(a)
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
protected :analyze_newline
|
|
181
|
-
|
|
182
158
|
#
|
|
183
159
|
# get element using tag name (要素のタグ名で検索し、要素を取得する)
|
|
184
160
|
# @param [String] name tag name (タグ名)
|
|
@@ -247,11 +223,8 @@ module Meteor
|
|
|
247
223
|
# @return [Meteor::Element] element (要素)
|
|
248
224
|
#
|
|
249
225
|
def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
else
|
|
253
|
-
quote_name(name)
|
|
254
|
-
end
|
|
226
|
+
quote_name(name)
|
|
227
|
+
quote_attribute(attr_name, attr_value) if quote
|
|
255
228
|
|
|
256
229
|
# case of void element (空要素の場合(<->内容あり要素の場合))
|
|
257
230
|
if match?(MATCH_TAG, name)
|
|
@@ -335,7 +308,8 @@ module Meteor
|
|
|
335
308
|
# @return [Meteor::Element] element (要素)
|
|
336
309
|
#
|
|
337
310
|
def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
338
|
-
|
|
311
|
+
quote_name(name)
|
|
312
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
339
313
|
|
|
340
314
|
# case of void element (空要素の場合(<->内容あり要素の場合))
|
|
341
315
|
if match?(MATCH_TAG, name)
|
|
@@ -405,9 +379,9 @@ module Meteor
|
|
|
405
379
|
# @return [Meteor::Element] element (要素)
|
|
406
380
|
#
|
|
407
381
|
def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
|
|
408
|
-
|
|
382
|
+
quote_attribute_one_two(attr_name1, attr_value1, attr_name2, attr_value2)
|
|
409
383
|
|
|
410
|
-
@pattern_cc = "<([^<>\"]*)\\s([^<>]*(
|
|
384
|
+
@pattern_cc = "<([^<>\"]*)\\s([^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
|
|
411
385
|
|
|
412
386
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
|
413
387
|
|
|
@@ -8,8 +8,6 @@ module Meteor
|
|
|
8
8
|
# XHTML4 parser (XHTML4パーサ)
|
|
9
9
|
#
|
|
10
10
|
class ParserImpl < Meteor::Core::Kernel # rubocop:disable Metrics/ClassLength
|
|
11
|
-
# NEWLINE = "\r?\n|\r"
|
|
12
|
-
NEWLINE = ["\r\n", "\n", "\r"].freeze
|
|
13
11
|
BR = '<br/>'
|
|
14
12
|
BR_RE = '<br\\/>'
|
|
15
13
|
|
|
@@ -108,21 +106,12 @@ module Meteor
|
|
|
108
106
|
|
|
109
107
|
private :initialize_one
|
|
110
108
|
|
|
111
|
-
#
|
|
112
|
-
# parse document (ドキュメントを解析する)
|
|
113
|
-
#
|
|
114
|
-
def parse
|
|
115
|
-
analyze_ml
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
protected :parse
|
|
119
|
-
|
|
120
109
|
#
|
|
121
110
|
# analyze document (ドキュメントをパースする)
|
|
122
111
|
#
|
|
123
112
|
def analyze_ml
|
|
113
|
+
super
|
|
124
114
|
analyze_content_type
|
|
125
|
-
analyze_newline
|
|
126
115
|
@res = nil
|
|
127
116
|
end
|
|
128
117
|
|
|
@@ -160,17 +149,6 @@ module Meteor
|
|
|
160
149
|
|
|
161
150
|
private :analyze_content_type
|
|
162
151
|
|
|
163
|
-
#
|
|
164
|
-
# analyze document , set newline (ドキュメントをパースし、改行コードをセットする)
|
|
165
|
-
#
|
|
166
|
-
def analyze_newline
|
|
167
|
-
NEWLINE.each do |a|
|
|
168
|
-
@root.newline = a if @root.document.include?(a)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
private :analyze_newline
|
|
173
|
-
|
|
174
152
|
def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
175
153
|
if match?('selected', attr_name) && match?('option', elm.name)
|
|
176
154
|
edit_attrs_five(elm, attr_value, RE_SELECTED_M, RE_SELECTED_R, SELECTED_U)
|
|
@@ -8,9 +8,6 @@ module Meteor
|
|
|
8
8
|
# XML parser (XMLパーサ)
|
|
9
9
|
#
|
|
10
10
|
class ParserImpl < Meteor::Core::Kernel
|
|
11
|
-
# NEWLINE = "\r?\n|\r"
|
|
12
|
-
NEWLINE = ["\r\n", "\n", "\r"].freeze
|
|
13
|
-
|
|
14
11
|
TABLE_FOR_ESCAPE_ = {
|
|
15
12
|
'&' => '&',
|
|
16
13
|
'"' => '"',
|
|
@@ -66,22 +63,12 @@ module Meteor
|
|
|
66
63
|
|
|
67
64
|
private :initialize_one
|
|
68
65
|
|
|
69
|
-
#
|
|
70
|
-
# parse document (ドキュメントを解析する)
|
|
71
|
-
#
|
|
72
|
-
def parse
|
|
73
|
-
analyze_ml
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
protected :parse
|
|
77
|
-
|
|
78
66
|
#
|
|
79
67
|
# analyze document (ドキュメントをパースする)
|
|
80
68
|
#
|
|
81
69
|
def analyze_ml
|
|
82
|
-
|
|
70
|
+
super
|
|
83
71
|
analyze_content_type
|
|
84
|
-
|
|
85
72
|
@res = nil
|
|
86
73
|
end
|
|
87
74
|
|
|
@@ -95,17 +82,6 @@ module Meteor
|
|
|
95
82
|
@root.content_type
|
|
96
83
|
end
|
|
97
84
|
|
|
98
|
-
#
|
|
99
|
-
# analuze document , set newline (ドキュメントをパースし、改行コードをセットする)
|
|
100
|
-
#
|
|
101
|
-
def analyze_newline
|
|
102
|
-
NEWLINE.each do |a|
|
|
103
|
-
@root.newline = a if @root.document.include?(a)
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
private :analyze_newline
|
|
108
|
-
|
|
109
85
|
#
|
|
110
86
|
# analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
|
|
111
87
|
#
|
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.44
|
|
41
41
|
#
|
|
42
42
|
|
|
43
43
|
module Meteor
|
|
44
|
-
VERSION = '0.9.
|
|
44
|
+
VERSION = '0.9.44'
|
|
45
45
|
|
|
46
46
|
# require 'fileutils'
|
|
47
47
|
|