caxlsx 3.4.0 → 3.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b169fe36651a9f3937c0a0b11226ce2ebaf8527d1c358247a3fd0ea0ec581af
4
- data.tar.gz: 5fccec296a8485fc58dd0705e356beb7bb9e539f56f6cff3aadf289b4c73740d
3
+ metadata.gz: 0bc64f23079fdbb6084190c180942bdf850ef2a0f0e6e75e68b3c9f63bcb6a2b
4
+ data.tar.gz: 389bd6a8434de5942a54d47c2fafd4b407fead102ef0186d6f180879689c9a96
5
5
  SHA512:
6
- metadata.gz: 8b1b16e2f613d33d67c18fbcb1690d40efe21557bc9e1629aa6dd8c2c88b04f31ef928f888b1d254bd0f35a399f62526c420609b1611163591f47d0b1dadd1ed
7
- data.tar.gz: f421c3b215ea313e233487b7d50cb61d5041585301a456ec5c04304b3b425ba47be80e6c3b56fa1e2684c8ca894cb79eed85c10ab7acf4c602453170ba475b7e
6
+ metadata.gz: 4f0de7a6035a2179287b06eef2d942b53e4c5ba18f8d26dd5df7cb48ae32ecb320bce6fa8f778683f57de10a8f7a3b4e1c2123c8f25c3406360573bebf54ee25
7
+ data.tar.gz: 5c85f6027cf1e286b53885d9d2cd0226eaff9079d1bc6933a0bb7659a85965c0f791e0d3ccf22ca745d44b4927b981c4abffe8734aa43043c98ffa5363c4698c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,7 @@
1
1
  CHANGELOG
2
2
  ---------
3
- - **Unreleased**
3
+ - **Unreleased**: 3.4.1
4
+ - [PR #209](https://github.com/caxlsx/caxlsx/pull/209) - Revert characters other than `=` being considered as formulas.
4
5
 
5
6
  - **April.12.23**: 3.4.0
6
7
  - [PR #186](https://github.com/caxlsx/caxlsx/pull/186) - Add `escape_formulas` to global, workbook, worksheet, row and cell levels, and standardize behavior.
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Caxlsx (Community Continued Version)
2
- [![Build Status](https://github.com/caxlsx/caxlsx/workflows/Test/badge.svg)](https://github.com/caxlsx/caxlsx/actions)
2
+ [![Test](https://github.com/caxlsx/caxlsx/actions/workflows/test.yml/badge.svg)](https://github.com/caxlsx/caxlsx/actions/workflows/test.yml)
3
+ [![RuboCop](https://github.com/caxlsx/caxlsx/actions/workflows/rubocop.yml/badge.svg)](https://github.com/caxlsx/caxlsx/actions/workflows/rubocop.yml)
3
4
  [![Gem Version](https://badge.fury.io/rb/caxlsx.svg)](https://badge.fury.io/rb/caxlsx)
4
5
  ![downloads](https://img.shields.io/gem/dt/caxlsx?label=downloads)
5
6
 
@@ -130,7 +131,7 @@ Axlsx.escape_formulas = true
130
131
  Then, set the following on each cell you'd like to add a formula:
131
132
 
132
133
  ```ruby
133
- cell.escape_formulas = true
134
+ cell.escape_formulas = false
134
135
  ```
135
136
 
136
137
  Refer to examples/escape_formula.md for how to set `escape_formulas` on the workbook, worksheet, row and/or cell level.
data/lib/axlsx/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Axlsx
2
2
  # The current version
3
- VERSION = "3.4.0"
3
+ VERSION = "3.4.1"
4
4
  end
@@ -72,7 +72,13 @@ module Axlsx
72
72
 
73
73
  # Leading characters that indicate a formula.
74
74
  # See: https://owasp.org/www-community/attacks/CSV_Injection
75
- FORMULA_PREFIXES = ['-', '=', '+', '@', '%', '|', "\r", "\t"].freeze
75
+ FORMULA_PREFIXES = ['='.freeze].freeze
76
+
77
+ # Leading characters that indicate an array formula.
78
+ ARRAY_FORMULA_PREFIXES = ['{='.freeze].freeze
79
+
80
+ # Trailing character that indicates an array formula.
81
+ ARRAY_FORMULA_SUFFIX = '}'.freeze
76
82
 
77
83
  # The index of the cellXfs item to be applied to this cell.
78
84
  # @return [Integer]
@@ -393,7 +399,9 @@ module Axlsx
393
399
  def is_array_formula?
394
400
  return false if escape_formulas
395
401
 
396
- type == :string && @value.to_s.start_with?('{=') && @value.to_s.end_with?('}')
402
+ type == :string &&
403
+ @value.to_s.start_with?(*ARRAY_FORMULA_PREFIXES) &&
404
+ @value.to_s.end_with?(ARRAY_FORMULA_SUFFIX)
397
405
  end
398
406
 
399
407
  # returns the absolute or relative string style reference for
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caxlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Randy Morgan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-12 00:00:00.000000000 Z
12
+ date: 2023-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri