asip-meteor 0.9.0.3 → 0.9.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/meteor.rb +67 -64
- metadata +2 -2
data/lib/meteor.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
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.0.
|
21
|
+
# @version 0.9.0.4
|
22
22
|
#
|
23
23
|
if RUBY_VERSION < '1.9.0' then
|
24
24
|
require 'kconv'
|
@@ -27,7 +27,7 @@ end
|
|
27
27
|
|
28
28
|
module Meteor
|
29
29
|
|
30
|
-
VERSION = "0.9.0.
|
30
|
+
VERSION = "0.9.0.4"
|
31
31
|
|
32
32
|
#
|
33
33
|
# 要素クラス
|
@@ -1936,11 +1936,13 @@ module Meteor
|
|
1936
1936
|
#属性群の更新
|
1937
1937
|
editAttributes_(elm,attrName,attrValue)
|
1938
1938
|
|
1939
|
-
if elm.
|
1940
|
-
elm.arguments.
|
1939
|
+
if !elm.parent then
|
1940
|
+
if elm.arguments.map.include?(attrName) then
|
1941
|
+
elm.arguments.store(attrName, attrValue)
|
1942
|
+
end
|
1943
|
+
|
1944
|
+
@e_cache.store(elm.object_id, elm)
|
1941
1945
|
end
|
1942
|
-
|
1943
|
-
@e_cache.store(elm.object_id, elm)
|
1944
1946
|
end
|
1945
1947
|
end
|
1946
1948
|
private :setAttribute_3
|
@@ -1990,73 +1992,68 @@ module Meteor
|
|
1990
1992
|
private :editDocument_1
|
1991
1993
|
|
1992
1994
|
def editDocument_2(elm,closer)
|
1993
|
-
if !elm.
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
if elm.empty then
|
2000
|
-
#内容あり要素の場合
|
2001
|
-
@_content = elm.mixed_content
|
2002
|
-
#replace2Regex(@_content)
|
2003
|
-
if elm.parser.rootElement.hook || elm.parser.rootElement.monoHook then
|
2004
|
-
replace4Regex(@_content)
|
2005
|
-
else
|
2006
|
-
replace2Regex(@_content)
|
2007
|
-
end
|
2008
|
-
|
2009
|
-
#タグ検索用パターン
|
2010
|
-
@pattern = Meteor::Core::Util::PatternCache.get(elm.pattern)
|
2011
|
-
@root.document.sub!(@pattern,'' << TAG_OPEN << elm.name << @_attributes << TAG_CLOSE << @_content << TAG_OPEN3 << elm.name << TAG_CLOSE)
|
2012
|
-
#@root.document.sub!(@pattern,"<#{elm.name}#{@_attributes}>#{@_content}</#{elm.name}>")
|
2013
|
-
else
|
2014
|
-
#空要素の場合
|
2015
|
-
#タグ置換用パターン
|
2016
|
-
@pattern = Meteor::Core::Util::PatternCache.get(elm.pattern)
|
2017
|
-
@root.document.sub!(@pattern,'' << TAG_OPEN << elm.name << @_attributes << closer)
|
2018
|
-
end
|
2019
|
-
else
|
1995
|
+
if !elm.cx then
|
1996
|
+
@_attributes = elm.attributes
|
1997
|
+
replace2Regex(@_attributes)
|
1998
|
+
|
1999
|
+
if elm.empty then
|
2000
|
+
#内容あり要素の場合
|
2020
2001
|
@_content = elm.mixed_content
|
2002
|
+
#replace2Regex(@_content)
|
2021
2003
|
if elm.parser.rootElement.hook || elm.parser.rootElement.monoHook then
|
2022
2004
|
replace4Regex(@_content)
|
2023
2005
|
else
|
2024
2006
|
replace2Regex(@_content)
|
2025
2007
|
end
|
2026
2008
|
|
2009
|
+
#タグ検索用パターン
|
2027
2010
|
@pattern = Meteor::Core::Util::PatternCache.get(elm.pattern)
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
@
|
2011
|
+
@root.document.sub!(@pattern,'' << TAG_OPEN << elm.name << @_attributes << TAG_CLOSE << @_content << TAG_OPEN3 << elm.name << TAG_CLOSE)
|
2012
|
+
#@root.document.sub!(@pattern,"<#{elm.name}#{@_attributes}>#{@_content}</#{elm.name}>")
|
2013
|
+
else
|
2014
|
+
#空要素の場合
|
2015
|
+
#タグ置換用パターン
|
2016
|
+
@pattern = Meteor::Core::Util::PatternCache.get(elm.pattern)
|
2017
|
+
@root.document.sub!(@pattern,'' << TAG_OPEN << elm.name << @_attributes << closer)
|
2034
2018
|
end
|
2019
|
+
else
|
2020
|
+
@_content = elm.mixed_content
|
2021
|
+
if elm.parser.rootElement.hook || elm.parser.rootElement.monoHook then
|
2022
|
+
replace4Regex(@_content)
|
2023
|
+
else
|
2024
|
+
replace2Regex(@_content)
|
2025
|
+
end
|
2026
|
+
|
2027
|
+
@pattern = Meteor::Core::Util::PatternCache.get(elm.pattern)
|
2028
|
+
|
2029
|
+
#タグ置換
|
2030
|
+
@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2
|
2031
|
+
@pattern_cc << @_content << SET_CX_3 << elm.name << SET_CX_4
|
2032
|
+
#@pattern_cc = "<!-- @#{elm.name} #{elm.attributes}-->#{@_content}<!-- /@#{elm.name} -->"
|
2033
|
+
@root.document.sub!(@pattern,@pattern_cc)
|
2035
2034
|
end
|
2036
2035
|
end
|
2037
2036
|
private :editDocument_2
|
2038
2037
|
|
2039
2038
|
def editPattern_(elm)
|
2040
|
-
if !elm.parent then
|
2041
2039
|
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
end
|
2040
|
+
elm.arguments.map.each{ |name,attr|
|
2041
|
+
|
2042
|
+
if attr.changed then
|
2043
|
+
@_attrValue = escapeRegex(attr.value)
|
2044
|
+
#replace2Regex(@_attrValue)
|
2045
|
+
@pattern_cc = '' << name << SET_ATTR_1
|
2046
|
+
#@pattern_cc = "#{attrName}=\"[^\"]*\""
|
2047
|
+
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
2048
|
+
elm.pattern.gsub!(@pattern,'' << name << ATTR_EQ << @_attrValue << DOUBLE_QUATATION)
|
2049
|
+
#elm.pattern.sub!(@pattern,"#{attrName}=\"#{@_attrValue}\"")
|
2050
|
+
elsif attr.removed then
|
2051
|
+
@pattern_cc = '' << name << SET_ATTR_1
|
2052
|
+
#@pattern_cc = "#{attrName}=\"[^\"]*\""
|
2053
|
+
@pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
|
2054
|
+
elm.pattern.gsub!(@pattern,EMPTY)
|
2055
|
+
end
|
2056
|
+
}
|
2060
2057
|
end
|
2061
2058
|
private :editPattern_
|
2062
2059
|
|
@@ -2180,7 +2177,9 @@ module Meteor
|
|
2180
2177
|
end
|
2181
2178
|
}
|
2182
2179
|
|
2183
|
-
|
2180
|
+
if !elm.parent then
|
2181
|
+
@e_cache.store(elm.object_id,elm)
|
2182
|
+
end
|
2184
2183
|
end
|
2185
2184
|
end
|
2186
2185
|
private :setAttribute_2_m
|
@@ -2229,7 +2228,9 @@ module Meteor
|
|
2229
2228
|
|
2230
2229
|
elm.mixed_content = content
|
2231
2230
|
|
2232
|
-
|
2231
|
+
if !elm.parent then
|
2232
|
+
@e_cache.store(elm.object_id,elm)
|
2233
|
+
end
|
2233
2234
|
|
2234
2235
|
end
|
2235
2236
|
private :setContent_3
|
@@ -2308,11 +2309,13 @@ module Meteor
|
|
2308
2309
|
|
2309
2310
|
removeAttributes_(elm,attrName)
|
2310
2311
|
|
2311
|
-
if elm.
|
2312
|
-
elm.arguments.
|
2312
|
+
if !elm.parent then
|
2313
|
+
if elm.arguments.map.include?(attrName) then
|
2314
|
+
elm.arguments.delete(attrName)
|
2315
|
+
end
|
2316
|
+
|
2317
|
+
@e_cache.store(elm.object_id,elm)
|
2313
2318
|
end
|
2314
|
-
|
2315
|
-
@e_cache.store(elm.object_id,elm)
|
2316
2319
|
end
|
2317
2320
|
end
|
2318
2321
|
private :removeAttribute_2
|
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.0.
|
4
|
+
version: 0.9.0.4
|
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: 2008-10-
|
12
|
+
date: 2008-10-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|