asip-meteor 0.9.2.9 → 0.9.3.0
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 +69 -10
- 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.
|
21
|
+
# @version 0.9.3.0
|
22
22
|
#
|
23
23
|
|
24
24
|
module Meteor
|
25
25
|
|
26
|
-
VERSION = "0.9.
|
26
|
+
VERSION = "0.9.3.0"
|
27
27
|
|
28
28
|
RUBY_VERSION_1_9_0 = '1.9.0'
|
29
29
|
|
@@ -576,7 +576,7 @@ module Meteor
|
|
576
576
|
class ParserFactory
|
577
577
|
|
578
578
|
attr_accessor :base_dir
|
579
|
-
|
579
|
+
attr_accessor :base_encoding
|
580
580
|
|
581
581
|
#
|
582
582
|
# イニシャライザ
|
@@ -588,6 +588,8 @@ module Meteor
|
|
588
588
|
initialize_0
|
589
589
|
when 1 then
|
590
590
|
initialize_1(args[0])
|
591
|
+
when 2 then
|
592
|
+
initialize_2(args[0],args[1])
|
591
593
|
else
|
592
594
|
raise ArgumentError
|
593
595
|
end
|
@@ -598,7 +600,8 @@ module Meteor
|
|
598
600
|
#
|
599
601
|
def initialize_0
|
600
602
|
@cache = Hash.new
|
601
|
-
@base_dir =
|
603
|
+
@base_dir = '.'
|
604
|
+
@base_encoding = 'UTF-8'
|
602
605
|
end
|
603
606
|
private :initialize_0
|
604
607
|
|
@@ -609,9 +612,22 @@ module Meteor
|
|
609
612
|
def initialize_1(bs_dir)
|
610
613
|
@cache = Hash.new
|
611
614
|
@base_dir = bs_dir
|
615
|
+
@base_encoding = 'UTF-8'
|
612
616
|
end
|
613
617
|
private :initialize_1
|
614
618
|
|
619
|
+
#
|
620
|
+
# イニシャライザ
|
621
|
+
# @param [String] bs_dir 基準ディレクトリ
|
622
|
+
# @param [String] bs_encoding エンコーディング
|
623
|
+
#
|
624
|
+
def initialize_2(bs_dir,bs_encoding)
|
625
|
+
@cache = Hash.new
|
626
|
+
@base_dir = bs_dir
|
627
|
+
@base_encoding = bs_encoding
|
628
|
+
end
|
629
|
+
private :initialize_1
|
630
|
+
|
615
631
|
#
|
616
632
|
# パーサをセットする
|
617
633
|
#
|
@@ -620,11 +636,17 @@ module Meteor
|
|
620
636
|
case args.length
|
621
637
|
when 1 then
|
622
638
|
parser_1(args[0])
|
639
|
+
when 2 then
|
640
|
+
parser_2(args[0],args[1])
|
623
641
|
when 3 then
|
624
642
|
parser_3(args[0],args[1],args[2])
|
625
643
|
end
|
626
644
|
end
|
627
645
|
|
646
|
+
#
|
647
|
+
# パーサを取得する
|
648
|
+
# @param [String] name 名前
|
649
|
+
#
|
628
650
|
def parser_1(name)
|
629
651
|
@pif = @cache[name]
|
630
652
|
|
@@ -673,10 +695,47 @@ module Meteor
|
|
673
695
|
xml.doc_type = Parser::XML
|
674
696
|
@cache[relative_url] = xml
|
675
697
|
end
|
676
|
-
|
677
698
|
end
|
678
699
|
private :parser_3
|
679
700
|
|
701
|
+
#
|
702
|
+
# パーサをセットする
|
703
|
+
#
|
704
|
+
# @param [Fixnum] type パーサのタイプ
|
705
|
+
# @param [String] relative_path 相対ファイルパス
|
706
|
+
# @return [Meteor::ParserFactory] パーサファクトリ
|
707
|
+
#
|
708
|
+
def parser_2(type,relative_path)
|
709
|
+
|
710
|
+
paths = File.split(relative_path)
|
711
|
+
|
712
|
+
if '.'.eql?(paths[0]) then
|
713
|
+
relative_url = File.basename(paths[1],'.*')
|
714
|
+
else
|
715
|
+
relative_url = [paths[0],File.basename(paths[1],'.*')].join("/")
|
716
|
+
end
|
717
|
+
|
718
|
+
case type
|
719
|
+
when Parser::HTML then
|
720
|
+
html = Meteor::Core::Html::ParserImpl.new()
|
721
|
+
html.read(File.expand_path(relative_path,@base_dir), @base_encoding)
|
722
|
+
html.doc_type = Parser::HTML
|
723
|
+
@cache[relative_url] = html
|
724
|
+
when Parser::XHTML then
|
725
|
+
xhtml = Meteor::Core::Xhtml::ParserImpl.new()
|
726
|
+
xhtml.read(File.expand_path(relative_path,@base_dir), @base_encoding)
|
727
|
+
xhtml.doc_type = Parser::XHTML
|
728
|
+
@cache[relative_url] = xhtml
|
729
|
+
when Parser::XML then
|
730
|
+
xml = Meteor::Core::Xml::ParserImpl.new()
|
731
|
+
xml.read(File.expand_path(relative_path,@base_dir), @base_encoding)
|
732
|
+
xml.doc_type = Parser::XML
|
733
|
+
@cache[relative_url] = xml
|
734
|
+
end
|
735
|
+
|
736
|
+
end
|
737
|
+
private :parser_2
|
738
|
+
|
680
739
|
#
|
681
740
|
# パーサをセットする
|
682
741
|
#
|
@@ -2011,7 +2070,7 @@ module Meteor
|
|
2011
2070
|
#
|
2012
2071
|
def set_attribute_3(elm,attr_name,attr_value)
|
2013
2072
|
if !elm.cx then
|
2014
|
-
attr_value = escape(attr_value)
|
2073
|
+
attr_value = escape(attr_value.to_s)
|
2015
2074
|
#属性群の更新
|
2016
2075
|
edit_attributes_(elm,attr_name,attr_value)
|
2017
2076
|
|
@@ -3455,7 +3514,7 @@ module Meteor
|
|
3455
3514
|
|
3456
3515
|
def edit_attributes_5(elm,attr_name,attr_value,match_p,replace)
|
3457
3516
|
|
3458
|
-
if is_match(TRUE, attr_value) then
|
3517
|
+
if true.equal?(attr_value) || is_match(TRUE, attr_value) then
|
3459
3518
|
@res = match_p.match(elm.attributes)
|
3460
3519
|
|
3461
3520
|
if !@res then
|
@@ -3467,7 +3526,7 @@ module Meteor
|
|
3467
3526
|
elm.attributes << SPACE << attr_name
|
3468
3527
|
#else
|
3469
3528
|
end
|
3470
|
-
elsif is_match(FALSE, attr_value) then
|
3529
|
+
elsif false.equal?(attr_value) || is_match(FALSE, attr_value) then
|
3471
3530
|
elm.attributes.sub!(replace,EMPTY)
|
3472
3531
|
end
|
3473
3532
|
|
@@ -3995,7 +4054,7 @@ module Meteor
|
|
3995
4054
|
|
3996
4055
|
#attr_value = escape(attr_value)
|
3997
4056
|
|
3998
|
-
if is_match(TRUE,attr_value) then
|
4057
|
+
if true.equal?(attr_value) || is_match(TRUE,attr_value) then
|
3999
4058
|
|
4000
4059
|
@res = match_p.match(elm.attributes)
|
4001
4060
|
|
@@ -4010,7 +4069,7 @@ module Meteor
|
|
4010
4069
|
#属性の置換
|
4011
4070
|
elm.attributes.gsub!(replace_regex,replace_update)
|
4012
4071
|
end
|
4013
|
-
elsif is_match(FALSE,attr_value) then
|
4072
|
+
elsif false.equal?(attr_value) || is_match(FALSE,attr_value) then
|
4014
4073
|
#attr_name属性が存在するなら削除
|
4015
4074
|
#属性の置換
|
4016
4075
|
elm.attributes.gsub!(replace_regex, EMPTY)
|
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.
|
4
|
+
version: 0.9.3.0
|
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-
|
12
|
+
date: 2009-07-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|