asip-meteor 0.9.2.6 → 0.9.2.7

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.
Files changed (2) hide show
  1. data/lib/meteor.rb +43 -142
  2. 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.6
21
+ # @version 0.9.2.7
22
22
  #
23
23
 
24
24
  module Meteor
25
25
 
26
- VERSION = "0.9.2.6"
26
+ VERSION = "0.9.2.7"
27
27
 
28
28
  RUBY_VERSION_1_9_0 = '1.9.0'
29
29
 
@@ -2066,21 +2066,7 @@ module Meteor
2066
2066
  # end
2067
2067
  # end
2068
2068
  #end
2069
- #private :edit_pattern_
2070
-
2071
- ##
2072
- ## 要素の属性を編集する
2073
- ##
2074
- ## @param [String] attr_name 属性名
2075
- ## @param [String] attr_value 属性値
2076
- ##
2077
- #def set_attribute_2(attr_name,attr_value)
2078
- # if @root.element.origin then
2079
- # set_attribute_3(@root.element, attr_name, attr_value)
2080
- # end
2081
- # @root.element
2082
- #end
2083
- #private :set_attribute_2
2069
+ #private :edit_pattern_
2084
2070
 
2085
2071
  #
2086
2072
  # 要素の属性値を取得する
@@ -2107,22 +2093,7 @@ module Meteor
2107
2093
  nil
2108
2094
  end
2109
2095
  end
2110
- private :get_attribute_value_
2111
-
2112
- ##
2113
- ## 要素の属性値を取得する
2114
- ##
2115
- ## @param [String] attr_name 属性名
2116
- ## @return [String] 属性値
2117
- ##
2118
- #def get_attribute_value_1(attr_name)
2119
- # if @root.element then
2120
- # get_attribute_value_2(@root.element, attr_name)
2121
- # else
2122
- # nil
2123
- # end
2124
- #end
2125
- #private :get_attribute_value_1
2096
+ private :get_attribute_value_
2126
2097
 
2127
2098
  #
2128
2099
  # 属性マップを取得する
@@ -2131,9 +2102,7 @@ module Meteor
2131
2102
  # @return [Meteor::AttributeMap] 属性マップ
2132
2103
  #
2133
2104
  def attribute_map(*args)
2134
- case args.length
2135
- when ZERO
2136
- get_attribute_map_0
2105
+ case args.length
2137
2106
  when ONE
2138
2107
  get_attribute_map_1(args[0])
2139
2108
  else
@@ -2157,21 +2126,7 @@ module Meteor
2157
2126
 
2158
2127
  attrs
2159
2128
  end
2160
- private :get_attribute_map_1
2161
-
2162
- #
2163
- # 要素の属性マップを取得する
2164
- #
2165
- # @return [Meteor::AttributeMap] 属性マップ
2166
- #
2167
- def get_attribute_map_0()
2168
- if @root.element then
2169
- get_attribute_map_1(@root.element)
2170
- else
2171
- nil
2172
- end
2173
- end
2174
- private :get_attribute_map_0
2129
+ private :get_attribute_map_1
2175
2130
 
2176
2131
  #
2177
2132
  # 要素の属性を編集する
@@ -2204,21 +2159,16 @@ module Meteor
2204
2159
  when ONE
2205
2160
  #if args[0].kind_of?(Meteor::Element) then
2206
2161
  get_content_1(args[0])
2207
- #elsif args[0].kind_of?(String) then
2208
- # set_content_1(args[0])
2209
- #else
2210
- # raise ArgumentError
2211
- #end
2162
+ #else
2163
+ # raise ArgumentError
2164
+ #end
2212
2165
  when TWO
2213
2166
  #if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String) then
2214
2167
  args[0].document_sync = true
2215
- set_content_2_s(args[0],args[1])
2216
- #elsif args[0].kind_of?(String) && (args[1].eql?(true) || args[1].eql?(false)) then
2217
- ##elsif args[0].kind_of?(String) && (args[1].kinf_of?(TrueClass) || args[1].kind_of?(FalseClass)) then
2218
- # set_content_2_b(args[0],args[1])
2219
- #else
2220
- # raise ArgumentError
2221
- #end
2168
+ set_content_2_s(args[0],args[1])
2169
+ #else
2170
+ # raise ArgumentError
2171
+ #end
2222
2172
  when THREE
2223
2173
  args[0].document_sync = true
2224
2174
  set_content_3(args[0],args[1],args[2])
@@ -2237,7 +2187,7 @@ module Meteor
2237
2187
  def set_content_3(elm,content,entity_ref=true)
2238
2188
 
2239
2189
  if entity_ref then
2240
- escape_content(content,elm.name)
2190
+ escape_content(content,elm)
2241
2191
  end
2242
2192
  elm.mixed_content = content
2243
2193
  elm
@@ -2252,47 +2202,25 @@ module Meteor
2252
2202
  #
2253
2203
  def set_content_2_s(elm,content)
2254
2204
  #set_content_3(elm, content)
2255
- elm.mixed_content = escape_content(content,elm.name)
2205
+ elm.mixed_content = escape_content(content,elm)
2256
2206
  elm
2257
2207
  end
2258
2208
  private :set_content_2_s
2259
2209
 
2260
- ##
2261
- ## 要素の内容を編集する
2262
- ##
2263
- ## @param [String] content 内容
2264
- ##
2265
- #def set_content_1(content)
2266
- # if @root.element && @root.element.mono then
2267
- # set_content_2_s(@root.element, content)
2268
- # end
2269
- #end
2270
- #private :set_content_1
2271
-
2272
- ##
2273
- ## 要素の内容を編集する
2274
- ##
2275
- ## @param [String] content 内容
2276
- ## @param [TrueClass,FalseClass] entity_ref エンティティ参照フラグ
2277
- ##
2278
- #def set_content_2_b(content,entity_ref)
2279
- # if @root.element && @root.element.mono then
2280
- # set_content_3(@root.element, content, entity_ref)
2281
- # end
2282
2210
  #
2283
- # @root.element
2284
- #end
2285
- #private :set_content_2_b
2286
-
2211
+ # 要素の内容を取得する
2212
+ #
2213
+ # @param [Meteor::Element] elm 要素
2214
+ #
2287
2215
  def get_content_1(elm)
2288
2216
  if !elm.cx then
2289
2217
  if elm.empty then
2290
- unescape_content(elm.mixed_content,elm.name)
2218
+ unescape_content(elm.mixed_content,elm)
2291
2219
  else
2292
2220
  nil
2293
2221
  end
2294
2222
  else
2295
- unescape_content(elm.mixed_content,elm.name)
2223
+ unescape_content(elm.mixed_content,elm)
2296
2224
  end
2297
2225
  end
2298
2226
  private :get_content_1
@@ -2343,21 +2271,7 @@ module Meteor
2343
2271
  #属性の置換
2344
2272
  elm.attributes.sub!(@pattern,EMPTY)
2345
2273
  end
2346
- private :remove_attributes_
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
2357
- #
2358
- # @root.element
2359
- #end
2360
- #private :remove_attribute_1
2274
+ private :remove_attributes_
2361
2275
 
2362
2276
  #
2363
2277
  # 要素を消す
@@ -2484,7 +2398,6 @@ module Meteor
2484
2398
  @element_cache.values.each do |item|
2485
2399
  if item.usable then
2486
2400
  #puts "#{item.name}:#{item.document}"
2487
- #if item.name == EMPTY then
2488
2401
  if item.copy then
2489
2402
  #item.document = item.copy.parser.root_element.hook_document
2490
2403
  @pattern = Meteor::Core::Util::PatternCache.get(item.pattern)
@@ -2516,17 +2429,13 @@ module Meteor
2516
2429
  #@root.hookDocument << @root.element.mixed_content << SET_CX_3
2517
2430
  #@root.hookDocument << @root.element.name << SET_CX_4
2518
2431
  @root.hook_document << "<!-- @#{@root.element.name} #{@root.element.attributes}-->#{@root.element.mixed_content}<!-- /@#{@root.element.name} -->"
2519
- #@root.hook_document << @root.document
2520
2432
  else
2521
2433
  #@root.hookDocument << TAG_OPEN << @root.element.name
2522
2434
  #@root.hookDocument << @root.element.attributes << TAG_CLOSE << @root.element.mixed_content
2523
2435
  #@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
2524
2436
  @root.hook_document << "<#{@root.element.name}#{@root.element.attributes}>#{@root.element.mixed_content}</#{@root.element.name}>"
2525
- #@root.hook_document << @root.document
2526
2437
  end
2527
- #@root.hook_document << @root.document
2528
2438
  @root.element = Element.new!(@root.element.origin,self)
2529
- #@root.document = String.new(@root.element.document)
2530
2439
  else
2531
2440
  reflect
2532
2441
  @_attributes = @root.element.attributes
@@ -2545,8 +2454,6 @@ module Meteor
2545
2454
  end
2546
2455
  @root.element = Element.new!(@root.element.origin,self)
2547
2456
  end
2548
- #@root.element.origin.document = @root.hook_document
2549
- #@root.element.origin.name = EMPTY
2550
2457
  else
2551
2458
  reflect
2552
2459
  @element_cache.clear
@@ -2657,10 +2564,10 @@ module Meteor
2657
2564
 
2658
2565
  #
2659
2566
  # @param [String] content 入力文字列
2660
- # @param [String] elm_name 要素名
2567
+ # @param [String] elm 要素
2661
2568
  # @return [String] 出力文字列
2662
2569
  #
2663
- def escape_content(content,elm_name)
2570
+ def escape_content(content,elm)
2664
2571
  content
2665
2572
  end
2666
2573
  private :escape_content
@@ -2676,10 +2583,10 @@ module Meteor
2676
2583
 
2677
2584
  #
2678
2585
  # @param [String] content 入力文字列
2679
- # @param [String] elm_name 要素名
2586
+ # @param [String] elm 要素
2680
2587
  # @return [String] 出力文字列
2681
2588
  #
2682
- def unescape_content(content,elm_name)
2589
+ def unescape_content(content,elm)
2683
2590
  content
2684
2591
  end
2685
2592
  private :unescape_content
@@ -3018,6 +2925,8 @@ module Meteor
3018
2925
  '<' => '&lt;',
3019
2926
  '>' => '&gt;',
3020
2927
  ' ' => '&nbsp;',
2928
+ "\r\n" => '<br>',
2929
+ "\r" => '<br>',
3021
2930
  "\n" => '<br>',
3022
2931
  }
3023
2932
 
@@ -3084,8 +2993,6 @@ module Meteor
3084
2993
  def initialize_1(ps)
3085
2994
  @root.document = String.new(ps.document)
3086
2995
  @root.hook_document = String.new(ps.root_element.hook_document)
3087
- #@root.hook = ps.root_element.hook
3088
- #@root.mono_hook = ps.root_element.mono_hook
3089
2996
  @root.content_type = String.new(ps.content_type);
3090
2997
  @root.kaigyo_code = ps.root_element.kaigyo_code
3091
2998
  @doc_type = ps.doc_type
@@ -3582,7 +3489,6 @@ module Meteor
3582
3489
  elm.document = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE
3583
3490
  end
3584
3491
  end
3585
- #elm.document = @pattern_cc
3586
3492
  end
3587
3493
  end
3588
3494
  private :set_mono_info
@@ -3617,11 +3523,11 @@ module Meteor
3617
3523
  end
3618
3524
  private :escape
3619
3525
 
3620
- def escape_content(content,elm_name)
3526
+ def escape_content(content,elm)
3621
3527
  if RUBY_VERSION < RUBY_VERSION_1_9_0 then
3622
3528
  content = escape(content)
3623
3529
 
3624
- if !is_match(MATCH_TAG_2,elm_name) then
3530
+ if elm.cx || !is_match(MATCH_TAG_2,elm.name) then
3625
3531
  #「¥r?¥n」->「<br>」
3626
3532
  content.gsub!(@@pattern_br_1, BR_2)
3627
3533
  end
@@ -3671,14 +3577,13 @@ module Meteor
3671
3577
  SPACE
3672
3578
  end
3673
3579
  end
3674
-
3675
3580
  end
3676
3581
  private :unescape
3677
3582
 
3678
- def unescape_content(content,elm_name)
3583
+ def unescape_content(content,elm)
3679
3584
  content_ = unescape(content)
3680
3585
 
3681
- if !is_match(MATCH_TAG_2,elm_name) then
3586
+ if elm.cx || !is_match(MATCH_TAG_2,elm.name) then
3682
3587
  #「<br>」->「¥r?¥n」
3683
3588
  if content.include?(BR_2) then
3684
3589
  content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
@@ -3806,6 +3711,8 @@ module Meteor
3806
3711
  '<' => '&lt;',
3807
3712
  '>' => '&gt;',
3808
3713
  ' ' => '&nbsp;',
3714
+ "\r\n" => '<br/>',
3715
+ "\r" => '<br/>',
3809
3716
  "\n" => '<br/>',
3810
3717
  }
3811
3718
 
@@ -4107,7 +4014,6 @@ module Meteor
4107
4014
  elm.document = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE3
4108
4015
  end
4109
4016
  end
4110
- #elm.document = @pattern_cc
4111
4017
  end
4112
4018
  end
4113
4019
  private :set_mono_info
@@ -4147,12 +4053,12 @@ module Meteor
4147
4053
  end
4148
4054
  private :escape
4149
4055
 
4150
- def escape_content(content,elm_name)
4056
+ def escape_content(content,elm)
4151
4057
 
4152
4058
  if RUBY_VERSION < RUBY_VERSION_1_9_0 then
4153
4059
  content = escape(content)
4154
4060
 
4155
- if !is_match(MATCH_TAG_2,elm_name) then
4061
+ if elm.cx || !is_match(MATCH_TAG_2,elm.name) then
4156
4062
  #「¥r?¥n」->「<br>」
4157
4063
  content.gsub!(@@pattern_br_1, BR_2)
4158
4064
  end
@@ -4201,15 +4107,13 @@ module Meteor
4201
4107
  SPACE
4202
4108
  end
4203
4109
  end
4204
-
4205
- #content
4206
4110
  end
4207
4111
  private :unescape
4208
4112
 
4209
- def unescape_content(content,elm_name)
4113
+ def unescape_content(content,elm)
4210
4114
  content_ = unescape(content)
4211
4115
 
4212
- if !is_match(MATCH_TAG_2,elm_name) then
4116
+ if elm.cx || !is_match(MATCH_TAG_2,elm.name) then
4213
4117
  #「<br>」->「¥r?¥n」
4214
4118
  if content.include?(BR_2) then
4215
4119
  content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
@@ -4332,16 +4236,15 @@ module Meteor
4332
4236
  elm.mono = true
4333
4237
  if elm.cx then
4334
4238
  #@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
4335
- @pattern_cc = "<!-- @#{elm.name} #{elm.attributes} -->#{elm.mixed_content}<!-- /@#{elm.name} -->"
4239
+ elm.document = "<!-- @#{elm.name} #{elm.attributes} -->#{elm.mixed_content}<!-- /@#{elm.name} -->"
4336
4240
  else
4337
4241
  if elm.empty then
4338
4242
  #@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
4339
- @pattern_cc = "<#{elm.name}#{elm.attributes}>#{elm.mixed_content}</#{elm.name}>"
4243
+ elm.document = "<#{elm.name}#{elm.attributes}>#{elm.mixed_content}</#{elm.name}>"
4340
4244
  else
4341
- @pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE3
4245
+ elm.document = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE3
4342
4246
  end
4343
4247
  end
4344
- elm.document = @pattern_cc
4345
4248
  end
4346
4249
  end
4347
4250
  private :set_mono_info
@@ -4377,7 +4280,7 @@ module Meteor
4377
4280
  end
4378
4281
  private :escape
4379
4282
 
4380
- def escape_content(content,elm_name)
4283
+ def escape_content(content,elm)
4381
4284
  escape(content)
4382
4285
  end
4383
4286
  private :escape_content
@@ -4421,12 +4324,10 @@ module Meteor
4421
4324
  end
4422
4325
  end
4423
4326
  #end
4424
-
4425
- #content
4426
4327
  end
4427
4328
  private :unescape
4428
4329
 
4429
- def unescape_content(content,elm_name)
4330
+ def unescape_content(content,elm)
4430
4331
  unescape(content)
4431
4332
  end
4432
4333
  private :unescape_content
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.6
4
+ version: 0.9.2.7
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-07-04 00:00:00 -07:00
12
+ date: 2009-07-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15