sablon 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -1
- data/Gemfile.lock +7 -7
- data/README.md +9 -4
- data/lib/sablon/version.rb +1 -1
- data/sablon.gemspec +3 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e16970433666e2bf9e6b249f1b8d5a303cdbc3ea
|
4
|
+
data.tar.gz: 9f83b36343344a76cacc66281ac0a4d49b1a54e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d198d1253d723e102eed56dd83be87409678c1301631ee0fdd1587ad6716177afd27ffb8c7a5e1a5ee48955bedbb05a24fc7c5e1292c04dec8448c41e4140408
|
7
|
+
data.tar.gz: 2c6cf0df9b2d343e88bfbc7a5d262aa57198cc8a95311998111548d5f5efe0c35e629ab544bccb03a405746c07c40907b3b648a2eb8cdbd46e75abcb82d5439b
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sablon (0.3.
|
5
|
-
nokogiri (>= 1.
|
4
|
+
sablon (0.3.2)
|
5
|
+
nokogiri (>= 1.8.5)
|
6
6
|
rubyzip (>= 1.1.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
mini_portile2 (2.
|
11
|
+
mini_portile2 (2.4.0)
|
12
12
|
minitest (5.10.3)
|
13
|
-
nokogiri (1.
|
14
|
-
mini_portile2 (~> 2.
|
13
|
+
nokogiri (1.9.1)
|
14
|
+
mini_portile2 (~> 2.4.0)
|
15
15
|
rake (12.3.0)
|
16
|
-
rubyzip (1.2.
|
16
|
+
rubyzip (1.2.3)
|
17
17
|
xml-simple (1.1.5)
|
18
18
|
|
19
19
|
PLATFORMS
|
@@ -27,4 +27,4 @@ DEPENDENCIES
|
|
27
27
|
xml-simple
|
28
28
|
|
29
29
|
BUNDLED WITH
|
30
|
-
1.16.
|
30
|
+
1.16.1
|
data/README.md
CHANGED
@@ -192,9 +192,10 @@ html_body = <<-HTML.strip
|
|
192
192
|
</table>
|
193
193
|
HTML
|
194
194
|
context = {
|
195
|
-
article: Sablon.content(:html, html_body) }
|
196
|
-
#
|
197
|
-
#
|
195
|
+
article: Sablon.content(:html, html_body) },
|
196
|
+
# Or use html: prefix to make sablon parse the value as HTML.
|
197
|
+
# Does the same as above.
|
198
|
+
'html:article' => html_body
|
198
199
|
}
|
199
200
|
template.render_to_file File.expand_path("~/Desktop/output.docx"), context
|
200
201
|
```
|
@@ -256,10 +257,14 @@ sources such as file paths, URLs, or any object that exposes a `#read`
|
|
256
257
|
method that returns image data. When using a "readable object" if the object
|
257
258
|
doesn't have a `#filename` method then a `filename: '...'` option
|
258
259
|
needs to be added to the `Sablon.content` method call.
|
260
|
+
|
261
|
+
By default the inserted image takes the dimensions of the placeholder. The size of an image can also be defined dynamically by specifying width and height with unit (cm or in) in a properties hash like `properties: {height: "2cm", width: "20cm"}`
|
262
|
+
|
259
263
|
```ruby
|
260
264
|
context = {
|
261
265
|
figure: Sablon.content(:image, 'fixtures/images/c3po.jpg'),
|
262
|
-
figure2: Sablon.content(:image, string_io_obj, filename: 'test.png')
|
266
|
+
figure2: Sablon.content(:image, string_io_obj, filename: 'test.png'),
|
267
|
+
figure3: Sablon.content(:image, string_io_obj, filename: 'test.png', properties: {height: '2cm', width: '2cm'})
|
263
268
|
# alternative method using special key format for simple paths and URLs
|
264
269
|
# 'image:figure' => 'fixtures/images/c3po.jpg'
|
265
270
|
}
|
data/lib/sablon/version.rb
CHANGED
data/sablon.gemspec
CHANGED
@@ -19,7 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.
|
22
|
+
spec.required_ruby_version = '>= 2.2'
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'nokogiri', ">= 1.8.5"
|
23
25
|
spec.add_runtime_dependency 'rubyzip', ">= 1.1.1"
|
24
26
|
|
25
27
|
spec.add_development_dependency "bundler", ">= 1.6"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sablon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Senn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.8.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.8.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
235
|
requirements:
|
236
236
|
- - ">="
|
237
237
|
- !ruby/object:Gem::Version
|
238
|
-
version: '
|
238
|
+
version: '2.2'
|
239
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
241
|
- - ">="
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
245
|
rubyforge_project:
|
246
|
-
rubygems_version: 2.
|
246
|
+
rubygems_version: 2.4.5.2
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: docx template processor
|