docxify 0.1.2 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '02588568aa1d05caf048a8a3b861ffc9b5ec2109817b6931006ce4c36c97adea'
4
- data.tar.gz: 7f2647fdf663f8fb222c544592c4910ec54aedcdd26cf8fef30a610c7a163d6f
3
+ metadata.gz: 9feb2e005b3722bb91013f2b319a93da1f7ee49cbce3d28491dc279f1a06776a
4
+ data.tar.gz: 792b462f78fb7c03dc73f12ef9c9ab9359e55ab09d06a3cbcf10bd65b332cac9
5
5
  SHA512:
6
- metadata.gz: bf43c3a7194169d9cb01e0f96a44d3498dffbde8fa7f829dbf8fff1226ea9adffa4f648a06158cc7ad3450203858e2211cf2423f064a683129ef2e23c825353b
7
- data.tar.gz: b4990b99e150a9f2e3aae3a45873799e91fc850c7180485caa4559ed2eca97d301672bd0181f3e5b703d3c44f32b4c3f6e64c32c36895b0c62a002659f76b83d
6
+ metadata.gz: fe9457df0501983598674783c781ebf2cc8b964e540aadc90645d8a1132a62ed0a28c2cbec56931d069b2435cb5e6419cca4a7e4232afb22f0b4a08bac2687ee
7
+ data.tar.gz: 0a8d8fb56b6f88350885cb0afadf8100fa31b682c3bef5c1cdba90ce0c039fdb9fc2f00aa3024723c9add5bb7cc97b288378def2f0ccf4ab85287f72d4f65408
data/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.4
4
+
5
+ Bugfix:
6
+
7
+ - Removed accidentally left debug statement
8
+
9
+ ## 0.1.3
10
+
11
+ Bugfix:
12
+
13
+ - Files that contain a PNG but weren't named ending in .png (e.g. a Tempfile in Ruby) were causing corrupted Docx files (which Word could auto-recover)
14
+
3
15
  ## 0.1.2
4
16
 
5
17
  Features:
6
18
 
7
- - "Add 'after' to images and paragraphs to adjust spacing after those elements
19
+ - Add 'after' to images and paragraphs to adjust spacing after those elements
8
20
 
9
21
  ## 0.1.1
10
22
 
@@ -46,7 +46,7 @@ module DocXify
46
46
  def build_xml(container)
47
47
  xml = <<~XML
48
48
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
49
- <w:document mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
49
+ <w:document mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16du wp14" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
50
50
  <w:body>
51
51
  XML
52
52
 
@@ -15,16 +15,16 @@ module DocXify
15
15
  end
16
16
 
17
17
  def load_file_data(file_path_or_data)
18
+ if ::File.exist?(file_path_or_data)
19
+ file_path_or_data = ::File.read(file_path_or_data, mode: "rb")
20
+ end
21
+
18
22
  if contains_png_image?(file_path_or_data)
19
23
  @data = file_path_or_data
20
24
  @filename = "#{Digest::SHA1.hexdigest(@data)}.png"
21
25
  elsif contains_jpeg_image?(file_path_or_data)
22
26
  @data = file_path_or_data
23
27
  @filename = "#{Digest::SHA1.hexdigest(@data)}.jpg"
24
- elsif ::File.exist?(file_path_or_data)
25
- @filename = ::File.basename(file_path_or_data)
26
- @data = ::File.read(file_path_or_data, mode: "rb")
27
- raise ArgumentError.new("Unsupported file type - images must be PNG or JPEG") unless contains_png_image?(@data) || contains_jpeg_image?(@data)
28
28
  else
29
29
  raise ArgumentError.new("Unsupported file type - images must be PNG or JPEG")
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module DocXify
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.4".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docxify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries