ooxml_parser 0.5.1 → 0.6.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/alternate_content/alternate_content/choice.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +1 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/color.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +1 -0
- data/lib/ooxml_parser/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af046e45d945d773885e2c8c9c8becef406a7e0c50a1f71161e1252b73295441
|
4
|
+
data.tar.gz: 16e54721a7a8c6f066693343ad8950c88d136531b9f6a3a53d7d7154c199c699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 216969571d18f07e04e10c7499628dc59d131a531a7cf1f8abdaf390bba04f04912b5f4f3bc268cd06b45d4853eb9fe3347a1ef136cfa56f2e8f6b88fccde7ab
|
7
|
+
data.tar.gz: a14b99b7e06bfd36c38fe2e52774e617cc60f94193314b5bad6200fe5d973cc854a8774aa7a43bdcd556bfec6a2f53c0dee59ff978442f49663bd8e3c43a5d2d
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative 'docx_shape/ooxml_text_box'
|
4
4
|
require_relative 'docx_shape/non_visual_shape_properties'
|
5
|
+
require_relative 'docx_shape/shape_style'
|
5
6
|
require_relative 'docx_shape/text_body'
|
6
7
|
require_relative 'shape_properties/docx_shape_properties'
|
7
8
|
require_relative 'shape_body_properties/ooxml_shape_body_properties'
|
@@ -32,6 +33,8 @@ module OoxmlParser
|
|
32
33
|
@non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child)
|
33
34
|
when 'spPr'
|
34
35
|
@properties = DocxShapeProperties.new(parent: self).parse(node_child)
|
36
|
+
when 'style'
|
37
|
+
@style = ShapeStyle.new(parent: self).parse(node_child)
|
35
38
|
when 'txbx'
|
36
39
|
@text_body = OOXMLTextBox.new(parent: self).parse(node_child)
|
37
40
|
when 'txBody'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'shape_style/effect_reference'
|
4
|
+
require_relative 'shape_style/fill_reference'
|
5
|
+
require_relative 'shape_style/font_reference'
|
6
|
+
require_relative 'shape_style/line_reference'
|
7
|
+
module OoxmlParser
|
8
|
+
# Class for parsing `wps:style` tags
|
9
|
+
class ShapeStyle < OOXMLDocumentObject
|
10
|
+
# @return [FillReference] effect reference
|
11
|
+
attr_reader :effect_reference
|
12
|
+
# @return [FillReference] fill reference
|
13
|
+
attr_reader :fill_reference
|
14
|
+
# @return [FontReference] font reference
|
15
|
+
attr_reader :font_reference
|
16
|
+
# @return [LineReference] line reference
|
17
|
+
attr_reader :line_reference
|
18
|
+
|
19
|
+
def initialize(parent: nil)
|
20
|
+
@parent = parent
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse ShapeStyle object
|
24
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
25
|
+
# @return [ShapeStyle] result of parsing
|
26
|
+
def parse(node)
|
27
|
+
node.xpath('*').each do |node_child|
|
28
|
+
case node_child.name
|
29
|
+
when 'effectRef'
|
30
|
+
@effect_reference = EffectReference.new(parent: self).parse(node_child)
|
31
|
+
when 'fillRef'
|
32
|
+
@fill_reference = FillReference.new(parent: self).parse(node_child)
|
33
|
+
when 'fontRef'
|
34
|
+
@font_reference = FontReference.new(parent: self).parse(node_child)
|
35
|
+
when 'lnRef'
|
36
|
+
@line_reference = LineReference.new(parent: self).parse(node_child)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
self
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `a:effectRef` tags
|
5
|
+
class EffectReference < OOXMLDocumentObject
|
6
|
+
# @return [Integer] Style Matrix Index
|
7
|
+
attr_reader :index
|
8
|
+
# @return [Color] scheme color of EffectReference
|
9
|
+
attr_reader :scheme_color
|
10
|
+
|
11
|
+
def initialize(parent: nil)
|
12
|
+
@parent = parent
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse EffectReference object
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
17
|
+
# @return [EffectReference] result of parsing
|
18
|
+
def parse(node)
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'idx'
|
22
|
+
@index = value.value.to_f
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
node.xpath('*').each do |node_child|
|
27
|
+
case node_child.name
|
28
|
+
when 'schemeClr'
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `a:fillRef` tags
|
5
|
+
class FillReference < OOXMLDocumentObject
|
6
|
+
# @return [Integer] Style Matrix Index
|
7
|
+
attr_reader :index
|
8
|
+
# @return [Color] scheme color of FillReference
|
9
|
+
attr_reader :scheme_color
|
10
|
+
|
11
|
+
def initialize(parent: nil)
|
12
|
+
@parent = parent
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse FillReference object
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
17
|
+
# @return [FillReference] result of parsing
|
18
|
+
def parse(node)
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'idx'
|
22
|
+
@index = value.value.to_f
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
node.xpath('*').each do |node_child|
|
27
|
+
case node_child.name
|
28
|
+
when 'schemeClr'
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `a:fontRef` tags
|
5
|
+
class FontReference < OOXMLDocumentObject
|
6
|
+
# @return [String] Font Collection Index
|
7
|
+
attr_reader :index
|
8
|
+
# @return [Color] scheme color of FontReference
|
9
|
+
attr_reader :scheme_color
|
10
|
+
|
11
|
+
def initialize(parent: nil)
|
12
|
+
@parent = parent
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse FontReference object
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
17
|
+
# @return [FontReference] result of parsing
|
18
|
+
def parse(node)
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'idx'
|
22
|
+
@index = value.value.to_s
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
node.xpath('*').each do |node_child|
|
27
|
+
case node_child.name
|
28
|
+
when 'schemeClr'
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `a:lnRef` tags
|
5
|
+
class LineReference < OOXMLDocumentObject
|
6
|
+
# @return [Integer] Style Matrix Index
|
7
|
+
attr_reader :index
|
8
|
+
# @return [Color] scheme color of LineReference
|
9
|
+
attr_reader :scheme_color
|
10
|
+
|
11
|
+
def initialize(parent: nil)
|
12
|
+
@parent = parent
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse LineReference object
|
16
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
17
|
+
# @return [LineReference] result of parsing
|
18
|
+
def parse(node)
|
19
|
+
node.attributes.each do |key, value|
|
20
|
+
case key
|
21
|
+
when 'idx'
|
22
|
+
@index = value.value.to_f
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
node.xpath('*').each do |node_child|
|
27
|
+
case node_child.name
|
28
|
+
when 'schemeClr'
|
29
|
+
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -93,12 +93,14 @@ module OoxmlParser
|
|
93
93
|
attr_accessor :blue
|
94
94
|
# @return [String] Value of Color Style
|
95
95
|
attr_accessor :style
|
96
|
+
|
96
97
|
alias set_style style=
|
97
98
|
# @return [String] color scheme of color
|
98
99
|
attr_accessor :scheme
|
99
100
|
|
100
101
|
# @return [Integer] Value of alpha-channel
|
101
102
|
attr_accessor :alpha_channel
|
103
|
+
|
102
104
|
alias set_alpha_channel alpha_channel=
|
103
105
|
|
104
106
|
attr_accessor :position
|
@@ -154,9 +156,7 @@ module OoxmlParser
|
|
154
156
|
|
155
157
|
def ==(other)
|
156
158
|
if other.is_a?(Color)
|
157
|
-
if
|
158
|
-
false
|
159
|
-
elsif (@red == other.red) && (@green == other.green) && (@blue == other.blue)
|
159
|
+
if (@red == other.red) && (@green == other.green) && (@blue == other.blue)
|
160
160
|
true
|
161
161
|
elsif (none? && other.white?) || (white? && other.none?)
|
162
162
|
true
|
@@ -35,6 +35,7 @@ module OoxmlParser
|
|
35
35
|
# Used to determine if current style is visible in style list in editors
|
36
36
|
# According to http://www.wordarticles.com/Articles/WordStyles/LatentStyles.php
|
37
37
|
attr_accessor :q_format
|
38
|
+
|
38
39
|
alias visible? q_format
|
39
40
|
|
40
41
|
def initialize(parent: nil)
|
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.6.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: 2020-
|
13
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -129,6 +129,11 @@ files:
|
|
129
129
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb
|
130
130
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb
|
131
131
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb
|
132
|
+
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
|
133
|
+
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb
|
134
|
+
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb
|
135
|
+
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb
|
136
|
+
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb
|
132
137
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb
|
133
138
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
|
134
139
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb
|
@@ -431,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
431
436
|
- !ruby/object:Gem::Version
|
432
437
|
version: '0'
|
433
438
|
requirements: []
|
434
|
-
rubygems_version: 3.
|
439
|
+
rubygems_version: 3.1.2
|
435
440
|
signing_key:
|
436
441
|
specification_version: 4
|
437
442
|
summary: OoxmlParser Gem
|