sablon 0.0.12 → 0.0.13
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/lib/sablon/context.rb +5 -1
- data/lib/sablon/version.rb +1 -1
- data/test/context_test.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2ac0ffd05db94be984b1526dfc131069ec6e1e9
|
4
|
+
data.tar.gz: 20c5be46b492e483ca80adb0ab2c12369b013e09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d2389d94d4a2e491b22409e2eb3c398dc8214396db5bc4021a799c741aa9fc1f38dec0d83a69cfc5ea470a53e6eb8b24f8470e146400a8cc273fd25d3379c63
|
7
|
+
data.tar.gz: 1e9b42b3cd443d3bcd33b2b64a3a16eaa959215972441ebf55e973b096bb86c9c3f6440da8dbc269eec289ea34e898fce852900e1d210f9536710361c2d386ad
|
data/Gemfile.lock
CHANGED
data/lib/sablon/context.rb
CHANGED
@@ -10,7 +10,11 @@ module Sablon
|
|
10
10
|
|
11
11
|
def self.transform_pair(key, value)
|
12
12
|
if key =~ /\A([^:]+):(.+)\z/
|
13
|
-
|
13
|
+
if value.nil?
|
14
|
+
[$2, value]
|
15
|
+
else
|
16
|
+
[$2, Sablon.content($1.to_sym, value)]
|
17
|
+
end
|
14
18
|
else
|
15
19
|
transform_standard_key(key, value)
|
16
20
|
end
|
data/lib/sablon/version.rb
CHANGED
data/test/context_test.rb
CHANGED
@@ -12,4 +12,17 @@ class ContextTest < Sablon::TestCase
|
|
12
12
|
assert_equal({ "mykey"=>Sablon.content(:word_ml, "<w:p><w:p>"),
|
13
13
|
"otherkey"=>"<nope>"}, transformed)
|
14
14
|
end
|
15
|
+
|
16
|
+
def test_recognizes_markdown_keys
|
17
|
+
transformed = Sablon::Context.transform({"markdown:mykey" => "**yay**", "otherkey" => "<nope>"})
|
18
|
+
assert_equal({ "mykey"=>Sablon.content(:markdown, "**yay**"),
|
19
|
+
"otherkey"=>"<nope>"}, transformed)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_does_not_wrap_markdown_and_wordml_with_nil_value
|
23
|
+
transformed = Sablon::Context.transform({"markdown:mykey" => nil, "word_ml:otherkey" => nil, "normalkey" => nil})
|
24
|
+
assert_equal({ "mykey" => nil,
|
25
|
+
"otherkey" => nil,
|
26
|
+
"normalkey" => nil}, transformed)
|
27
|
+
end
|
15
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Senn
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
196
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.4.
|
197
|
+
rubygems_version: 2.4.5
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
200
|
summary: docx tempalte processor
|