docx 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d330b3e0314db11795c19864a96cfe839e9c9959211f0b1b54af5270f4157c4
4
- data.tar.gz: 291e34e45c7d56185cdf5716fc15e9143b2134bea6d14102cf699e0d3cd6f8f5
3
+ metadata.gz: 2a33dcd9e31c60144261a15670cd1c01b37877044aaf33f7091b46cc85ab3412
4
+ data.tar.gz: 1911db027b3e2fbf8eb9363eaa99b95231f875afe8de2a0c060b38fee86c7238
5
5
  SHA512:
6
- metadata.gz: cbbe86dd086c4cae691af852e596d7a416e6e08fac56ad76ba03e5d44b12285eb84391204afe3df4d53b4a2a760149a791a03efc4cc08942565d4cead0014d62
7
- data.tar.gz: 107a8e8aaad25115b824812681335fb072aebad3945e3263b622105b6847c6c25abb30ca4c5cbd5753ea1b3940f27a91e6a82dc3fb7f126dcf465e18e314ed32
6
+ metadata.gz: 0a823fedf1b0bfc542c88533c787aefa5e9cee12ae4422a01f106985a2f03e8b636aa70820a179f5501ba8f996672f8f75e24356282cd7d81505cbb1984fa967
7
+ data.tar.gz: c06b4078536bd8b12b5c5e4f61fe0ef5f2f9e03e9cbc7c4017f2d01d3e8a0bc9200fa7457fac54c0b110a57ddc4bff8ad74c28d3e873512900266ac00137c6e6
data/lib/docx/document.rb CHANGED
@@ -87,12 +87,12 @@ module Docx
87
87
  def hyperlinks
88
88
  hyperlink_relationships.each_with_object({}) do |rel, hash|
89
89
  hash[rel.attributes['Id'].value] = rel.attributes['Target'].value
90
- end
90
+ end
91
91
  end
92
92
 
93
93
  def hyperlink_relationships
94
94
  @rels.xpath("//xmlns:Relationship[contains(@Type,'hyperlink')]")
95
- end
95
+ end
96
96
 
97
97
  ##
98
98
  # *Deprecated*
@@ -168,13 +168,20 @@ module Docx
168
168
  def load_styles
169
169
  @styles_xml = @zip.read('word/styles.xml')
170
170
  @styles = Nokogiri::XML(@styles_xml)
171
- @rels_xml = @zip.read('word/_rels/document.xml.rels')
172
- @rels = Nokogiri::XML(@rels_xml)
171
+ load_rels
173
172
  rescue Errno::ENOENT => e
174
173
  warn e.message
175
174
  nil
176
175
  end
177
176
 
177
+ def load_rels
178
+ rels_entry = @zip.glob('word/_rels/document*.xml.rels').first
179
+ raise Errno::ENOENT unless rels_entry
180
+
181
+ @rels_xml = rels_entry.get_input_stream.read
182
+ @rels = Nokogiri::XML(@rels_xml)
183
+ end
184
+
178
185
  #--
179
186
  # TODO: Flesh this out to be compatible with other files
180
187
  # TODO: Method to set flag on files that have been edited, probably by inserting something at the
data/lib/docx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Docx #:nodoc:
4
- VERSION = '0.6.1'
4
+ VERSION = '0.6.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Hunt
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2021-05-05 00:00:00.000000000 Z
15
+ date: 2021-07-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: nokogiri
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.0.3
138
+ rubygems_version: 3.1.6
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: a ruby library/gem for interacting with .docx files