xsv 1.0.0.pre → 1.0.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74b464996d0d55d48bce1400987079600f4e882eafd46006dc96e29879b6b67a
4
- data.tar.gz: cc6f2164a38f4e9de9e6bf7c82663d8658adaf8570731c6a0e80f7f2b3fb744f
3
+ metadata.gz: 2c7de4a72e380ca950dd3f076353c6e275d67314491216708ab2abe28ca1c3b2
4
+ data.tar.gz: 583a01b780ee1b95f9558d28f8700b885874822c133d5c17b4f3f2e94e0bb6e3
5
5
  SHA512:
6
- metadata.gz: 78d88c74b25547bfca47ce2974ae0f082628af93db97820fcbf830661b49bb5adf02f40a46bb2b07a0335ff4cd3f7803152d53e180a9f6e3355d9b229cda984f
7
- data.tar.gz: 2ec1290130c81899491661bf826df5637084648a73a2f9d8e4e9562739f3b7277c07efc27f8cb28019f60ec3d9d5c4940ad3bc5cfa17f71eb8dffe4bf1963d03
6
+ metadata.gz: 6a39ec94b6c3b34ce9367e9e4e2790bae830924b60a10938b54cc7c5f40749d2ebef29bfeaa9d7f9587c19c9cafdd6de9335b6aa8a8f9775dbff8632a867177d
7
+ data.tar.gz: 12967f46a655720dd2262ddaf1acd357d24a846e0160715e8652b116fa991a766250e55cd77ac69e85c315065e1d13458d04684f421524fc3978358c940a5868
@@ -1,5 +1,11 @@
1
1
  # Xsv Changelog
2
2
 
3
+ ## 1.0.0.pre.2 2021-01-22
4
+
5
+ - Reduce allocations in XML parser
6
+ - Return strings with the correct encoding
7
+ - Handle XML entities
8
+
3
9
  ## 1.0.0.pre 2021-01-18
4
10
 
5
11
  - Switch to a minimalistic XML parser in native Ruby (#21)
@@ -30,8 +30,18 @@ module Xsv
30
30
 
31
31
  if state == :look_start
32
32
  if (o = pbuf.index('<'))
33
- chars = pbuf.slice!(0, o + 1).chop!
34
- characters(chars) unless chars.empty? || !respond_to?(:characters)
33
+ chars = pbuf.slice!(0, o + 1).chop!.force_encoding('utf-8')
34
+
35
+ if respond_to?(:characters) && !chars.empty?
36
+ if chars.index('&')
37
+ chars.gsub!('&amp;', %q{&})
38
+ chars.gsub!('&apos;', %q{'})
39
+ chars.gsub!('&gt;', %q{>})
40
+ chars.gsub!('&lt;', %q{<})
41
+ chars.gsub!('&quot;', %q{"})
42
+ end
43
+ characters(chars)
44
+ end
35
45
 
36
46
  state = :look_end
37
47
  elsif eof_reached
@@ -46,7 +56,13 @@ module Xsv
46
56
 
47
57
  if state == :look_end
48
58
  if (o = pbuf.index('>'))
49
- tag_name, args = pbuf.slice!(0, o + 1).chop!.split(' ', 2)
59
+ if (s = pbuf.index(' ')) && s < o
60
+ tag_name = pbuf.slice!(0, s + 1).chop!
61
+ args = pbuf.slice!(0, o - s)
62
+ else
63
+ tag_name = pbuf.slice!(0, o + 1).chop!
64
+ args = nil
65
+ end
50
66
 
51
67
  if tag_name.start_with?('/')
52
68
  end_element(tag_name[1..-1]) if respond_to?(:end_element)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xsv
4
- VERSION = '1.0.0.pre'
4
+ VERSION = '1.0.0.pre.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre
4
+ version: 1.0.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martijn Storck
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -112,7 +112,7 @@ metadata:
112
112
  homepage_uri: https://github.com/martijn/xsv
113
113
  source_code_uri: https://github.com/martijn/xsv
114
114
  changelog_uri: https://github.com/martijn/xsv/CHANGELOG.md
115
- post_install_message:
115
+ post_install_message:
116
116
  rdoc_options: []
117
117
  require_paths:
118
118
  - lib
@@ -127,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: 1.3.1
129
129
  requirements: []
130
- rubygems_version: 3.1.2
131
- signing_key:
130
+ rubygems_version: 3.2.3
131
+ signing_key:
132
132
  specification_version: 4
133
133
  summary: A fast and lightweiggt xlsx parser that provides nothing a CSV parser wouldn't
134
134
  test_files: []