ooxml_parser 0.38.0 → 0.39.0
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/lib/ooxml_parser/common_parser/common_data/coordinates.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +28 -27
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb +5 -5
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/presentation/slide/slide_helper.rb +1 -1
- data/lib/ooxml_parser/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 064ea9325ec10b0d22eeaf5774ffc480746f739ab78d5580eda00f05499e7111
|
4
|
+
data.tar.gz: 71aace963676dec9978977537985b8e9d834cca7ad8e6f7a4a5b24736694d287
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0205f6ce29895ba3597afab6184ce8959515c4997dce7ffcbca329c98c6fc394eec73a5b0f05e66e0c5b240b41eefa4dba7fdc4b06c2dd6f0218cb273792840
|
7
|
+
data.tar.gz: de025b3b50f9dd8cf5151861d6767f799bb993e7de46afe003c60957f79d1a03223488d0e78a13605a29adcde415511c1d780d137924cdf43c4f08c2e12b8a03
|
@@ -3,33 +3,7 @@
|
|
3
3
|
module OoxmlParser
|
4
4
|
# Module for helper methods for OOXMLDocumentObject
|
5
5
|
module OoxmlDocumentObjectHelper
|
6
|
-
# Convert
|
7
|
-
# @return [Hash]
|
8
|
-
def to_hash
|
9
|
-
result_hash = {}
|
10
|
-
instance_variables.each do |current_attribute|
|
11
|
-
next if current_attribute == :@parent
|
12
|
-
|
13
|
-
attribute_value = instance_variable_get(current_attribute)
|
14
|
-
next unless attribute_value
|
15
|
-
|
16
|
-
if attribute_value.is_a?(Array)
|
17
|
-
attribute_value.each_with_index do |object_element, index|
|
18
|
-
result_hash[:"#{current_attribute}_#{index}"] = object_element.to_hash
|
19
|
-
end
|
20
|
-
else
|
21
|
-
result_hash[current_attribute.to_sym] = if attribute_value.respond_to?(:to_hash)
|
22
|
-
attribute_value.to_hash
|
23
|
-
else
|
24
|
-
attribute_value.to_s
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
result_hash
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
6
|
+
# @return [Hash] Hash to Convert value to human readable symbol
|
33
7
|
VALUE_TO_SYMBOL_HASH = { l: :left,
|
34
8
|
ctr: :center,
|
35
9
|
r: :right,
|
@@ -98,6 +72,33 @@ module OoxmlParser
|
|
98
72
|
rnd: :round,
|
99
73
|
sq: :square }.freeze
|
100
74
|
|
75
|
+
# Convert object to hash
|
76
|
+
# @return [Hash]
|
77
|
+
def to_hash
|
78
|
+
result_hash = {}
|
79
|
+
instance_variables.each do |current_attribute|
|
80
|
+
next if current_attribute == :@parent
|
81
|
+
|
82
|
+
attribute_value = instance_variable_get(current_attribute)
|
83
|
+
next unless attribute_value
|
84
|
+
|
85
|
+
if attribute_value.is_a?(Array)
|
86
|
+
attribute_value.each_with_index do |object_element, index|
|
87
|
+
result_hash[:"#{current_attribute}_#{index}"] = object_element.to_hash
|
88
|
+
end
|
89
|
+
else
|
90
|
+
result_hash[current_attribute.to_sym] = if attribute_value.respond_to?(:to_hash)
|
91
|
+
attribute_value.to_hash
|
92
|
+
else
|
93
|
+
attribute_value.to_s
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
result_hash
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
|
101
102
|
# Convert value to human readable symbol
|
102
103
|
# @param [String] value to convert
|
103
104
|
# @return [Symbol]
|
data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb
CHANGED
@@ -19,11 +19,11 @@ module OoxmlParser
|
|
19
19
|
# @return [Symbol] type of border in visual editor
|
20
20
|
def border_visual_type
|
21
21
|
result = []
|
22
|
-
result << :left if @left.val == :single
|
23
|
-
result << :right if @right.val == :single
|
24
|
-
result << :top if @top.val == :single
|
25
|
-
result << :bottom if @bottom.val == :single
|
26
|
-
result << :inner if @between.val == :single
|
22
|
+
result << :left if @left && @left.val == :single
|
23
|
+
result << :right if @right && @right.val == :single
|
24
|
+
result << :top if @top && @top.val == :single
|
25
|
+
result << :bottom if @bottom && @bottom.val == :single
|
26
|
+
result << :inner if @between && @between.val == :single
|
27
27
|
return :none if result == []
|
28
28
|
return :all if result == %i[left right top bottom inner]
|
29
29
|
return :outer if result == %i[left right top bottom]
|
data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb
CHANGED
@@ -44,7 +44,7 @@ module OoxmlParser
|
|
44
44
|
# @return [Hash] hash with sorted values
|
45
45
|
# TODO: Totally redone parsing of spacing to remove this workaround
|
46
46
|
def sorted_attributes(node)
|
47
|
-
node.attributes.sort.reverse
|
47
|
+
node.attributes.sort.reverse!.to_h
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -37,7 +37,7 @@ module OoxmlParser
|
|
37
37
|
transform = transform_of_object(object)
|
38
38
|
return :left if transform.offset.x.zero?
|
39
39
|
return :center if OoxmlSize.new((slide_size.width.value / 2) - (transform.extents.x.value / 2)) == OoxmlSize.new(transform.offset.x.value)
|
40
|
-
return :right if OoxmlSize.new(
|
40
|
+
return :right if OoxmlSize.new(slide_size.width.value - transform.extents.x.value) == OoxmlSize.new(transform.offset.x.value)
|
41
41
|
|
42
42
|
:unknown
|
43
43
|
end
|
data/lib/ooxml_parser/version.rb
CHANGED
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.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
- Roman Zagudaev
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -494,7 +494,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
494
494
|
- !ruby/object:Gem::Version
|
495
495
|
version: '0'
|
496
496
|
requirements: []
|
497
|
-
rubygems_version: 3.6.
|
497
|
+
rubygems_version: 3.6.9
|
498
498
|
specification_version: 4
|
499
499
|
summary: OoxmlParser Gem
|
500
500
|
test_files: []
|