sablon 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/exe/sablon +4 -2
- data/lib/sablon/processor.rb +2 -2
- data/lib/sablon/version.rb +1 -1
- data/test/fixtures/recipe_context.json +5 -0
- data/test/fixtures/recipe_sample.docx +0 -0
- data/test/fixtures/recipe_template.docx +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32d344154e7d3212cf75d5360c2f593122bd082
|
4
|
+
data.tar.gz: 2224e7a3f29c836876bae9aa12cb812c91feb2fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 711140b3b7ea9723188d5937d79d8fc8be86a76ccad7b9d3ae1c60c268da0ed072b129c9eef4447183c150bcdec7c98c08d1735836a67b1c9109dd500b3b7d0a
|
7
|
+
data.tar.gz: 04000b91fb2cd8e4941a5b1bb073bf22f73a8d1de5214f5b9b6eff8a25942bc60946126235fffa457dd14feac8fb9b13a1472878848ec89d33606ad803f6a0e8
|
data/Gemfile.lock
CHANGED
data/exe/sablon
CHANGED
@@ -13,12 +13,14 @@ end
|
|
13
13
|
template_path = File.expand_path(ARGV[0])
|
14
14
|
context_json = STDIN.readlines.join
|
15
15
|
context = JSON.parse(context_json)
|
16
|
+
config = context.delete("_sablon") || {}
|
17
|
+
section_properties = config.fetch("properties", {})
|
16
18
|
|
17
19
|
template = Sablon.template(template_path)
|
18
20
|
|
19
21
|
if !ARGV[1].nil? && !ARGV[1].empty?
|
20
22
|
output_path = File.expand_path(ARGV[1])
|
21
|
-
template.render_to_file(output_path, context)
|
23
|
+
template.render_to_file(output_path, context, section_properties)
|
22
24
|
else
|
23
|
-
$stdout.print template.render_to_string(context)
|
25
|
+
$stdout.print template.render_to_string(context, section_properties)
|
24
26
|
end
|
data/lib/sablon/processor.rb
CHANGED
@@ -26,9 +26,9 @@ module Sablon
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def write_properties(xml_node, properties)
|
29
|
-
if properties
|
29
|
+
if start_page_number = properties[:start_page_number] || properties["start_page_number"]
|
30
30
|
section_properties = SectionProperties.from_document(xml_node)
|
31
|
-
section_properties.start_page_number =
|
31
|
+
section_properties.start_page_number = start_page_number
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
data/lib/sablon/version.rb
CHANGED
Binary file
|
Binary file
|
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.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Senn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
200
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.4.5
|
201
|
+
rubygems_version: 2.4.5.1
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: docx tempalte processor
|