ooxml_parser 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/color.rb +11 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +12 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +2 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +2 -2
- data/lib/ooxml_parser/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93d49b878e6b9a06afef0feb2bc87343ce8ee65010b40cf97d4df4be73fc32d9
|
4
|
+
data.tar.gz: 90466124985a9d35ee740930b459f8d03a72bd4ed84534d8e90427c58cf3e881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba03885d36dbea193b6cd4616062e9d7ed5c6cfee9ac35d1767a3715736ab96b63d6a2a0015227aad188bef73e7ad8196a347667d38173de1c1d4c0773235f1
|
7
|
+
data.tar.gz: 0db3346a2caf864675cc3bfa0a0bce44bbf6dcda1423941c2c2fd95cce8d90cb4721bb2127a0493fd206b43b61a94eb8780f586ab499137bbd252689709839f7
|
@@ -45,11 +45,11 @@ module OoxmlParser
|
|
45
45
|
hls_color.h = if max == red && green >= blue
|
46
46
|
60.0 * (green - blue) / delta
|
47
47
|
elsif max == red && green < blue
|
48
|
-
60.0 * (green - blue) / delta + 360.0
|
48
|
+
(60.0 * (green - blue) / delta) + 360.0
|
49
49
|
elsif max == green
|
50
|
-
60.0 * (blue - red) / delta + 120.0
|
50
|
+
(60.0 * (blue - red) / delta) + 120.0
|
51
51
|
else
|
52
|
-
60.0 * (red - green) / delta + 240.0
|
52
|
+
(60.0 * (red - green) / delta) + 240.0
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -48,7 +48,7 @@ module OoxmlParser
|
|
48
48
|
|
49
49
|
# @return [String] result of convert of object to string
|
50
50
|
def to_s
|
51
|
-
if
|
51
|
+
if primary_colors_none?
|
52
52
|
'none'
|
53
53
|
else
|
54
54
|
"RGB (#{@red}, #{@green}, #{@blue})"
|
@@ -69,8 +69,8 @@ module OoxmlParser
|
|
69
69
|
|
70
70
|
# @return [True, False] is color default
|
71
71
|
def none?
|
72
|
-
|
73
|
-
|
72
|
+
primary_colors_none? ||
|
73
|
+
style == :nil
|
74
74
|
end
|
75
75
|
|
76
76
|
# @return [True, False] is color not default
|
@@ -83,6 +83,14 @@ module OoxmlParser
|
|
83
83
|
(@red == 255) && (@green == 255) && (@blue == 255)
|
84
84
|
end
|
85
85
|
|
86
|
+
# Check if all three primary colors are none
|
87
|
+
# @return [Boolean]
|
88
|
+
def primary_colors_none?
|
89
|
+
@red == VALUE_FOR_NONE_COLOR &&
|
90
|
+
@green == VALUE_FOR_NONE_COLOR &&
|
91
|
+
@blue == VALUE_FOR_NONE_COLOR
|
92
|
+
end
|
93
|
+
|
86
94
|
# Method to copy object
|
87
95
|
# @return [Color] copied object
|
88
96
|
def copy
|
@@ -22,9 +22,9 @@ module OoxmlParser
|
|
22
22
|
# Chroma - The "colorfulness relative to the brightness of a similarly illuminated white".
|
23
23
|
# @return [Color] result
|
24
24
|
def to_rgb
|
25
|
-
chroma = (1 - (2 * @l - 1).abs) * @s
|
26
|
-
x = chroma * (1 - ((@h / 60.0) % 2.0 - 1).abs)
|
27
|
-
m = @l - chroma / 2.0
|
25
|
+
chroma = (1 - ((2 * @l) - 1).abs) * @s
|
26
|
+
x = chroma * (1 - (((@h / 60.0) % 2.0) - 1).abs)
|
27
|
+
m = @l - (chroma / 2.0)
|
28
28
|
|
29
29
|
rgb = if @h.zero?
|
30
30
|
Color.new(0, 0, 0)
|
@@ -52,7 +52,7 @@ module OoxmlParser
|
|
52
52
|
if tint.nil?
|
53
53
|
lum
|
54
54
|
else
|
55
|
-
tint.negative? ? lum * (1.0 + tint) : lum * (1.0 - tint) + (255 - 255 * (1.0 - tint))
|
55
|
+
tint.negative? ? lum * (1.0 + tint) : (lum * (1.0 - tint)) + (255 - (255 * (1.0 - tint)))
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -114,7 +114,7 @@ module OoxmlParser
|
|
114
114
|
# and converts into integer
|
115
115
|
def column_number
|
116
116
|
@column.reverse.each_char.reduce(0) do |result, char|
|
117
|
-
result + (char.downcase.ord - 96) * (26**@column.reverse.index(char))
|
117
|
+
result + ((char.downcase.ord - 96) * (26**@column.reverse.index(char)))
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -96,5 +96,17 @@ module OoxmlParser
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
# Fetch data from `ParagraphSpacing`
|
101
|
+
# Which have values with parameters
|
102
|
+
# @param valued_spacing [ParagraphSpacing] spacing to get params
|
103
|
+
# @return [Spacing]
|
104
|
+
def fetch_from_valued_spacing(valued_spacing)
|
105
|
+
@before = valued_spacing.before.to_unit(:centimeter).value if valued_spacing.before
|
106
|
+
@after = valued_spacing.after.to_unit(:centimeter).value if valued_spacing.after
|
107
|
+
@line = valued_spacing.line.to_unit(:centimeter).value if valued_spacing.line
|
108
|
+
@line_rule = valued_spacing.line_rule if valued_spacing.line_rule
|
109
|
+
self
|
110
|
+
end
|
99
111
|
end
|
100
112
|
end
|
@@ -33,7 +33,7 @@ module OoxmlParser
|
|
33
33
|
when 'effect'
|
34
34
|
self.effect = node_child.attribute('val').value
|
35
35
|
when 'position'
|
36
|
-
self.position = (node_child.attribute('val').value.to_f / (28.0 + 1.0 / 3.0) / 2.0).round(1)
|
36
|
+
self.position = (node_child.attribute('val').value.to_f / (28.0 + (1.0 / 3.0)) / 2.0).round(1)
|
37
37
|
when 'em'
|
38
38
|
self.em = node_child.attribute('val').value
|
39
39
|
when 'spacing'
|
@@ -216,12 +216,8 @@ module OoxmlParser
|
|
216
216
|
@align = node_child.attribute('val').value.to_sym unless node_child.attribute('val').nil?
|
217
217
|
@align = :justify if node_child.attribute('val').value == 'both'
|
218
218
|
when 'spacing'
|
219
|
-
@
|
220
|
-
@spacing
|
221
|
-
@spacing.line_rule = node_child.attribute('lineRule').value.sub('atLeast', 'at_least').to_sym unless node_child.attribute('lineRule').nil?
|
222
|
-
unless node_child.attribute('line').nil?
|
223
|
-
@spacing.line = (@spacing.line_rule == :auto ? (node_child.attribute('line').value.to_f / 240.0).round(2) : (node_child.attribute('line').value.to_f / 566.9).round(2))
|
224
|
-
end
|
219
|
+
@valued_spacing = ParagraphSpacing.new(parent: self).parse(node_child)
|
220
|
+
@spacing = @spacing.fetch_from_valued_spacing(@valued_spacing)
|
225
221
|
when 'sectPr'
|
226
222
|
@sector_properties = PageProperties.new(parent: self).parse(node_child, self, default_char_style)
|
227
223
|
@section_break = case @sector_properties.type
|
@@ -19,8 +19,8 @@ module OoxmlParser
|
|
19
19
|
|
20
20
|
# @return [True, False] compare dimensions of size, ignoring orientation
|
21
21
|
def same_dimensions?(other)
|
22
|
-
(@height == other.height) && (@width == other.width) ||
|
23
|
-
(@height == other.width) && (@width == other.height)
|
22
|
+
((@height == other.height) && (@width == other.width)) ||
|
23
|
+
((@height == other.width) && (@width == other.height))
|
24
24
|
end
|
25
25
|
|
26
26
|
# @return [String] get human format name
|
data/lib/ooxml_parser/version.rb
CHANGED
@@ -19,15 +19,19 @@ module OoxmlParser
|
|
19
19
|
attr_reader :stop_if_true
|
20
20
|
# @return [Symbol] Relational operator in value rule
|
21
21
|
attr_reader :operator
|
22
|
+
# @return [Symbol] Specifies whether top/bottom rule highlights bottom values
|
23
|
+
attr_reader :bottom
|
22
24
|
# @return [Symbol] Specifies whether percent is used in top/bottom rule
|
23
25
|
attr_reader :percent
|
24
26
|
# @return [Integer] Number of items in top/bottom rule
|
25
27
|
attr_reader :rank
|
26
28
|
# @return [Integer] Number of standard deviations in above/below average rule
|
27
29
|
attr_reader :standard_deviation
|
28
|
-
# @return [String]
|
30
|
+
# @return [String] Text value in text rule
|
29
31
|
attr_reader :text
|
30
|
-
# @return [
|
32
|
+
# @return [Symbol] Time period in date rule
|
33
|
+
attr_reader :time_period
|
34
|
+
# @return [Array<Formula>] Formulas to determine condition
|
31
35
|
attr_reader :formulas
|
32
36
|
# @return [DifferentialFormattingRecord] Format
|
33
37
|
attr_reader :rule_format
|
@@ -61,6 +65,8 @@ module OoxmlParser
|
|
61
65
|
@stop_if_true = attribute_enabled?(value)
|
62
66
|
when 'operator'
|
63
67
|
@operator = value.value.to_sym
|
68
|
+
when 'bottom'
|
69
|
+
@bottom = attribute_enabled?(value)
|
64
70
|
when 'percent'
|
65
71
|
@percent = attribute_enabled?(value)
|
66
72
|
when 'rank'
|
@@ -69,6 +75,8 @@ module OoxmlParser
|
|
69
75
|
@standard_deviation = value.value.to_i
|
70
76
|
when 'text'
|
71
77
|
@text = value.text.to_s
|
78
|
+
when 'timePeriod'
|
79
|
+
@time_period = value.value.to_sym
|
72
80
|
end
|
73
81
|
end
|
74
82
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ooxml_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-09-
|
13
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|