rmtools 2.3.4 → 2.3.5
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.
- checksums.yaml +4 -4
- data/README.md +5 -6
- data/lib/rmtools/version.rb +1 -1
- data/lib/rmtools/xml/string.rb +34 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f89fb064bdad91177d656c4ce69b064c7418b80
|
4
|
+
data.tar.gz: d548260567cfd5d51c58967dd7ee154d9d1bae82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c912ac5bbbaf5e3333d0bf2e7bfefe34852ba599e13d830130c4e179ab1f773dc7de797e91be3d93de00a9f07bd3647df6720fbdfd62caf1d53102fba21ccbd
|
7
|
+
data.tar.gz: a1e616a1043461150d5b918e411e668c2bb745121bb9c96edb6951c79daeac9b40d35c7b83811b09f0e65a9532b0d26cb5ca7f258f8c47caba05ecd5d55bff4d
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ It's still randomly documented since it's just my working tool.
|
|
27
27
|
|
28
28
|
### CHANGES
|
29
29
|
|
30
|
-
##### Version 2.3.
|
30
|
+
##### Version 2.3.5
|
31
31
|
|
32
32
|
* Ruby 2+ behaviour:
|
33
33
|
* Disabled C-extension
|
@@ -35,18 +35,17 @@ It's still randomly documented since it's just my working tool.
|
|
35
35
|
|
36
36
|
* String
|
37
37
|
* Updated #digit_date to parse full english month names
|
38
|
+
* #to_html and #to_xml make, respectively, html- and xml- formed documents by LibXML::XML
|
39
|
+
* #to_doc now is deprecated and is alias of #to_html
|
38
40
|
|
39
|
-
##### Version 2.2.
|
41
|
+
##### Version 2.2.5
|
40
42
|
|
41
43
|
* String
|
42
|
-
* Added #
|
44
|
+
* Added #fix_encoding! It differentiates only utf-8 and ansi-1251, though
|
43
45
|
|
44
46
|
* Range
|
45
47
|
* #include? never raises an exception
|
46
48
|
|
47
|
-
* Array/Set
|
48
|
-
* Added #is_subset_of?
|
49
|
-
|
50
49
|
##### Version 2.2.4
|
51
50
|
|
52
51
|
* Hash
|
data/lib/rmtools/version.rb
CHANGED
data/lib/rmtools/xml/string.rb
CHANGED
@@ -57,24 +57,49 @@ class String
|
|
57
57
|
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
60
|
+
def to_html(forceutf=nil)
|
61
61
|
str = b || "<html/>"
|
62
62
|
doc = if forceutf
|
63
|
-
XML::HTMLParser.string(str.xml_to_utf, :options => 97,
|
64
|
-
|
63
|
+
LibXML::XML::HTMLParser.string(str.xml_to_utf, :options => 97,
|
64
|
+
:encoding => LibXML::XML::Encoding::UTF_8).parse
|
65
65
|
else
|
66
66
|
begin
|
67
67
|
if RUBY_VERSION > '1.9'
|
68
|
-
XML::HTMLParser.string(str, :options => 97,
|
69
|
-
|
68
|
+
LibXML::XML::HTMLParser.string(str, :options => 97,
|
69
|
+
:encoding => LibXML::XML::Encoding.const_get(__ENCODING__.to_s.tr('-','_').to_sym)).parse
|
70
70
|
else
|
71
|
-
XML::HTMLParser.string(str, :options => 97).parse
|
71
|
+
LibXML::XML::HTMLParser.string(str, :options => 97).parse
|
72
72
|
end
|
73
73
|
rescue
|
74
74
|
if enc = xml_charset
|
75
|
-
XML::HTMLParser.string(str, :options => 97,
|
76
|
-
|
77
|
-
else
|
75
|
+
LibXML::XML::HTMLParser.string(str, :options => 97,
|
76
|
+
:encoding => LibXML::XML::Encoding.const_get(enc.upcase.tr('-','_').to_sym)).parse
|
77
|
+
else to_html :forceutf
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
doc.order_elements!
|
82
|
+
doc
|
83
|
+
end
|
84
|
+
alias :to_doc :to_html # DEPRECATED
|
85
|
+
|
86
|
+
def to_xml(forceutf=nil)
|
87
|
+
doc = if forceutf
|
88
|
+
LibXML::XML::Document.string(xml_to_utf, :options => 97,
|
89
|
+
:encoding => LibXML::XML::Encoding::UTF_8)
|
90
|
+
else
|
91
|
+
begin
|
92
|
+
if RUBY_VERSION > '1.9'
|
93
|
+
LibXML::XML::Document.string(self, :options => 97,
|
94
|
+
:encoding => LibXML::XML::Encoding.const_get(__ENCODING__.to_s.tr('-','_').to_sym))
|
95
|
+
else
|
96
|
+
LibXML::XML::Document.string(self, :options => 97)
|
97
|
+
end
|
98
|
+
rescue
|
99
|
+
if enc = xml_charset
|
100
|
+
LibXML::XML::Document.string(self, :options => 97,
|
101
|
+
:encoding => LibXML::XML::Encoding.const_get(enc.upcase.tr('-','_').to_sym))
|
102
|
+
else to_xml :forceutf
|
78
103
|
end
|
79
104
|
end
|
80
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Baev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|