swordfish 0.0.3 → 0.0.4
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 +8 -8
- data/lib/swordfish/document.rb +1 -0
- data/lib/swordfish/formats/docx.rb +5 -5
- data/lib/swordfish/nodes/hyperlink.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTEyODI1ZjU2OTMyODY3ZDM0NjM3OGY3ZjcyNTU1YTIwMjk1NDQ0ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTIxMTkzNWMzNmYwNTY3YTNmOTg2YzE1MTYyZDUxYjk3YTNkZGU1MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmQ2YTk3YTcxNzFmNjNhMTg4Yjk0OGE1ZmI0ZjVmMWM5M2U1NmM1NDA3Y2Y0
|
10
|
+
MzUzNjI4NGQ1Y2IwOTgyNGI3MmM3M2M2OGM3OGIwMzAyY2VmZjE3NWMyNmJl
|
11
|
+
N2M0MjQ1OGQzZDZhMjI1M2RmN2Y4MTE0MjYyOGZjZWQ4MzJiZWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjY5NDlhZmQ0N2I0NGYzNjA0OGY4YzQ5MjY1YmI1MDM4OTIzODYxNDBjODIy
|
14
|
+
OGE3MjdjZTU4YmNkNmVmZjk1NDAxYjA2MmVkMzAzNzViY2ExYzg3MjU5ZjU0
|
15
|
+
ZGE1NTY5ZWQ1MTI2ZWU5MjJjMTI5Y2ZmYzM1NTI5YWU3YWJmNjM=
|
data/lib/swordfish/document.rb
CHANGED
@@ -18,8 +18,8 @@ module Swordfish
|
|
18
18
|
docx_archive = Zip::File.open(filepath)
|
19
19
|
document = docx_archive.read 'word/document.xml'
|
20
20
|
styles = docx_archive.read 'word/styles.xml'
|
21
|
-
numbering = docx_archive.read
|
22
|
-
relationships = docx_archive.read
|
21
|
+
numbering = docx_archive.read('word/numbering.xml') rescue nil
|
22
|
+
relationships = docx_archive.read('word/_rels/document.xml.rels') rescue nil
|
23
23
|
|
24
24
|
# Parse the XML files and generate the Swordfish::Document
|
25
25
|
swordfish_docx = new docx_archive, document, styles, numbering, relationships
|
@@ -30,8 +30,8 @@ module Swordfish
|
|
30
30
|
@docx_archive = archive
|
31
31
|
@swordfish_doc = Swordfish::Document.new
|
32
32
|
parse_styles styles_xml
|
33
|
-
parse_numbering numbering_xml
|
34
|
-
parse_relationships relationships_xml
|
33
|
+
parse_numbering(numbering_xml) if numbering_xml
|
34
|
+
parse_relationships(relationships_xml) if relationships_xml
|
35
35
|
parse document_xml
|
36
36
|
end
|
37
37
|
|
@@ -170,7 +170,7 @@ module Swordfish
|
|
170
170
|
text.content = run_xml.xpath('./w:t')[0].content
|
171
171
|
get_styles_for_node(text, run_xml.xpath('./w:rPr')[0])
|
172
172
|
texts << text
|
173
|
-
elsif run_xml.xpath('.//pic:pic', :pic => @namespaces['xmlns:pic']).length > 0
|
173
|
+
elsif @namespaces['xmlns:pic'] && run_xml.xpath('.//pic:pic', :pic => @namespaces['xmlns:pic']).length > 0
|
174
174
|
# An image run
|
175
175
|
image = Swordfish::Node::Image.new
|
176
176
|
relationship_id = run_xml.xpath('.//pic:pic/pic:blipFill/a:blip', :pic => @namespaces['xmlns:pic'], :a => @namespaces['xmlns:a'])[0]['r:embed'] rescue nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swordfish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Posthumus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|