ooxml_parser 0.24.0 → 0.25.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/paragraph/paragraph_run/run_properties/shade.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +5 -5
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb +22 -0
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run.rb +8 -7
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb +1 -1
- data/lib/ooxml_parser/docx_parser/document_structure/docx_paragraph.rb +1 -5
- data/lib/ooxml_parser/pptx_parser/presentation.rb +2 -3
- data/lib/ooxml_parser/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 409ce77d24b38512604d5215a2bd6a54f887685db71cd9942c81935ef678f3b0
|
4
|
+
data.tar.gz: 4f7edddf4bab2d5d6ab9485754b333a2943d2df96fdcc933d671e820cd9dc70d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aad06b0a4dd775d5efe4411d43b87ebda68fe05a5a15924fb6773d77169141284baaf8047eee042634a2e6145649ac0fce2e9aa143d401587434598eeff5f73d
|
7
|
+
data.tar.gz: c2ab404a2ab3f559a312da5953da7a668b4ae1c359ff790bc4b4d577ccbd453e4314844125cc64e144c884f9e187389586c98f085c4d27ca5837d8a1b9e61f9d
|
data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
CHANGED
@@ -38,8 +38,8 @@ module OoxmlParser
|
|
38
38
|
private
|
39
39
|
|
40
40
|
# This is dirty workaround for situations
|
41
|
-
# Then
|
42
|
-
#
|
41
|
+
# Then `@line_rule` parsed after `@line` so getting
|
42
|
+
# `@line` value is totally screwed up
|
43
43
|
# @param [Nokogiri::XML:Node] node with ParagraphSpacing
|
44
44
|
# @return [Hash] hash with sorted values
|
45
45
|
# TODO: Totally redone parsing of spacing to remove this workaround
|
@@ -8,11 +8,11 @@ module OoxmlParser
|
|
8
8
|
|
9
9
|
# @return [String] result of convert of object to string
|
10
10
|
def to_s
|
11
|
-
"Table position left: #{left}, "\
|
12
|
-
"right: #{right}, "\
|
13
|
-
"top: #{top}, "\
|
14
|
-
"bottom #{bottom}, "\
|
15
|
-
"position x: #{position_x}, "\
|
11
|
+
"Table position left: #{left}, " \
|
12
|
+
"right: #{right}, " \
|
13
|
+
"top: #{top}, " \
|
14
|
+
"bottom #{bottom}, " \
|
15
|
+
"position x: #{position_x}, " \
|
16
16
|
"position y: #{position_y}"
|
17
17
|
end
|
18
18
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `w:instrText` object
|
5
|
+
class InstructionText < TextValue
|
6
|
+
# @return [Boolean] is current object for hyperlink
|
7
|
+
def hyperlink?
|
8
|
+
value.include?('HYPERLINK')
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Boolean] is current object for page number
|
12
|
+
def page_number?
|
13
|
+
value.match?(/PAGE\s+\\\*/)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Hyperlink] convert InstructionText to Hyperlink
|
17
|
+
def to_hyperlink
|
18
|
+
Hyperlink.new(value.sub('HYPERLINK ', '').split(' \\o ').first,
|
19
|
+
value.sub('HYPERLINK', '').split(' \\o ').last)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# noinspection RubyTooManyInstanceVariablesInspection
|
4
4
|
require_relative 'docx_paragraph_run/docx_paragraph_run_helpers'
|
5
|
+
require_relative 'docx_paragraph_run/instruction_text'
|
5
6
|
require_relative 'docx_paragraph_run/object'
|
6
7
|
require_relative 'docx_paragraph_run/text_outline'
|
7
8
|
require_relative 'docx_paragraph_run/text_fill'
|
@@ -15,9 +16,9 @@ module OoxmlParser
|
|
15
16
|
:link, :highlight, :effect, :caps, :w,
|
16
17
|
:position, :em, :spacing, :break, :touch, :shape, :footnote, :endnote, :fld_char, :style,
|
17
18
|
:comments, :alternate_content, :page_number, :text_outline, :text_fill
|
18
|
-
# @return [
|
19
|
-
#
|
20
|
-
|
19
|
+
# @return [InstructionText] text of instruction
|
20
|
+
# See ECMA-376, 17.16.23 instrText (Field Code)
|
21
|
+
attr_reader :instruction_text
|
21
22
|
# @return [RunProperties] properties of run
|
22
23
|
attr_accessor :run_properties
|
23
24
|
# @return [RunObject] object of run
|
@@ -96,10 +97,10 @@ module OoxmlParser
|
|
96
97
|
parse_properties(node_child)
|
97
98
|
@run_properties = RunProperties.new(parent: self).parse(node_child)
|
98
99
|
when 'instrText'
|
99
|
-
|
100
|
-
|
101
|
-
@link =
|
102
|
-
elsif
|
100
|
+
@instruction_text = InstructionText.new(parent: self).parse(node_child)
|
101
|
+
if @instruction_text.hyperlink?
|
102
|
+
@link = @instruction_text.to_hyperlink
|
103
|
+
elsif @instruction_text.page_number?
|
103
104
|
@text = '*PAGE NUMBER*'
|
104
105
|
end
|
105
106
|
when 'fldChar'
|
@@ -25,7 +25,7 @@ module OoxmlParser
|
|
25
25
|
# Convert to string
|
26
26
|
# @return [String] result of conversion
|
27
27
|
def to_s
|
28
|
-
"first line indent: #{@first_line_indent}, left indent: #{@left_indent}, "\
|
28
|
+
"first line indent: #{@first_line_indent}, left indent: #{@left_indent}, " \
|
29
29
|
"right indent: #{@right_indent}, hanging indent: #{@hanging_indent}"
|
30
30
|
end
|
31
31
|
|
@@ -18,7 +18,7 @@ module OoxmlParser
|
|
18
18
|
# Class for data of DocxParagraph
|
19
19
|
class DocxParagraph < OOXMLDocumentObject
|
20
20
|
include DocxParagraphHelper
|
21
|
-
attr_accessor :number, :
|
21
|
+
attr_accessor :number, :align, :spacing, :ind, :numbering,
|
22
22
|
:character_style_array, :page_break, :borders, :keep_lines,
|
23
23
|
:contextual_spacing, :sector_properties, :page_numbering, :section_break, :style, :keep_next,
|
24
24
|
:orphan_control
|
@@ -39,8 +39,6 @@ module OoxmlParser
|
|
39
39
|
|
40
40
|
def initialize(parent: nil)
|
41
41
|
@number = 0
|
42
|
-
@bookmark_start = []
|
43
|
-
@bookmark_end = []
|
44
42
|
@align = :left
|
45
43
|
@spacing = Spacing.new
|
46
44
|
@ind = Indents.new
|
@@ -62,8 +60,6 @@ module OoxmlParser
|
|
62
60
|
# @return [void]
|
63
61
|
def initialize_copy(source)
|
64
62
|
super
|
65
|
-
@bookmark_start = source.bookmark_start.clone
|
66
|
-
@bookmark_end = source.bookmark_end.clone
|
67
63
|
@character_style_array = source.character_style_array.clone
|
68
64
|
@spacing = source.spacing.clone
|
69
65
|
end
|
@@ -58,10 +58,9 @@ module OoxmlParser
|
|
58
58
|
@slide_size = SlideSize.new(parent: self).parse(presentation_node_child)
|
59
59
|
when 'sldIdLst'
|
60
60
|
presentation_node_child.xpath('p:sldId').each do |silde_id_node|
|
61
|
-
|
62
|
-
silde_id_node.attribute_nodes.select { |node| id = node.to_s if node.namespace && node.namespace.prefix == 'r' }
|
61
|
+
slide_id = silde_id_node.attr('r:id')
|
63
62
|
@slides << Slide.new(parent: self,
|
64
|
-
xml_path: "#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(
|
63
|
+
xml_path: "#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(slide_id)}")
|
65
64
|
.parse
|
66
65
|
end
|
67
66
|
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.25.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: 2022-
|
13
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -403,6 +403,7 @@ files:
|
|
403
403
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_helper.rb
|
404
404
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run.rb
|
405
405
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb
|
406
|
+
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
|
406
407
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/object.rb
|
407
408
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb
|
408
409
|
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/shape.rb
|
@@ -604,7 +605,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
604
605
|
- !ruby/object:Gem::Version
|
605
606
|
version: '0'
|
606
607
|
requirements: []
|
607
|
-
rubygems_version: 3.3.
|
608
|
+
rubygems_version: 3.3.19
|
608
609
|
signing_key:
|
609
610
|
specification_version: 4
|
610
611
|
summary: OoxmlParser Gem
|