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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5407a184ceb161ef62b83c2df14b219cb6711f6b
4
- data.tar.gz: fa4c9f089dc648d75ef8b2be51c53c5702c0541a
3
+ metadata.gz: a32d344154e7d3212cf75d5360c2f593122bd082
4
+ data.tar.gz: 2224e7a3f29c836876bae9aa12cb812c91feb2fd
5
5
  SHA512:
6
- metadata.gz: f6da7577308e61e55a61c8f544ecc985d6c3f929d9adb47f07e7ff7fd2ba0e2aecf800765a55beb87434d19cfb096c569cc42e8ecacde6ad7adc2dbcc74830f6
7
- data.tar.gz: 3810028838dc0b53deda64ff0d24e8773f917783092b3cce70d725d097a3e9104b63e1c98be3cf724342f57b9176fa99551a7f577ecc260ff7dfd4a1e622d567
6
+ metadata.gz: 711140b3b7ea9723188d5937d79d8fc8be86a76ccad7b9d3ae1c60c268da0ed072b129c9eef4447183c150bcdec7c98c08d1735836a67b1c9109dd500b3b7d0a
7
+ data.tar.gz: 04000b91fb2cd8e4941a5b1bb073bf22f73a8d1de5214f5b9b6eff8a25942bc60946126235fffa457dd14feac8fb9b13a1472878848ec89d33606ad803f6a0e8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sablon (0.0.17)
4
+ sablon (0.0.18)
5
5
  nokogiri (>= 1.6.0)
6
6
  redcarpet (>= 3.2)
7
7
  rubyzip (>= 1.1)
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
@@ -26,9 +26,9 @@ module Sablon
26
26
  end
27
27
 
28
28
  def write_properties(xml_node, properties)
29
- if properties.key? :start_page_number
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 = properties[:start_page_number]
31
+ section_properties.start_page_number = start_page_number
32
32
  end
33
33
  end
34
34
 
@@ -1,3 +1,3 @@
1
1
  module Sablon
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -1,4 +1,9 @@
1
1
  {
2
+ "_sablon": {
3
+ "properties": {
4
+ "start_page_number": 42
5
+ }
6
+ },
2
7
  "metadata": {
3
8
  "generator": "Sablon",
4
9
  "author": {
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.17
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-09-25 00:00:00.000000000 Z
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