asip-meteor 0.9.2.2 → 0.9.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/meteor.rb +136 -168
- 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.3
|
22
22
|
#
|
23
23
|
|
24
24
|
module Meteor
|
25
25
|
|
26
|
-
VERSION = "0.9.2.
|
26
|
+
VERSION = "0.9.2.3"
|
27
27
|
|
28
28
|
RUBY_VERSION_1_9_0 = '1.9.0'
|
29
29
|
|
@@ -119,6 +119,21 @@ module Meteor
|
|
119
119
|
end
|
120
120
|
private :initialize_e
|
121
121
|
|
122
|
+
attr_accessor :name
|
123
|
+
attr_accessor :attributes
|
124
|
+
attr_accessor :mixed_content
|
125
|
+
attr_accessor :pattern
|
126
|
+
attr_accessor :document
|
127
|
+
attr_accessor :empty
|
128
|
+
attr_accessor :cx
|
129
|
+
attr_accessor :mono
|
130
|
+
attr_accessor :parser
|
131
|
+
attr_accessor :type_value
|
132
|
+
attr_accessor :arguments
|
133
|
+
attr_accessor :usable
|
134
|
+
attr_accessor :origin
|
135
|
+
attr_accessor :copy
|
136
|
+
|
122
137
|
#
|
123
138
|
# コピーを作成する
|
124
139
|
# @param [Array] args 引数配列
|
@@ -165,21 +180,6 @@ module Meteor
|
|
165
180
|
end
|
166
181
|
end
|
167
182
|
|
168
|
-
attr_accessor :name
|
169
|
-
attr_accessor :attributes
|
170
|
-
attr_accessor :mixed_content
|
171
|
-
attr_accessor :pattern
|
172
|
-
attr_accessor :document
|
173
|
-
attr_accessor :empty
|
174
|
-
attr_accessor :cx
|
175
|
-
attr_accessor :mono
|
176
|
-
attr_accessor :parser
|
177
|
-
attr_accessor :type_value
|
178
|
-
attr_accessor :arguments
|
179
|
-
attr_accessor :usable
|
180
|
-
attr_accessor :origin
|
181
|
-
attr_accessor :copy
|
182
|
-
|
183
183
|
#
|
184
184
|
# 子要素を取得する
|
185
185
|
#
|
@@ -244,7 +244,8 @@ module Meteor
|
|
244
244
|
# @param [String] value 属性の値or内容
|
245
245
|
#
|
246
246
|
def []=(name,value)
|
247
|
-
if !name.kind_of?(String) ||
|
247
|
+
#if !name.kind_of?(String) || CONTENT_STR != name then
|
248
|
+
if CONTENT_STR != name then
|
248
249
|
attribute(name,value)
|
249
250
|
else
|
250
251
|
@parser.content(self,value)
|
@@ -258,7 +259,8 @@ module Meteor
|
|
258
259
|
# @return [String] 属性の値or内容
|
259
260
|
#
|
260
261
|
def [](name)
|
261
|
-
if !name.kind_of?(String) ||
|
262
|
+
#if !name.kind_of?(String) || CONTENT_STR != name then
|
263
|
+
if CONTENT_STR != name then
|
262
264
|
attribute(name)
|
263
265
|
else
|
264
266
|
content()
|
@@ -283,11 +285,7 @@ module Meteor
|
|
283
285
|
|
284
286
|
def print
|
285
287
|
@parser.print
|
286
|
-
end
|
287
|
-
|
288
|
-
#def flush
|
289
|
-
# @parser.flush
|
290
|
-
#end
|
288
|
+
end
|
291
289
|
|
292
290
|
#
|
293
291
|
# フッククラスの処理を実行する
|
@@ -433,7 +431,7 @@ module Meteor
|
|
433
431
|
# @param name 属性名
|
434
432
|
#
|
435
433
|
def delete(name)
|
436
|
-
if @map[name]
|
434
|
+
if @recordable && @map[name] then
|
437
435
|
@map[name].removed = true
|
438
436
|
@map[name].changed = false
|
439
437
|
end
|
@@ -1670,7 +1668,7 @@ module Meteor
|
|
1670
1668
|
@sbuf << @pattern_cc_1_2
|
1671
1669
|
end
|
1672
1670
|
|
1673
|
-
@cnt
|
1671
|
+
@cnt += 1
|
1674
1672
|
|
1675
1673
|
@position = @position2
|
1676
1674
|
else
|
@@ -1695,7 +1693,7 @@ module Meteor
|
|
1695
1693
|
@sbuf << @pattern_cc_1_2
|
1696
1694
|
end
|
1697
1695
|
|
1698
|
-
@cnt +=
|
1696
|
+
@cnt += 1
|
1699
1697
|
|
1700
1698
|
@position = @position2
|
1701
1699
|
end
|
@@ -1844,13 +1842,13 @@ module Meteor
|
|
1844
1842
|
#
|
1845
1843
|
def attribute(*args)
|
1846
1844
|
case args.length
|
1847
|
-
when ONE
|
1848
|
-
|
1845
|
+
#when ONE
|
1846
|
+
# get_attribute_value_1(args[0])
|
1849
1847
|
when TWO
|
1850
1848
|
if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String) then
|
1851
1849
|
get_attribute_value_2(args[0],args[1])
|
1852
|
-
elsif args[0].kind_of?(String) && args[1].kind_of?(String) then
|
1853
|
-
|
1850
|
+
#elsif args[0].kind_of?(String) && args[1].kind_of?(String) then
|
1851
|
+
# set_attribute_2(args[0],args[1])
|
1854
1852
|
elsif args[0].kind_of?(Meteor::Element) && args[1].kind_of?(Meteor::AttributeMap) then
|
1855
1853
|
set_attribute_2_m(args[0],args[1])
|
1856
1854
|
else
|
@@ -1993,19 +1991,19 @@ module Meteor
|
|
1993
1991
|
end
|
1994
1992
|
private :edit_pattern_
|
1995
1993
|
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
def set_attribute_2(attr_name,attr_value)
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
end
|
2008
|
-
private :set_attribute_2
|
1994
|
+
##
|
1995
|
+
## 要素の属性を編集する
|
1996
|
+
##
|
1997
|
+
## @param [String] attr_name 属性名
|
1998
|
+
## @param [String] attr_value 属性値
|
1999
|
+
##
|
2000
|
+
#def set_attribute_2(attr_name,attr_value)
|
2001
|
+
# if @root.element.origin then
|
2002
|
+
# set_attribute_3(@root.element, attr_name, attr_value)
|
2003
|
+
# end
|
2004
|
+
# @root.element
|
2005
|
+
#end
|
2006
|
+
#private :set_attribute_2
|
2009
2007
|
|
2010
2008
|
#
|
2011
2009
|
# 要素の属性値を取得する
|
@@ -2034,20 +2032,20 @@ module Meteor
|
|
2034
2032
|
end
|
2035
2033
|
private :get_attribute_value_
|
2036
2034
|
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
def get_attribute_value_1(attr_name)
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
end
|
2050
|
-
private :get_attribute_value_1
|
2035
|
+
##
|
2036
|
+
## 要素の属性値を取得する
|
2037
|
+
##
|
2038
|
+
## @param [String] attr_name 属性名
|
2039
|
+
## @return [String] 属性値
|
2040
|
+
##
|
2041
|
+
#def get_attribute_value_1(attr_name)
|
2042
|
+
# if @root.element then
|
2043
|
+
# get_attribute_value_2(@root.element, attr_name)
|
2044
|
+
# else
|
2045
|
+
# nil
|
2046
|
+
# end
|
2047
|
+
#end
|
2048
|
+
#private :get_attribute_value_1
|
2051
2049
|
|
2052
2050
|
#
|
2053
2051
|
# 属性マップを取得する
|
@@ -2127,19 +2125,22 @@ module Meteor
|
|
2127
2125
|
def content(*args)
|
2128
2126
|
case args.length
|
2129
2127
|
when ONE
|
2130
|
-
if args[0].kind_of?(Meteor::Element) then
|
2131
|
-
|
2132
|
-
elsif args[0].kind_of?(String) then
|
2133
|
-
|
2134
|
-
|
2128
|
+
#if args[0].kind_of?(Meteor::Element) then
|
2129
|
+
get_content_1(args[0])
|
2130
|
+
#elsif args[0].kind_of?(String) then
|
2131
|
+
# set_content_1(args[0])
|
2132
|
+
#else
|
2133
|
+
# raise ArgumentError
|
2134
|
+
#end
|
2135
2135
|
when TWO
|
2136
|
-
if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String) then
|
2137
|
-
|
2138
|
-
elsif args[0].kind_of?(String) && (args[1].
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2136
|
+
#if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String) then
|
2137
|
+
set_content_2_s(args[0],args[1])
|
2138
|
+
#elsif args[0].kind_of?(String) && (args[1].eql?(true) || args[1].eql?(false)) then
|
2139
|
+
##elsif args[0].kind_of?(String) && (args[1].kinf_of?(TrueClass) || args[1].kind_of?(FalseClass)) then
|
2140
|
+
# set_content_2_b(args[0],args[1])
|
2141
|
+
#else
|
2142
|
+
# raise ArgumentError
|
2143
|
+
#end
|
2143
2144
|
when THREE
|
2144
2145
|
set_content_3(args[0],args[1],args[2])
|
2145
2146
|
else
|
@@ -2157,11 +2158,9 @@ module Meteor
|
|
2157
2158
|
def set_content_3(elm,content,entity_ref=true)
|
2158
2159
|
|
2159
2160
|
if entity_ref then
|
2160
|
-
|
2161
|
-
end
|
2162
|
-
|
2161
|
+
escape_content(content,elm.name)
|
2162
|
+
end
|
2163
2163
|
elm.mixed_content = content
|
2164
|
-
|
2165
2164
|
elm
|
2166
2165
|
end
|
2167
2166
|
private :set_content_3
|
@@ -2173,36 +2172,38 @@ module Meteor
|
|
2173
2172
|
# @param [String] content 要素の内容
|
2174
2173
|
#
|
2175
2174
|
def set_content_2_s(elm,content)
|
2176
|
-
set_content_3(elm, content)
|
2175
|
+
#set_content_3(elm, content)
|
2176
|
+
elm.mixed_content = escape_content(content,elm.name)
|
2177
|
+
elm
|
2177
2178
|
end
|
2178
2179
|
private :set_content_2_s
|
2179
2180
|
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
def set_content_1(content)
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
end
|
2190
|
-
private :set_content_1
|
2181
|
+
##
|
2182
|
+
## 要素の内容を編集する
|
2183
|
+
##
|
2184
|
+
## @param [String] content 内容
|
2185
|
+
##
|
2186
|
+
#def set_content_1(content)
|
2187
|
+
# if @root.element && @root.element.mono then
|
2188
|
+
# set_content_2_s(@root.element, content)
|
2189
|
+
# end
|
2190
|
+
#end
|
2191
|
+
#private :set_content_1
|
2191
2192
|
|
2193
|
+
##
|
2194
|
+
## 要素の内容を編集する
|
2195
|
+
##
|
2196
|
+
## @param [String] content 内容
|
2197
|
+
## @param [TrueClass,FalseClass] entity_ref エンティティ参照フラグ
|
2198
|
+
##
|
2199
|
+
#def set_content_2_b(content,entity_ref)
|
2200
|
+
# if @root.element && @root.element.mono then
|
2201
|
+
# set_content_3(@root.element, content, entity_ref)
|
2202
|
+
# end
|
2192
2203
|
#
|
2193
|
-
#
|
2194
|
-
#
|
2195
|
-
#
|
2196
|
-
# @param [TrueClass,FalseClass] entity_ref エンティティ参照フラグ
|
2197
|
-
#
|
2198
|
-
def set_content_2_b(content,entity_ref)
|
2199
|
-
if @root.element && @root.element.mono then
|
2200
|
-
set_content_3(@root.element, content, entity_ref)
|
2201
|
-
end
|
2202
|
-
|
2203
|
-
@root.element
|
2204
|
-
end
|
2205
|
-
private :set_content_2_b
|
2204
|
+
# @root.element
|
2205
|
+
#end
|
2206
|
+
#private :set_content_2_b
|
2206
2207
|
|
2207
2208
|
def get_content_1(elm)
|
2208
2209
|
if !elm.cx then
|
@@ -2485,7 +2486,6 @@ module Meteor
|
|
2485
2486
|
|
2486
2487
|
pif2 = create(self)
|
2487
2488
|
|
2488
|
-
#@elm_ = Element.new(elm,pif2)
|
2489
2489
|
@elm_ = Element.new!(elm,pif2)
|
2490
2490
|
|
2491
2491
|
if !elm.mono then
|
@@ -2493,42 +2493,15 @@ module Meteor
|
|
2493
2493
|
else
|
2494
2494
|
pif2.root_element.document = String.new(elm.document)
|
2495
2495
|
end
|
2496
|
-
#pif2.root_element.element = @elm_
|
2497
2496
|
|
2498
2497
|
@elm_
|
2499
2498
|
end
|
2500
2499
|
end
|
2501
|
-
private :shadow
|
2502
|
-
|
2503
|
-
##
|
2504
|
-
## 子パーサを取得する
|
2505
|
-
##
|
2506
|
-
## @param [Meteor::Element] elm 要素
|
2507
|
-
## @return [Meteor::Parser] 子パーサ
|
2508
|
-
##
|
2509
|
-
#def child(elm)
|
2510
|
-
# if shadow(elm) then
|
2511
|
-
# @elm_.parser
|
2512
|
-
# end
|
2513
|
-
#end
|
2500
|
+
private :shadow
|
2514
2501
|
|
2515
2502
|
def set_mono_info(elm)
|
2516
2503
|
end
|
2517
|
-
private :set_mono_info
|
2518
|
-
|
2519
|
-
##
|
2520
|
-
## 反映する
|
2521
|
-
##
|
2522
|
-
#def flush
|
2523
|
-
# #if @root.element && @root.element.origin then
|
2524
|
-
# # ##@root.element.origin.parser.reflect
|
2525
|
-
# # ##@root.element.origin.parser.replace(@root.element.origin, @root.hook_document)
|
2526
|
-
# # ##puts "[aa]"
|
2527
|
-
# # ##puts @root.hook_document
|
2528
|
-
# # @root.element.origin.document = @root.hook_document
|
2529
|
-
# # @root.element.origin.name = EMPTY
|
2530
|
-
# #end
|
2531
|
-
#end
|
2504
|
+
private :set_mono_info
|
2532
2505
|
|
2533
2506
|
#
|
2534
2507
|
# フッククラスの処理を実行する
|
@@ -2620,19 +2593,9 @@ module Meteor
|
|
2620
2593
|
|
2621
2594
|
def is_match(regex,str)
|
2622
2595
|
if regex.kind_of?(Regexp) then
|
2623
|
-
|
2624
|
-
true
|
2625
|
-
else
|
2626
|
-
false
|
2627
|
-
end
|
2596
|
+
is_match_r(regex,str)
|
2628
2597
|
elsif regex.kind_of?(Array) then
|
2629
|
-
str
|
2630
|
-
regex.each do |item|
|
2631
|
-
if item.eql?(str) then
|
2632
|
-
return true
|
2633
|
-
end
|
2634
|
-
end
|
2635
|
-
return false
|
2598
|
+
is_match_a(regex,str)
|
2636
2599
|
elsif regex.kind_of?(String) then
|
2637
2600
|
if regex.eql?(str.downcase) then
|
2638
2601
|
true
|
@@ -2645,6 +2608,36 @@ module Meteor
|
|
2645
2608
|
end
|
2646
2609
|
private :is_match
|
2647
2610
|
|
2611
|
+
|
2612
|
+
def is_match_r(regex,str)
|
2613
|
+
if regex.match(str.downcase) then
|
2614
|
+
true
|
2615
|
+
else
|
2616
|
+
false
|
2617
|
+
end
|
2618
|
+
end
|
2619
|
+
private :is_match_r
|
2620
|
+
|
2621
|
+
def is_match_a(regex,str)
|
2622
|
+
str = str.downcase
|
2623
|
+
regex.each do |item|
|
2624
|
+
if item.eql?(str) then
|
2625
|
+
return true
|
2626
|
+
end
|
2627
|
+
end
|
2628
|
+
return false
|
2629
|
+
end
|
2630
|
+
private :is_match_a
|
2631
|
+
|
2632
|
+
def is_match_s(regex,str)
|
2633
|
+
if regex.match(str.downcase) then
|
2634
|
+
true
|
2635
|
+
else
|
2636
|
+
false
|
2637
|
+
end
|
2638
|
+
end
|
2639
|
+
private :is_match_s
|
2640
|
+
|
2648
2641
|
def create(pif)
|
2649
2642
|
if pif.instance_of?(Meteor::Core::Html::ParserImpl) then
|
2650
2643
|
pif = Meteor::Core::Html::ParserImpl.new
|
@@ -2659,31 +2652,6 @@ module Meteor
|
|
2659
2652
|
end
|
2660
2653
|
private :create
|
2661
2654
|
|
2662
|
-
##
|
2663
|
-
## 要素の属性or内容をセットする
|
2664
|
-
## @param [String] name 属性名
|
2665
|
-
## @param [String] value 属性値or内容
|
2666
|
-
##
|
2667
|
-
#def []=(name,value)
|
2668
|
-
# if !name.kind_of?(String)|| name != CONTENT_STR then
|
2669
|
-
# attribute(name,value)
|
2670
|
-
# else
|
2671
|
-
# content(value)
|
2672
|
-
# end
|
2673
|
-
#end
|
2674
|
-
#
|
2675
|
-
##
|
2676
|
-
## 要素の属性値or内容を取得する
|
2677
|
-
## @param [String] name 属性名
|
2678
|
-
## @return [String] 属性値or内容
|
2679
|
-
##
|
2680
|
-
#def [](name)
|
2681
|
-
# if !name.kind_of?(String)|| name != CONTENT_STR then
|
2682
|
-
# attribute(name)
|
2683
|
-
# else
|
2684
|
-
# content()
|
2685
|
-
# end
|
2686
|
-
#end
|
2687
2655
|
end
|
2688
2656
|
|
2689
2657
|
module Util
|
@@ -2767,7 +2735,7 @@ module Meteor
|
|
2767
2735
|
end
|
2768
2736
|
|
2769
2737
|
if RUBY_VERSION < RUBY_VERSION_1_9_0 then
|
2770
|
-
class OrderHash <Hash
|
2738
|
+
class OrderHash < Hash
|
2771
2739
|
|
2772
2740
|
def initialize
|
2773
2741
|
@keys = Array.new
|
@@ -3417,7 +3385,7 @@ module Meteor
|
|
3417
3385
|
elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name) then
|
3418
3386
|
get_attribute_value_2_r(elm,@@pattern_disabled_m)
|
3419
3387
|
#get_attribute_value_2_r(elm,DISABLED_M)
|
3420
|
-
elsif is_match(CHECKED, attr_name) &&
|
3388
|
+
elsif is_match(CHECKED, attr_name) && is_match_S(INPUT,elm.name) && is_match_S(RADIO, get_type(elm)) then
|
3421
3389
|
get_attribute_value_2_r(elm,@@pattern_checked_m)
|
3422
3390
|
#get_attribute_value_2_r(elm,CHECKED_M)
|
3423
3391
|
elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA,elm.name) || (is_match(INPUT,elm.name) && is_match(READONLY_TYPE, get_type(elm)))) then
|
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.3
|
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-06-
|
12
|
+
date: 2009-06-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|