Html2Docx 0.4.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 017b26938d108a96e8e1647f79116d5e565c8dd4
4
- data.tar.gz: 96c3a64c912c94b56c29441ff3a34010b07d5530
3
+ metadata.gz: 538d0ec477575611c29e823c9ba235b41a21c57b
4
+ data.tar.gz: 1d24f9b1e5707228406bba31781836da5d28ea4f
5
5
  SHA512:
6
- metadata.gz: 2819e07fc26bb64efc2e3204924d2634b9480965ae3df8b84e5d90d16b188dbcce555ffcd5f60dfd2060608337b6a45d3c64f25f224c1b22356bef6e051ff1e4
7
- data.tar.gz: da7db33474188e9f1f58493866d674c9ce932a40a955d284ee30e0e1b9527d9479c6aa2308d79afa6347b71e3a7f56822accb6d6fcfda1852c3efcda554542ec
6
+ metadata.gz: 1ff9fbb4ae6fec24da2351d2d1763dfcd5dcdaf8f1719ef6941e7b5227b28eb2cd419fdbaf8756143d1912080e6cfdd132c1e7c1206edebad300bdc770b5cdd5
7
+ data.tar.gz: 1ef1417d60ac41a7c5aea90d90dc058b0860bad257d5b617e9a0878b350954a1b5e896a175bd893d6c190f5311153ca7492a5aee19a73951c781807bfda9f874
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rspec', '~> 3.0'
26
26
  spec.add_runtime_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
27
27
  spec.add_runtime_dependency 'rubyzip', '~> 1.2', '>= 1.2.0'
28
+ spec.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
28
29
  end
data/README.md CHANGED
@@ -27,6 +27,8 @@ Html2Docx has very easy usage.
27
27
  * Supporting paragraph. [Wiki - Paragraph Usage](https://github.com/MuhammetDilmac/Html2Docx/wiki/Paragraph-Usage)
28
28
  * Supporting heading. [Wiki - Heading Usage](https://github.com/MuhammetDilmac/Html2Docx/wiki/Heading-Usage)
29
29
  * Supporting internal links. [Wiki - Internal Links Usage](https://github.com/MuhammetDilmac/Html2Docx/wiki/Internal-Links-Usage)
30
+ * Supporting extarnal links. [Wiki - Extarnal Links Usage](https://github.com/MuhammetDilmac/Html2Docx/wiki/External-Links-Usage)
31
+ * Supporting image(internal & external). [Wiki - Image Usage](https://github.com/MuhammetDilmac/Html2Docx/wiki/Image-Usage)
30
32
 
31
33
  ## Contributing
32
34
 
@@ -1,6 +1,7 @@
1
1
  require 'fileutils'
2
2
  require 'nokogiri'
3
3
  require 'zip'
4
+ require 'typhoeus'
4
5
 
5
6
  require 'Html2Docx/helpers/document_helper'
6
7
  require 'Html2Docx/helpers/nokogiri_helper'
@@ -14,6 +15,7 @@ require 'Html2Docx/document'
14
15
 
15
16
  require 'Html2Docx/document_objects/paragraph'
16
17
  require 'Html2Docx/document_objects/heading'
18
+ require 'Html2Docx/document_objects/image'
17
19
 
18
20
  module Html2Docx
19
21
  ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../'))
@@ -1,7 +1,8 @@
1
1
  module Html2Docx
2
2
  class Document
3
3
  def initialize(options = {})
4
- @document_file = File.join(options.fetch(:temp), 'word', 'document2.xml')
4
+ @tmp_path = options[:temp]
5
+ @document_file = File.join(@tmp_path, 'word', 'document2.xml')
5
6
  @document = File.open(@document_file) { |f| Nokogiri::XML(f) }
6
7
  @body = @document.at_xpath('//w:body')
7
8
  @contents = []
@@ -26,11 +27,11 @@ module Html2Docx
26
27
  case element.name
27
28
  when 'p'
28
29
  # Add paragraph
29
- paragraph = DocumentObjects::Paragraph.new(@document, @relation)
30
+ paragraph = DocumentObjects::Paragraph.new(@document, @relation, @tmp_path)
30
31
  paragraph.add_paragraph(element)
31
32
  @contents.push paragraph.render
32
33
  when /h[1-9]/
33
- heading = DocumentObjects::Heading.new(@document, @relation)
34
+ heading = DocumentObjects::Heading.new(@document, @relation, @tmp_path)
34
35
  heading.add_heading(element)
35
36
  @contents.push heading.render
36
37
  when 'table'
@@ -1,9 +1,11 @@
1
1
  module Html2Docx
2
2
  module DocumentObjects
3
3
  class Heading
4
- def initialize(document, relation)
4
+ def initialize(document, relation, tmp_path)
5
5
  @document = document
6
6
  @relation = relation
7
+ @tmp_path = tmp_path
8
+
7
9
  @heading = nil
8
10
  end
9
11
 
@@ -11,7 +13,7 @@ module Html2Docx
11
13
  heading_object['class'] = "Heading#{heading_object.name.scan(/[0-9]/).first}"
12
14
  heading_object.name = 'p'
13
15
 
14
- paragraph = Paragraph.new(@document, @relation)
16
+ paragraph = Paragraph.new(@document, @relation, @tmp_path)
15
17
  paragraph.add_paragraph(heading_object)
16
18
 
17
19
  @heading = paragraph.render
@@ -0,0 +1,243 @@
1
+ module Html2Docx
2
+ module DocumentObjects
3
+ class Image
4
+ def initialize(document, relation, tmp_path)
5
+ @document = document
6
+ @relation = relation
7
+ @tmp_path = tmp_path
8
+
9
+ @media_path = nil
10
+ @image = nil
11
+
12
+ check_and_create_media_directory
13
+ end
14
+
15
+ def add_image(image_object)
16
+ image = get_image_information(image_object)
17
+ drawing_tag = create_drawing_tag
18
+ inline_tag = create_inline_tag
19
+ doc_pr_tag = create_doc_pr_tag(image)
20
+ graphic_tag = create_graphic_tag(image)
21
+ extent_tag = create_extent_tag(image)
22
+ c_nv_graphic_frame_pr = create_c_nv_graphic_frame_pr(image)
23
+
24
+ inline_tag.add_child(extent_tag)
25
+ inline_tag.add_child(doc_pr_tag)
26
+ inline_tag.add_child(c_nv_graphic_frame_pr)
27
+ inline_tag.add_child(graphic_tag)
28
+ drawing_tag.add_child(inline_tag)
29
+
30
+ drawing_tag
31
+ end
32
+
33
+ private
34
+
35
+ def get_image_information(image_object)
36
+ id = @relation.get_latest_image_id + 1
37
+ path = image_object.attr('src')
38
+ name = path.split('/').last
39
+ title = image_object.attr('alt') || "Picture-#{id}"
40
+ height = image_object.attr('height').to_i
41
+ width = image_object.attr('width').to_i
42
+
43
+ { name: name, title: title, path: path, height: height, width: width }
44
+ end
45
+
46
+ def create_drawing_tag
47
+ Nokogiri::XML::Node.new('w:drawing', @document)
48
+ end
49
+
50
+ def create_inline_tag
51
+ anchor_tag = Nokogiri::XML::Node.new('wp:inline', @document)
52
+
53
+ anchor_tag
54
+ end
55
+
56
+ def create_doc_pr_tag(image)
57
+ doc_pr_tag = Nokogiri::XML::Node.new('wp:docPr', @document)
58
+ doc_pr_tag['id'] = @relation.get_uniq_image_id
59
+ doc_pr_tag['name'] = image[:name]
60
+ doc_pr_tag['title'] = image[:title]
61
+
62
+ doc_pr_tag
63
+ end
64
+
65
+ def check_and_create_media_directory
66
+ @media_path = File.join(@tmp_path, 'media')
67
+
68
+ Dir.mkdir @media_path unless Dir.exist? @media_path
69
+ end
70
+
71
+ def create_graphic_tag(image)
72
+ graphic_tag = Nokogiri::XML::Node.new('a:graphic', @document)
73
+
74
+ graphic_data_tag = create_graphic_data_tag(image)
75
+ graphic_tag.add_child(graphic_data_tag)
76
+
77
+ graphic_tag
78
+ end
79
+
80
+ def create_graphic_data_tag(image)
81
+ graphic_data_tag = Nokogiri::XML::Node.new('a:graphicData', @document)
82
+ graphic_data_tag['uri'] = 'http://schemas.openxmlformats.org/drawingml/2006/picture'
83
+
84
+ pic_tag = create_pic_tag(image)
85
+ graphic_data_tag.add_child(pic_tag)
86
+
87
+ graphic_data_tag
88
+ end
89
+
90
+ def create_pic_tag(image)
91
+ pic_tag = Nokogiri::XML::Node.new('pic:pic', @document)
92
+
93
+ nv_pic_pr_tag = create_nv_pic_pr_tag(image)
94
+ pic_tag.add_child(nv_pic_pr_tag)
95
+
96
+ blip_fill_tag = create_blip_fill_tag(image)
97
+ pic_tag.add_child(blip_fill_tag)
98
+
99
+ sp_pr_tag = create_sp_pr_tag(image)
100
+ pic_tag.add_child(sp_pr_tag)
101
+
102
+ pic_tag
103
+ end
104
+
105
+ def create_nv_pic_pr_tag(image)
106
+ nv_pic_pr_tag = Nokogiri::XML::Node.new('pic:nvPicPr', @document)
107
+
108
+ c_nv_pr_tag = create_c_nv_pr_tag(image)
109
+ nv_pic_pr_tag.add_child(c_nv_pr_tag)
110
+
111
+ c_nv_pic_pr = create_c_nv_pic_pr(image)
112
+ nv_pic_pr_tag.add_child(c_nv_pic_pr)
113
+
114
+ nv_pic_pr_tag
115
+ end
116
+
117
+ def create_c_nv_pr_tag(image)
118
+ c_nv_pr_tag = Nokogiri::XML::Node.new('pic:cNvPr', @document)
119
+ c_nv_pr_tag['id'] = @relation.get_uniq_image_id
120
+ c_nv_pr_tag['name'] = image[:name]
121
+ c_nv_pr_tag['title'] = image[:title]
122
+
123
+ c_nv_pr_tag
124
+ end
125
+
126
+ def create_c_nv_pic_pr(image)
127
+ c_nv_pic_pr_tag = Nokogiri::XML::Node.new('pic:cNvPicPr', @document)
128
+
129
+ c_nv_pic_pr_tag
130
+ end
131
+
132
+ def create_blip_fill_tag(image)
133
+ blip_fill_tag = Nokogiri::XML::Node.new('pic:blipFill', @document)
134
+
135
+ blip_tag = create_blip_tag(image)
136
+ blip_fill_tag.add_child(blip_tag)
137
+
138
+ stretch_tag = create_stretch_tag
139
+ blip_fill_tag.add_child(stretch_tag)
140
+
141
+ blip_fill_tag
142
+ end
143
+
144
+ def create_blip_tag(image)
145
+ blip_tag = Nokogiri::XML::Node.new('a:blip', @document)
146
+ blip_tag['r:embed'] = @relation.add_image(image, @media_path)
147
+
148
+ blip_tag
149
+ end
150
+
151
+ def create_stretch_tag
152
+ stretch_tag = Nokogiri::XML::Node.new('a:stretch', @document)
153
+
154
+ fill_rect_tag = create_fill_rect_tag
155
+ stretch_tag.add_child(fill_rect_tag)
156
+
157
+ stretch_tag
158
+ end
159
+
160
+ def create_fill_rect_tag
161
+ Nokogiri::XML::Node.new('a:fillRect', @document)
162
+ end
163
+
164
+ def create_sp_pr_tag(image)
165
+ sp_pr_tag = Nokogiri::XML::Node.new('pic:spPr', @document)
166
+
167
+ xfrm_tag = create_xfrm_tag(image)
168
+ sp_pr_tag.add_child(xfrm_tag)
169
+
170
+ prst_geom_tag = create_prst_geom_tag(image)
171
+ sp_pr_tag.add_child(prst_geom_tag)
172
+
173
+ sp_pr_tag
174
+ end
175
+
176
+ def create_xfrm_tag(image)
177
+ xfrm_tag = Nokogiri::XML::Node.new('a:xfrm', @document)
178
+
179
+ off_tag = create_off_tag(image)
180
+ xfrm_tag.add_child(off_tag)
181
+
182
+ ext_tag = create_ext_tag(image)
183
+ xfrm_tag.add_child(ext_tag)
184
+
185
+ xfrm_tag
186
+ end
187
+
188
+ def create_off_tag(image)
189
+ off_tag = Nokogiri::XML::Node.new('a:off', @document)
190
+ off_tag['x'] = '0'
191
+ off_tag['y'] = '0'
192
+
193
+ off_tag
194
+ end
195
+
196
+ def create_ext_tag(image)
197
+ ext_tag = Nokogiri::XML::Node.new('a:ext', @document)
198
+ ext_tag['cx'] = image[:width] * 9525
199
+ ext_tag['cy'] = image[:height] * 9525
200
+
201
+ ext_tag
202
+ end
203
+
204
+ def create_prst_geom_tag(image)
205
+ prst_geom_tag = Nokogiri::XML::Node.new('a:prstGeom', @document)
206
+ prst_geom_tag['prst'] = 'rect'
207
+
208
+ av_lst_tag = create_av_lst_tag(image)
209
+ prst_geom_tag.add_child(av_lst_tag)
210
+
211
+ prst_geom_tag
212
+ end
213
+
214
+ def create_av_lst_tag(image)
215
+ Nokogiri::XML::Node.new('a:avLst', @document)
216
+ end
217
+
218
+ def create_extent_tag(image)
219
+ ext_tag = Nokogiri::XML::Node.new('wp:extent', @document)
220
+ ext_tag['cx'] = image[:width] * 9525
221
+ ext_tag['cy'] = image[:height] * 9525
222
+
223
+ ext_tag
224
+ end
225
+
226
+ def create_c_nv_graphic_frame_pr(image)
227
+ c_nv_graphic_frame_pr_tag = Nokogiri::XML::Node.new('wp:cNvGraphicFramePr', @document)
228
+
229
+ graphic_frame_locks_tag = create_graphic_frame_locks_tag(image)
230
+ c_nv_graphic_frame_pr_tag.add_child(graphic_frame_locks_tag)
231
+
232
+ c_nv_graphic_frame_pr_tag
233
+ end
234
+
235
+ def create_graphic_frame_locks_tag(image)
236
+ graphic_frame_locks_tag = Nokogiri::XML::Node.new('a:graphicFrameLocks', @document)
237
+ graphic_frame_locks_tag['noChangeAspect'] = 1
238
+
239
+ graphic_frame_locks_tag
240
+ end
241
+ end
242
+ end
243
+ end
@@ -1,9 +1,10 @@
1
1
  module Html2Docx
2
2
  module DocumentObjects
3
3
  class Paragraph
4
- def initialize(document, relation)
4
+ def initialize(document, relation, tmp_path)
5
5
  @document = document
6
6
  @relation = relation
7
+ @tmp_path = tmp_path
7
8
  @paragraph = nil
8
9
  end
9
10
 
@@ -135,6 +136,10 @@ module Html2Docx
135
136
  hyperlink_tag.add_child text_field
136
137
  @paragraph.add_child hyperlink_tag
137
138
  next
139
+ when 'img'
140
+ text_field.add_child add_image(child)
141
+ @paragraph.add_child(text_field)
142
+ next
138
143
  end
139
144
 
140
145
  paragraph_id = child.attr('id')
@@ -220,6 +225,11 @@ module Html2Docx
220
225
  text_style
221
226
  end
222
227
 
228
+ def add_image(image)
229
+ image_object_helper = DocumentObjects::Image.new(@document, @relation, @tmp_path)
230
+ image_object_helper.add_image(image)
231
+ end
232
+
223
233
  def render
224
234
  @paragraph
225
235
  end
@@ -7,6 +7,8 @@ module Html2Docx
7
7
  @last_relation_id = 1
8
8
  @internal_links = {}
9
9
  @external_links = {}
10
+ @images = {}
11
+ @unique_image_id = 0
10
12
 
11
13
  if options[:main_relation]
12
14
  @relation_file = File.join(options.fetch(:temp), 'word', '_rels', 'document2.xml.rels')
@@ -59,15 +61,24 @@ module Html2Docx
59
61
  end
60
62
  end
61
63
 
64
+ def get_latest_internal_link_id
65
+ @internal_links.keys.max || 0
66
+ end
67
+
68
+ def find_internal_link_id(name)
69
+ @internal_links.find{ |key, value| value == name }
70
+ end
71
+
62
72
  def create_external_link_id(destination)
63
73
  id, value = find_external_link_id(destination)
64
74
 
65
75
  if id
66
76
  id
67
77
  else
68
- id = get_latest_external_link_id.delete('rId').to_i + 1
69
- @external_links["rId#{id}"] = destination
70
- "rId#{id}"
78
+ id = get_latest_external_link_id.delete('elId').to_i + 1
79
+ @external_links["elId#{id}"] = destination
80
+
81
+ "elId#{id}"
71
82
  end
72
83
  end
73
84
 
@@ -76,28 +87,85 @@ module Html2Docx
76
87
  end
77
88
 
78
89
  def get_latest_external_link_id
79
- @external_links.keys.max || "rId0"
90
+ @external_links.keys.max || 'elId0'
80
91
  end
81
92
 
82
- def get_latest_internal_link_id
83
- @internal_links.keys.max || 0
93
+ def get_uniq_image_id
94
+ @unique_image_id = @unique_image_id + 1
84
95
  end
85
96
 
86
- def find_internal_link_id(name)
87
- @internal_links.find{ |key, value| value == name }
97
+ def add_image(image, media_path)
98
+ real_path = image[:path]
99
+ image_name = image[:path].split('/').last
100
+ current_path = File.join(media_path, image_name)
101
+
102
+ if real_path.start_with? 'http'
103
+ request = Typhoeus::Request.new(real_path)
104
+ image_file = File.open(current_path, 'wb+')
105
+
106
+ request.on_headers do |response|
107
+ if response.code != 200
108
+ raise "Image not found! Image Path: #{real_path}"
109
+ end
110
+ end
111
+
112
+ request.on_body do |data|
113
+ image_file.write(data)
114
+ end
115
+
116
+ request.on_complete do |response|
117
+ image_file.close
118
+ end
119
+
120
+ request.run
121
+ else
122
+ if File.exist? real_path
123
+ FileUtils.cp real_path, current_path
124
+ else
125
+ raise "Image not found! Image Path: #{real_path}"
126
+ end
127
+ end
128
+
129
+ relation_image_path = File.join('/', 'media', image_name)
130
+
131
+ add_image_relation(relation_image_path)
132
+ end
133
+
134
+ def add_image_relation(relation_image_path)
135
+ image_id = "iId#{get_uniq_image_id}"
136
+
137
+ @images[image_id] = {
138
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
139
+ target: relation_image_path
140
+ }
141
+
142
+ image_id
143
+ end
144
+
145
+ def get_latest_image_id
146
+ @images.keys.max.to_i
88
147
  end
89
148
 
90
149
  def render
91
150
  @external_links.each do |key, value|
92
151
  external_link_relation = Nokogiri::XML::Node.new('Relationship', @relation)
93
- external_link_relation['Id'] = key
94
- external_link_relation['Type'] = 'http://. . ./hyperlink'
152
+ external_link_relation['Type'] = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink'
95
153
  external_link_relation['Target'] = value
96
154
  external_link_relation['TargetMode'] = 'External'
155
+ external_link_relation['Id'] = key
97
156
 
98
157
  @relation.root.add_child(external_link_relation)
99
158
  end
100
159
 
160
+ @images.each do |key, value|
161
+ image_relation = Nokogiri::XML::Node.new('Relationship', @relation)
162
+ image_relation['Type'] = value[:type]
163
+ image_relation['Target'] = value[:target]
164
+ image_relation['Id'] = key
165
+
166
+ @relation.root.add_child(image_relation)
167
+ end
168
+
101
169
  File.open(@relation_file, 'w') { |f| f.write(Helpers::NokogiriHelper.to_xml(@relation)) }
102
170
  end
103
171
  end
@@ -1,3 +1,3 @@
1
1
  module Html2Docx
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
Binary file
@@ -1 +1 @@
1
- <?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="xml" ContentType="application/xml" /><Override PartName="/word/document2.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" /><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" /><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" /><Override PartName="/word/webSettings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml" /><Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" /><Override PartName="/word/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml" /><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" /></Types>
1
+ <?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="xml" ContentType="application/xml" /><Default Extension="jpg" ContentType="image/jpeg" /><Default Extension="png" ContentType="image/png" /><Override PartName="/word/document2.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" /><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" /><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" /><Override PartName="/word/webSettings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml" /><Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" /><Override PartName="/word/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml" /><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" /></Types>
@@ -1 +1 @@
1
- <?xml version="1.0" encoding="utf-8" standalone="yes"?><w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 wp14"><w:body><w:p w14:paraId="2C078E63" wp14:textId="77777777" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordml"><w:bookmarkStart w:id="0" w:name="_GoBack" /><w:bookmarkEnd w:id="0" /></w:p><w:sectPr><w:pgSz w:w="12240" w:h="15840" /><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0" /><w:cols w:space="720" /><w:docGrid w:linePitch="360" /></w:sectPr></w:body></w:document>
1
+ <?xml version="1.0" encoding="utf-8" standalone="yes"?><w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" mc:Ignorable="w14 w15 wp14"><w:body><w:p w14:paraId="2C078E63" wp14:textId="77777777" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordml"><w:bookmarkStart w:id="0" w:name="_GoBack" /><w:bookmarkEnd w:id="0" /></w:p><w:sectPr><w:pgSz w:w="12240" w:h="15840" /><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0" /><w:cols w:space="720" /><w:docGrid w:linePitch="360" /></w:sectPr></w:body></w:document>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Html2Docx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MuhammetDilmac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-03 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,6 +92,26 @@ dependencies:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: 1.2.0
95
+ - !ruby/object:Gem::Dependency
96
+ name: typhoeus
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '1.0'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 1.0.1
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.0'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 1.0.1
95
115
  description: Ruby library for creating Docx from HTML output
96
116
  email:
97
117
  - iletisim@muhammetdilmac.com.tr
@@ -113,6 +133,7 @@ files:
113
133
  - lib/Html2Docx/content_types.rb
114
134
  - lib/Html2Docx/document.rb
115
135
  - lib/Html2Docx/document_objects/heading.rb
136
+ - lib/Html2Docx/document_objects/image.rb
116
137
  - lib/Html2Docx/document_objects/paragraph.rb
117
138
  - lib/Html2Docx/helpers/document_helper.rb
118
139
  - lib/Html2Docx/helpers/nokogiri_helper.rb
@@ -123,6 +144,7 @@ files:
123
144
  - samples/EmptyPage.docx
124
145
  - samples/Heading.docx
125
146
  - samples/Links.docx
147
+ - samples/Picture.docx
126
148
  - samples/TwoParagraphWithStrongItalicUnderLineAndStroke.docx
127
149
  - skell/[Content_Types].xml
128
150
  - skell/_rels/.rels