docxify 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/lib/docxify/document.rb +1 -1
- data/lib/docxify/element/file.rb +4 -4
- data/lib/docxify/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9feb2e005b3722bb91013f2b319a93da1f7ee49cbce3d28491dc279f1a06776a
|
4
|
+
data.tar.gz: 792b462f78fb7c03dc73f12ef9c9ab9359e55ab09d06a3cbcf10bd65b332cac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
-
|
19
|
+
- Add 'after' to images and paragraphs to adjust spacing after those elements
|
8
20
|
|
9
21
|
## 0.1.1
|
10
22
|
|
data/lib/docxify/document.rb
CHANGED
@@ -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
|
|
data/lib/docxify/element/file.rb
CHANGED
@@ -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
|
data/lib/docxify/version.rb
CHANGED