write_xlsx 0.85.7 → 0.85.8
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 +5 -5
- data/Changes +3 -0
- data/lib/write_xlsx/format.rb +2 -3
- data/lib/write_xlsx/package/xml_writer_simple.rb +5 -5
- data/lib/write_xlsx/utility.rb +3 -1
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +4 -2
- data/lib/write_xlsx/worksheet.rb +6 -5
- data/lib/write_xlsx/worksheet/cell_data.rb +3 -1
- data/lib/write_xlsx/worksheet/hyperlink.rb +2 -2
- data/test/test_xml_writer_simple.rb +3 -3
- metadata +3 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1a8ed1e139d973baf49fc349d874da19de256e10ac34f2b4f5a08ec6dcac1eba
|
4
|
+
data.tar.gz: a553667cbe7443f9c9bbfc74d28a9a30e830c95dec213e2d70ca48862bb0505a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4e891ca22e53564f6a715aca9efce06c19782a4274d71ddb485b2bc34f1bf4f11a5f70b736b5fd4f23d74b47e68235c8ef4781fd3c014cad7cbf7c07501963
|
7
|
+
data.tar.gz: e262a4b65b0da4703894ab831f36a1058dcae5d71d103d7f83c313c0ada4e30db534eaabc3273b4c784c1b06d14de4730506b142ea49c8dc32c283339604f0c3
|
data/Changes
CHANGED
data/lib/write_xlsx/format.rb
CHANGED
@@ -287,11 +287,10 @@ def set_format_properties(*properties) # :nodoc:
|
|
287
287
|
|
288
288
|
# Create a sub to set the property.
|
289
289
|
if value.respond_to?(:to_str) || !value.respond_to?(:+)
|
290
|
-
|
290
|
+
send("set_#{key}", value.to_s)
|
291
291
|
else
|
292
|
-
|
292
|
+
send("set_#{key}", value)
|
293
293
|
end
|
294
|
-
eval s
|
295
294
|
end
|
296
295
|
end
|
297
296
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
#
|
3
4
|
# XMLWriterSimple
|
4
5
|
#
|
@@ -29,10 +30,9 @@ def tag_elements(tag, attributes = [])
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def tag_elements_str(tag, attributes = [])
|
32
|
-
str =
|
33
|
-
|
34
|
-
|
35
|
-
str << end_tag_str(tag)
|
33
|
+
str = start_tag_str(tag, attributes) +
|
34
|
+
yield +
|
35
|
+
end_tag_str(tag)
|
36
36
|
end
|
37
37
|
|
38
38
|
def start_tag(tag, attr = [])
|
@@ -65,7 +65,7 @@ def empty_tag_encoded_str(tag, attr = [])
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def data_element(tag, data, attr = [])
|
68
|
-
tag_elements(tag, attr) { io_write(
|
68
|
+
tag_elements(tag, attr) { io_write(escape_data(data)) }
|
69
69
|
end
|
70
70
|
|
71
71
|
#
|
data/lib/write_xlsx/utility.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'write_xlsx/col_name'
|
3
4
|
|
4
5
|
module Writexlsx
|
@@ -303,11 +304,12 @@ def write_color(writer, name, value) #:nodoc:
|
|
303
304
|
writer.empty_tag('color', attributes)
|
304
305
|
end
|
305
306
|
|
307
|
+
PERL_TRUE_VALUES = [false, nil, 0, "0", "", [], {}].freeze
|
306
308
|
#
|
307
309
|
# return perl's boolean result
|
308
310
|
#
|
309
311
|
def ptrue?(value)
|
310
|
-
if
|
312
|
+
if PERL_TRUE_VALUES.include?(value)
|
311
313
|
false
|
312
314
|
else
|
313
315
|
true
|
data/lib/write_xlsx/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
WriteXLSX_VERSION = "0.85.
|
1
|
+
WriteXLSX_VERSION = "0.85.8"
|
data/lib/write_xlsx/workbook.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'write_xlsx/package/xml_writer_simple'
|
3
4
|
require 'write_xlsx/package/packager'
|
4
5
|
require 'write_xlsx/sheets'
|
@@ -972,8 +973,9 @@ def date_1904? #:nodoc:
|
|
972
973
|
# Add a string to the shared string table, if it isn't already there, and
|
973
974
|
# return the string index.
|
974
975
|
#
|
975
|
-
|
976
|
-
|
976
|
+
EMPTY_HASH = {}.freeze
|
977
|
+
def shared_string_index(str) #:nodoc:
|
978
|
+
@shared_strings.index(str, EMPTY_HASH)
|
977
979
|
end
|
978
980
|
|
979
981
|
def str_unique # :nodoc:
|
data/lib/write_xlsx/worksheet.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'write_xlsx/package/xml_writer_simple'
|
3
4
|
require 'write_xlsx/package/button'
|
4
5
|
require 'write_xlsx/colors'
|
@@ -2188,7 +2189,7 @@ def write_comment(*args)
|
|
2188
2189
|
def write_number(*args)
|
2189
2190
|
# Check for a cell reference in A1 notation and substitute row and column
|
2190
2191
|
row, col, num, xf = row_col_notation(args)
|
2191
|
-
raise WriteXLSXInsufficientArgumentError if
|
2192
|
+
raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? || num.nil?
|
2192
2193
|
|
2193
2194
|
# Check that row and col are valid and store max and min values
|
2194
2195
|
check_dimensions(row, col)
|
@@ -2230,13 +2231,13 @@ def write_string(*args)
|
|
2230
2231
|
# Check for a cell reference in A1 notation and substitute row and column
|
2231
2232
|
row, col, str, xf = row_col_notation(args)
|
2232
2233
|
str &&= str.to_s
|
2233
|
-
raise WriteXLSXInsufficientArgumentError if
|
2234
|
+
raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? || str.nil?
|
2234
2235
|
|
2235
2236
|
# Check that row and col are valid and store max and min values
|
2236
2237
|
check_dimensions(row, col)
|
2237
2238
|
store_row_col_max_min_values(row, col)
|
2238
2239
|
|
2239
|
-
index = shared_string_index(str[0, STR_MAX])
|
2240
|
+
index = shared_string_index(str.length > STR_MAX ? str[0, STR_MAX] : str)
|
2240
2241
|
|
2241
2242
|
store_data_to_table(StringCellData.new(self, row, col, index, xf))
|
2242
2243
|
end
|
@@ -7510,8 +7511,8 @@ def calc_spans(data, row_num, span_min, span_max)
|
|
7510
7511
|
# Add a string to the shared string table, if it isn't already there, and
|
7511
7512
|
# return the string index.
|
7512
7513
|
#
|
7513
|
-
def shared_string_index(str
|
7514
|
-
@workbook.shared_string_index(str
|
7514
|
+
def shared_string_index(str) #:nodoc:
|
7515
|
+
@workbook.shared_string_index(str)
|
7515
7516
|
end
|
7516
7517
|
|
7517
7518
|
#
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Writexlsx
|
4
5
|
class Worksheet
|
@@ -63,9 +64,10 @@ def data
|
|
63
64
|
{ :sst_id => token }
|
64
65
|
end
|
65
66
|
|
67
|
+
TYPE_STR_ATTRS = ['t', 's'].freeze
|
66
68
|
def write_cell
|
67
69
|
attributes = cell_attributes
|
68
|
-
attributes <<
|
70
|
+
attributes << TYPE_STR_ATTRS
|
69
71
|
@worksheet.writer.tag_elements('c', attributes) do
|
70
72
|
@worksheet.write_cell_value(token)
|
71
73
|
end
|
@@ -24,7 +24,7 @@ def initialize(url, str, tip)
|
|
24
24
|
str ||= url.dup
|
25
25
|
|
26
26
|
# Strip the mailto header.
|
27
|
-
str.sub
|
27
|
+
normalized_str = str.sub(/^mailto:/, '')
|
28
28
|
|
29
29
|
# Escape URL unless it looks already escaped.
|
30
30
|
url = escape_url(url)
|
@@ -35,7 +35,7 @@ def initialize(url, str, tip)
|
|
35
35
|
end
|
36
36
|
|
37
37
|
@url = url
|
38
|
-
@str =
|
38
|
+
@str = normalized_str
|
39
39
|
@url_str = nil
|
40
40
|
@tip = tip
|
41
41
|
end
|
@@ -23,11 +23,11 @@ def test_empty_tag_with_xml_decl
|
|
23
23
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
24
24
|
<foo/>
|
25
25
|
EOS
|
26
|
-
assert_equal(expected, @obj.xml_decl
|
26
|
+
assert_equal(expected, @obj.xml_decl + @obj.empty_tag('foo') + "\n")
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_start_end_tag
|
30
|
-
assert_equal("<foo></foo>", @obj.start_tag('foo')
|
30
|
+
assert_equal("<foo></foo>", @obj.start_tag('foo') + @obj.end_tag('foo'))
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_attribute
|
@@ -39,7 +39,7 @@ def test_attribute
|
|
39
39
|
def test_character_data
|
40
40
|
assert_equal(
|
41
41
|
"<foo><tag>&amp;</tag></foo>",
|
42
|
-
@obj.start_tag('foo')
|
42
|
+
@obj.start_tag('foo') + @obj.characters("<tag>&</tag>") + @obj.end_tag('foo')
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: write_xlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.85.
|
4
|
+
version: 0.85.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -1709,8 +1709,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1709
1709
|
- !ruby/object:Gem::Version
|
1710
1710
|
version: '0'
|
1711
1711
|
requirements: []
|
1712
|
-
|
1713
|
-
rubygems_version: 2.6.8
|
1712
|
+
rubygems_version: 3.0.3
|
1714
1713
|
signing_key:
|
1715
1714
|
specification_version: 4
|
1716
1715
|
summary: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
|
@@ -3201,4 +3200,3 @@ test_files:
|
|
3201
3200
|
- test/worksheet/test_write_tab_color.rb
|
3202
3201
|
- test/worksheet/test_write_url.rb
|
3203
3202
|
- test/worksheet/test_write_worksheet_attributes.rb
|
3204
|
-
has_rdoc:
|