asip-meteor 0.9.2.5 → 0.9.2.6
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.
- data/lib/meteor.rb +155 -61
- metadata +2 -2
data/lib/meteor.rb
CHANGED
@@ -18,12 +18,12 @@
|
|
18
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
19
|
#
|
20
20
|
# @author Yasumasa Ashida
|
21
|
-
# @version 0.9.2.
|
21
|
+
# @version 0.9.2.6
|
22
22
|
#
|
23
23
|
|
24
24
|
module Meteor
|
25
25
|
|
26
|
-
VERSION = "0.9.2.
|
26
|
+
VERSION = "0.9.2.6"
|
27
27
|
|
28
28
|
RUBY_VERSION_1_9_0 = '1.9.0'
|
29
29
|
|
@@ -45,7 +45,7 @@ module Meteor
|
|
45
45
|
#
|
46
46
|
# 要素クラス
|
47
47
|
#
|
48
|
-
class Element
|
48
|
+
class Element
|
49
49
|
|
50
50
|
#
|
51
51
|
# イニシャライザ
|
@@ -65,7 +65,8 @@ module Meteor
|
|
65
65
|
@name = args[0].name
|
66
66
|
@attributes = String.new(args[0].attributes)
|
67
67
|
@mixed_content = String.new(args[0].mixed_content)
|
68
|
-
|
68
|
+
#@pattern = String.new(args[0].pattern)
|
69
|
+
@pattern = args[0].pattern
|
69
70
|
@document = String.new(args[0].document)
|
70
71
|
@empty = args[0].empty
|
71
72
|
@cx = args[0].cx
|
@@ -108,7 +109,8 @@ module Meteor
|
|
108
109
|
#if !elm.origin then
|
109
110
|
@name = elm.name
|
110
111
|
@attributes = String.new(elm.attributes)
|
111
|
-
|
112
|
+
#@pattern = String.new(elm.pattern)
|
113
|
+
@pattern = elm.pattern
|
112
114
|
@document = String.new(elm.document)
|
113
115
|
@empty = elm.empty
|
114
116
|
@cx = elm.cx
|
@@ -135,7 +137,9 @@ module Meteor
|
|
135
137
|
attr_accessor :attributes #属性群
|
136
138
|
attr_accessor :mixed_content #内容
|
137
139
|
attr_accessor :pattern #パターン
|
138
|
-
attr_accessor :document #ドキュメント
|
140
|
+
#attr_accessor :document #ドキュメント
|
141
|
+
#attr_writer :document
|
142
|
+
attr_accessor :document_sync
|
139
143
|
attr_accessor :empty #内容存在フラグ
|
140
144
|
attr_accessor :cx #コメント拡張タグフラグ
|
141
145
|
attr_accessor :mono #子要素存在フラグ
|
@@ -160,7 +164,7 @@ module Meteor
|
|
160
164
|
if @obj then
|
161
165
|
@obj.attributes = String.new(args[0].attributes)
|
162
166
|
@obj.mixed_content = String.new(args[0].mixed_content)
|
163
|
-
|
167
|
+
#@obj.pattern = String.new(args[0].pattern)
|
164
168
|
@obj.document = String.new(args[0].document)
|
165
169
|
#@obj.arguments = AttributeMap.new(args[0].arguments)
|
166
170
|
@obj
|
@@ -180,7 +184,7 @@ module Meteor
|
|
180
184
|
if obj then
|
181
185
|
obj.attributes = String.new(self.attributes)
|
182
186
|
obj.mixed_content = String.new(self.mixed_content)
|
183
|
-
obj.pattern = String.new(self.pattern)
|
187
|
+
#obj.pattern = String.new(self.pattern)
|
184
188
|
obj.document = String.new(self.document)
|
185
189
|
#obj.arguments = AttributeMap.new(self.arguments)
|
186
190
|
obj.usable = true
|
@@ -288,6 +292,45 @@ module Meteor
|
|
288
292
|
@parser.remove_attribute(self,*args)
|
289
293
|
end
|
290
294
|
|
295
|
+
def document=(doc)
|
296
|
+
@document_sync = false
|
297
|
+
@document = doc
|
298
|
+
end
|
299
|
+
|
300
|
+
def document
|
301
|
+
if @document_sync then
|
302
|
+
@document_sync = false
|
303
|
+
case @parser.doc_type
|
304
|
+
when Parser::HTML then
|
305
|
+
if @cx then
|
306
|
+
#@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
|
307
|
+
@document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
|
308
|
+
else
|
309
|
+
if @empty then
|
310
|
+
#@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
|
311
|
+
@document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
|
312
|
+
else
|
313
|
+
@document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE
|
314
|
+
end
|
315
|
+
end
|
316
|
+
when Parser::XHTML,Parser::XML then
|
317
|
+
if @cx then
|
318
|
+
#@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
|
319
|
+
@document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
|
320
|
+
else
|
321
|
+
if @empty then
|
322
|
+
#@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
|
323
|
+
@document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
|
324
|
+
else
|
325
|
+
@document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE3
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
else
|
330
|
+
@document
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
291
334
|
#
|
292
335
|
# 要素を削除する
|
293
336
|
#
|
@@ -563,14 +606,17 @@ module Meteor
|
|
563
606
|
when Parser::HTML then
|
564
607
|
html = Meteor::Core::Html::ParserImpl.new()
|
565
608
|
html.read(path, encoding)
|
609
|
+
html.doc_type = Parser::HTML
|
566
610
|
psf.parser = html
|
567
611
|
when Parser::XHTML then
|
568
612
|
xhtml = Meteor::Core::Xhtml::ParserImpl.new()
|
569
613
|
xhtml.read(path, encoding)
|
614
|
+
xhtml.doc_type = Parser::XHTML
|
570
615
|
psf.parser = xhtml
|
571
616
|
when Parser::XML then
|
572
617
|
xml = Meteor::Core::Xml::ParserImpl.new()
|
573
618
|
xml.read(path, encoding)
|
619
|
+
xml.doc_type = Parser::XML
|
574
620
|
psf.parser = xml
|
575
621
|
end
|
576
622
|
|
@@ -592,14 +638,17 @@ module Meteor
|
|
592
638
|
when Parser::HTML then
|
593
639
|
html = Meteor::Core::Html::ParserImpl.new()
|
594
640
|
html.parse(document)
|
641
|
+
html.doc_type = Parser::HTML
|
595
642
|
psf.parser = html
|
596
643
|
when Parser::XHTML then
|
597
644
|
xhtml = Meteor::Core::Xhtml::ParserImpl.new()
|
598
645
|
xhtml.parse(document)
|
646
|
+
xhtml.doc_type = Parser::XHTML
|
599
647
|
psf.parser = xhtml
|
600
648
|
when Parser::XML then
|
601
649
|
xml = Meteor::Core::Xml::ParserImpl.new()
|
602
650
|
xml.parse(document)
|
651
|
+
xml.doc_type = Parser::XML
|
603
652
|
psf.parser = xml
|
604
653
|
end
|
605
654
|
|
@@ -809,13 +858,19 @@ module Meteor
|
|
809
858
|
#attributeMap
|
810
859
|
GET_ATTRS_MAP = '([^\\s]*)="([^\"]*)"'
|
811
860
|
#removeAttribute
|
812
|
-
ERASE_ATTR_1 = '="[
|
861
|
+
ERASE_ATTR_1 = '="[^"]*"\\s?'
|
813
862
|
|
814
863
|
#cxtag
|
864
|
+
#SEARCH_CX_1 = '<!--\\s@'
|
865
|
+
#SEARCH_CX_2 = '\\s([^<>]*id="'
|
866
|
+
#SEARCH_CX_3 = '\"[^<>]*)-->(((?!(<!--\\s\\/@'
|
867
|
+
#SEARCH_CX_4 = ')).)*)<!--\\s\\/@'
|
868
|
+
#SEARCH_CX_5 = '\\s-->'
|
869
|
+
#SEARCH_CX_6 = '<!--\\s@([^<>]*)\\s[^<>]*id="'
|
815
870
|
SEARCH_CX_1 = '<!--\\s@'
|
816
871
|
SEARCH_CX_2 = '\\s([^<>]*id="'
|
817
|
-
SEARCH_CX_3 = '
|
818
|
-
SEARCH_CX_4 = ')).)*)<!--\\s
|
872
|
+
SEARCH_CX_3 = '"[^<>]*)-->(((?!(<!--\\s/@'
|
873
|
+
SEARCH_CX_4 = ')).)*)<!--\\s/@'
|
819
874
|
SEARCH_CX_5 = '\\s-->'
|
820
875
|
SEARCH_CX_6 = '<!--\\s@([^<>]*)\\s[^<>]*id="'
|
821
876
|
|
@@ -970,6 +1025,7 @@ module Meteor
|
|
970
1025
|
end
|
971
1026
|
|
972
1027
|
attr_accessor :element_cache
|
1028
|
+
attr_accessor :doc_type
|
973
1029
|
|
974
1030
|
#
|
975
1031
|
# 文字エンコーディングをセットする
|
@@ -1869,11 +1925,13 @@ module Meteor
|
|
1869
1925
|
#elsif args[0].kind_of?(String) && args[1].kind_of?(String) then
|
1870
1926
|
# set_attribute_2(args[0],args[1])
|
1871
1927
|
elsif args[0].kind_of?(Meteor::Element) && args[1].kind_of?(Meteor::AttributeMap) then
|
1928
|
+
args[0].document_sync = true
|
1872
1929
|
set_attribute_2_m(args[0],args[1])
|
1873
1930
|
else
|
1874
1931
|
raise ArgumentError
|
1875
1932
|
end
|
1876
1933
|
when THREE
|
1934
|
+
args[0].document_sync = true
|
1877
1935
|
set_attribute_3(args[0],args[1],args[2])
|
1878
1936
|
else
|
1879
1937
|
raise ArgumentError
|
@@ -2153,6 +2211,7 @@ module Meteor
|
|
2153
2211
|
#end
|
2154
2212
|
when TWO
|
2155
2213
|
#if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String) then
|
2214
|
+
args[0].document_sync = true
|
2156
2215
|
set_content_2_s(args[0],args[1])
|
2157
2216
|
#elsif args[0].kind_of?(String) && (args[1].eql?(true) || args[1].eql?(false)) then
|
2158
2217
|
##elsif args[0].kind_of?(String) && (args[1].kinf_of?(TrueClass) || args[1].kind_of?(FalseClass)) then
|
@@ -2161,6 +2220,7 @@ module Meteor
|
|
2161
2220
|
# raise ArgumentError
|
2162
2221
|
#end
|
2163
2222
|
when THREE
|
2223
|
+
args[0].document_sync = true
|
2164
2224
|
set_content_3(args[0],args[1],args[2])
|
2165
2225
|
else
|
2166
2226
|
raise ArgumentError
|
@@ -2228,9 +2288,11 @@ module Meteor
|
|
2228
2288
|
if !elm.cx then
|
2229
2289
|
if elm.empty then
|
2230
2290
|
unescape_content(elm.mixed_content,elm.name)
|
2291
|
+
else
|
2292
|
+
nil
|
2231
2293
|
end
|
2232
2294
|
else
|
2233
|
-
|
2295
|
+
unescape_content(elm.mixed_content,elm.name)
|
2234
2296
|
end
|
2235
2297
|
end
|
2236
2298
|
private :get_content_1
|
@@ -2242,8 +2304,8 @@ module Meteor
|
|
2242
2304
|
#
|
2243
2305
|
def remove_attribute(*args)
|
2244
2306
|
case args.length
|
2245
|
-
when ONE
|
2246
|
-
|
2307
|
+
#when ONE
|
2308
|
+
# remove_attribute_1(args[0])
|
2247
2309
|
when TWO
|
2248
2310
|
remove_attribute_2(args[0],args[1])
|
2249
2311
|
else
|
@@ -2260,6 +2322,7 @@ module Meteor
|
|
2260
2322
|
def remove_attribute_2(elm,attr_name)
|
2261
2323
|
if !elm.cx then
|
2262
2324
|
|
2325
|
+
elm.document_sync = true
|
2263
2326
|
remove_attributes_(elm,attr_name)
|
2264
2327
|
|
2265
2328
|
#if !elm.origin then
|
@@ -2267,6 +2330,7 @@ module Meteor
|
|
2267
2330
|
# elm.arguments.delete(attr_name)
|
2268
2331
|
# end
|
2269
2332
|
#end
|
2333
|
+
|
2270
2334
|
end
|
2271
2335
|
|
2272
2336
|
elm
|
@@ -2281,19 +2345,19 @@ module Meteor
|
|
2281
2345
|
end
|
2282
2346
|
private :remove_attributes_
|
2283
2347
|
|
2348
|
+
##
|
2349
|
+
## 要素の属性を消す
|
2350
|
+
##
|
2351
|
+
## @param [String] attr_name 属性名
|
2352
|
+
##
|
2353
|
+
#def remove_attribute_1(attr_name)
|
2354
|
+
# if @root.element then
|
2355
|
+
# remove_attribute_2(@root.element, attr_name)
|
2356
|
+
# end
|
2284
2357
|
#
|
2285
|
-
#
|
2286
|
-
#
|
2287
|
-
#
|
2288
|
-
#
|
2289
|
-
def remove_attribute_1(attr_name)
|
2290
|
-
if @root.element then
|
2291
|
-
remove_attribute_2(@root.element, attr_name)
|
2292
|
-
end
|
2293
|
-
|
2294
|
-
@root.element
|
2295
|
-
end
|
2296
|
-
private :remove_attribute_1
|
2358
|
+
# @root.element
|
2359
|
+
#end
|
2360
|
+
#private :remove_attribute_1
|
2297
2361
|
|
2298
2362
|
#
|
2299
2363
|
# 要素を消す
|
@@ -2315,8 +2379,14 @@ module Meteor
|
|
2315
2379
|
case args.length
|
2316
2380
|
when ONE
|
2317
2381
|
cxtag_1(args[0])
|
2382
|
+
if @elm_ then
|
2383
|
+
@element_cache.store(@elm_.object_id,@elm_)
|
2384
|
+
end
|
2318
2385
|
when TWO
|
2319
2386
|
cxtag_2(args[0],args[1])
|
2387
|
+
if @elm_ then
|
2388
|
+
@element_cache.store(@elm_.object_id,@elm_)
|
2389
|
+
end
|
2320
2390
|
else
|
2321
2391
|
raise ArgumentError
|
2322
2392
|
end
|
@@ -2334,7 +2404,8 @@ module Meteor
|
|
2334
2404
|
#CXタグ検索用パターン
|
2335
2405
|
#@pattern_cc = '' << SEARCH_CX_1 << elm_name << SEARCH_CX_2
|
2336
2406
|
#@pattern_cc << id << SEARCH_CX_3 << elm_name << SEARCH_CX_4 << elm_name << SEARCH_CX_5
|
2337
|
-
|
2407
|
+
#@pattern_cc = "<!--\\s@#{elm_name}\\s([^<>]*id=\"#{id}\"[^<>]*)-->(((?!(<!--\\s\\/@#{elm_name})).)*)<!--\\s\\/@#{elm_name}\\s-->"
|
2408
|
+
@pattern_cc = "<!--\\s@#{elm_name}\\s([^<>]*id=\"#{id}\"[^<>]*)-->(((?!(<!--\\s/@#{elm_name})).)*)<!--\\s/@#{elm_name}\\s-->"
|
2338
2409
|
|
2339
2410
|
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
2340
2411
|
#CXタグ検索
|
@@ -2845,10 +2916,12 @@ module Meteor
|
|
2845
2916
|
#
|
2846
2917
|
class ParserImpl < Meteor::Core::Kernel
|
2847
2918
|
|
2848
|
-
KAIGYO_CODE =
|
2919
|
+
#KAIGYO_CODE = "\r?\n|\r"
|
2920
|
+
#KAIGYO_CODE = "\r\n|\n|\r"
|
2921
|
+
KAIGYO_CODE = ["\r\n","\n","\r"]
|
2849
2922
|
NBSP_2 = ' '
|
2850
2923
|
NBSP_3 = 'nbsp'
|
2851
|
-
BR_1 =
|
2924
|
+
BR_1 = "\r?\n|\r"
|
2852
2925
|
BR_2 = '<br>'
|
2853
2926
|
|
2854
2927
|
META = 'META'
|
@@ -2953,6 +3026,7 @@ module Meteor
|
|
2953
3026
|
|
2954
3027
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
2955
3028
|
@@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
|
3029
|
+
@@pattern_br_2 = Regexp.new(BR_2)
|
2956
3030
|
else
|
2957
3031
|
@@pattern_and_1 = Regexp.new(AND_1)
|
2958
3032
|
@@pattern_lt_1 = Regexp.new(LT_1)
|
@@ -3013,6 +3087,8 @@ module Meteor
|
|
3013
3087
|
#@root.hook = ps.root_element.hook
|
3014
3088
|
#@root.mono_hook = ps.root_element.mono_hook
|
3015
3089
|
@root.content_type = String.new(ps.content_type);
|
3090
|
+
@root.kaigyo_code = ps.root_element.kaigyo_code
|
3091
|
+
@doc_type = ps.doc_type
|
3016
3092
|
end
|
3017
3093
|
private :initialize_1
|
3018
3094
|
|
@@ -3081,12 +3157,21 @@ module Meteor
|
|
3081
3157
|
#
|
3082
3158
|
def analyze_kaigyo_code()
|
3083
3159
|
#改行コード取得
|
3084
|
-
|
3085
|
-
|
3160
|
+
#@pattern = Regexp.new(KAIGYO_CODE)
|
3161
|
+
#@res = @pattern.match(@root.document)
|
3086
3162
|
|
3087
|
-
if @res then
|
3088
|
-
|
3163
|
+
#if @res then
|
3164
|
+
# @root.kaigyo_code = @res[0]
|
3165
|
+
# puts "test"
|
3166
|
+
# puts @res[0]
|
3167
|
+
#end
|
3168
|
+
|
3169
|
+
for a in KAIGYO_CODE
|
3170
|
+
if @root.document.include?(a) then
|
3171
|
+
@root.kaigyo_code = a
|
3172
|
+
end
|
3089
3173
|
end
|
3174
|
+
|
3090
3175
|
end
|
3091
3176
|
private :analyze_kaigyo_code
|
3092
3177
|
|
@@ -3488,16 +3573,16 @@ module Meteor
|
|
3488
3573
|
elm.mono = true
|
3489
3574
|
if elm.cx then
|
3490
3575
|
#@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
|
3491
|
-
|
3576
|
+
elm.document = "<!-- @#{elm.name} #{elm.attributes} -->#{elm.mixed_content}<!-- /@#{elm.name} -->"
|
3492
3577
|
else
|
3493
3578
|
if elm.empty then
|
3494
3579
|
#@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
|
3495
|
-
|
3580
|
+
elm.document = "<#{elm.name}#{elm.attributes}>#{elm.mixed_content}</#{elm.name}>"
|
3496
3581
|
else
|
3497
|
-
|
3582
|
+
elm.document = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE
|
3498
3583
|
end
|
3499
3584
|
end
|
3500
|
-
elm.document = @pattern_cc
|
3585
|
+
#elm.document = @pattern_cc
|
3501
3586
|
end
|
3502
3587
|
end
|
3503
3588
|
private :set_mono_info
|
@@ -3570,7 +3655,7 @@ module Meteor
|
|
3570
3655
|
#if content.include?(AND_2) then
|
3571
3656
|
# content.gsub!(@@pattern_and_2,AND_1)
|
3572
3657
|
#end
|
3573
|
-
content.gsub
|
3658
|
+
content.gsub(@@pattern_unescape) do
|
3574
3659
|
case $1
|
3575
3660
|
when AND_3 then
|
3576
3661
|
AND_1
|
@@ -3587,21 +3672,20 @@ module Meteor
|
|
3587
3672
|
end
|
3588
3673
|
end
|
3589
3674
|
|
3590
|
-
content
|
3591
3675
|
end
|
3592
3676
|
private :unescape
|
3593
3677
|
|
3594
3678
|
def unescape_content(content,elm_name)
|
3595
|
-
|
3679
|
+
content_ = unescape(content)
|
3596
3680
|
|
3597
3681
|
if !is_match(MATCH_TAG_2,elm_name) then
|
3598
3682
|
#「<br>」->「¥r?¥n」
|
3599
3683
|
if content.include?(BR_2) then
|
3600
|
-
|
3684
|
+
content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
|
3601
3685
|
end
|
3602
3686
|
end
|
3603
3687
|
|
3604
|
-
|
3688
|
+
content_
|
3605
3689
|
end
|
3606
3690
|
private :unescape_content
|
3607
3691
|
|
@@ -3615,10 +3699,11 @@ module Meteor
|
|
3615
3699
|
#
|
3616
3700
|
class ParserImpl < Meteor::Core::Kernel
|
3617
3701
|
|
3618
|
-
KAIGYO_CODE =
|
3702
|
+
#KAIGYO_CODE = "\r?\n|\r"
|
3703
|
+
KAIGYO_CODE = ["\r\n","\n","\r"]
|
3619
3704
|
NBSP_2 = ' '
|
3620
3705
|
NBSP_3 = 'nbsp'
|
3621
|
-
BR_1 =
|
3706
|
+
BR_1 = "\r?\n|\r"
|
3622
3707
|
BR_2 = '<br/>'
|
3623
3708
|
BR_3 = '<br\\/>'
|
3624
3709
|
|
@@ -3728,7 +3813,7 @@ module Meteor
|
|
3728
3813
|
PATTERN_ESCAPE_CONTENT = '[&"\'<> \\n]'
|
3729
3814
|
@@pattern_escape = Regexp.new(PATTERN_ESCAPE)
|
3730
3815
|
@@pattern_escape_content = Regexp.new(PATTERN_ESCAPE_CONTENT)
|
3731
|
-
|
3816
|
+
@@pattern_br_2 = Regexp.new(BR_3)
|
3732
3817
|
else
|
3733
3818
|
|
3734
3819
|
@@pattern_and_1 = Regexp.new(AND_1)
|
@@ -3786,7 +3871,9 @@ module Meteor
|
|
3786
3871
|
def initialize_1(ps)
|
3787
3872
|
@root.document = String.new(ps.document)
|
3788
3873
|
@root.hook_document = String.new(ps.root_element.hook_document)
|
3789
|
-
@root.content_type = String.new(ps.content_type)
|
3874
|
+
@root.content_type = String.new(ps.content_type)
|
3875
|
+
@root.kaigyo_code = ps.root_element.kaigyo_code
|
3876
|
+
@doc_type = ps.doc_type
|
3790
3877
|
end
|
3791
3878
|
private :initialize_1
|
3792
3879
|
|
@@ -3855,11 +3942,17 @@ module Meteor
|
|
3855
3942
|
#
|
3856
3943
|
def analyze_kaigyo_code()
|
3857
3944
|
#改行コード取得
|
3858
|
-
|
3859
|
-
|
3945
|
+
#@pattern = Regexp.new(KAIGYO_CODE)
|
3946
|
+
#@res = @pattern.match(@root.document)
|
3860
3947
|
|
3861
|
-
if @res then
|
3862
|
-
|
3948
|
+
#if @res then
|
3949
|
+
# @root.kaigyo_code = @res[0]
|
3950
|
+
#end
|
3951
|
+
|
3952
|
+
for a in KAIGYO_CODE
|
3953
|
+
if @root.document.include?(a) then
|
3954
|
+
@root.kaigyo_code = a
|
3955
|
+
end
|
3863
3956
|
end
|
3864
3957
|
end
|
3865
3958
|
private :analyze_kaigyo_code
|
@@ -4005,16 +4098,16 @@ module Meteor
|
|
4005
4098
|
elm.mono = true
|
4006
4099
|
if elm.cx then
|
4007
4100
|
#@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
|
4008
|
-
|
4101
|
+
elm.document = "<!-- @#{elm.name} #{elm.attributes} -->#{elm.mixed_content}<!-- /@#{elm.name} -->"
|
4009
4102
|
else
|
4010
4103
|
if elm.empty then
|
4011
4104
|
#@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
|
4012
|
-
|
4105
|
+
elm.document = "<#{elm.name}#{elm.attributes}>#{elm.mixed_content}</#{elm.name}>"
|
4013
4106
|
else
|
4014
|
-
|
4107
|
+
elm.document = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE3
|
4015
4108
|
end
|
4016
4109
|
end
|
4017
|
-
elm.document = @pattern_cc
|
4110
|
+
#elm.document = @pattern_cc
|
4018
4111
|
end
|
4019
4112
|
end
|
4020
4113
|
private :set_mono_info
|
@@ -4092,7 +4185,7 @@ module Meteor
|
|
4092
4185
|
#if content.include?(AND_2) then
|
4093
4186
|
# content.gsub!(@@pattern_and_2,AND_1)
|
4094
4187
|
#end
|
4095
|
-
content.gsub
|
4188
|
+
content.gsub(@@pattern_unescape) do
|
4096
4189
|
case $1
|
4097
4190
|
when AND_3 then
|
4098
4191
|
AND_1
|
@@ -4109,21 +4202,21 @@ module Meteor
|
|
4109
4202
|
end
|
4110
4203
|
end
|
4111
4204
|
|
4112
|
-
content
|
4205
|
+
#content
|
4113
4206
|
end
|
4114
4207
|
private :unescape
|
4115
4208
|
|
4116
4209
|
def unescape_content(content,elm_name)
|
4117
|
-
|
4210
|
+
content_ = unescape(content)
|
4118
4211
|
|
4119
4212
|
if !is_match(MATCH_TAG_2,elm_name) then
|
4120
4213
|
#「<br>」->「¥r?¥n」
|
4121
4214
|
if content.include?(BR_2) then
|
4122
|
-
|
4215
|
+
content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
|
4123
4216
|
end
|
4124
4217
|
end
|
4125
4218
|
|
4126
|
-
|
4219
|
+
content_
|
4127
4220
|
end
|
4128
4221
|
private :unescape_content
|
4129
4222
|
|
@@ -4200,6 +4293,7 @@ module Meteor
|
|
4200
4293
|
def initialize_1(ps)
|
4201
4294
|
@root.document = String.new(ps.document)
|
4202
4295
|
@root.hook_document = String.new(ps.root_element.hook_document)
|
4296
|
+
@doc_type = ps.doc_type
|
4203
4297
|
end
|
4204
4298
|
private :initialize_1
|
4205
4299
|
|
@@ -4312,7 +4406,7 @@ module Meteor
|
|
4312
4406
|
# content.gsub!(@@pattern_and_2,AND_1)
|
4313
4407
|
# end
|
4314
4408
|
#else
|
4315
|
-
content.gsub
|
4409
|
+
content.gsub(@@pattern_unescape) do
|
4316
4410
|
case $1
|
4317
4411
|
when AND_3 then
|
4318
4412
|
AND_1
|
@@ -4328,7 +4422,7 @@ module Meteor
|
|
4328
4422
|
end
|
4329
4423
|
#end
|
4330
4424
|
|
4331
|
-
content
|
4425
|
+
#content
|
4332
4426
|
end
|
4333
4427
|
private :unescape
|
4334
4428
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asip-meteor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.2.
|
4
|
+
version: 0.9.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- asip
|
@@ -9,7 +9,7 @@ autorequire: meteor
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|