sablon 0.4.2 → 0.4.3
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 +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/Gemfile.lock +10 -8
- data/lib/sablon/configuration/html_tag.rb +1 -1
- data/lib/sablon/template.rb +7 -1
- data/lib/sablon/version.rb +1 -1
- data/sablon.gemspec +1 -0
- data/test/content_test.rb +4 -1
- data/test/html/ast_builder_test.rb +0 -1
- data/test/html/node_properties_test.rb +8 -2
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8542b9e6de57f1ae3ce2a4b22f7af5abea8250bd2a8df10522ba176375e5aa9c
|
|
4
|
+
data.tar.gz: 2e3a1310ff7b01071b76849f5099ff5c1772e934a8ff35a6298fb1d45d8ba9e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 148a63fd1cd0afff2fbc07e6e8106caf45a13ba69b2f652e42a54bc0101add2afdd3d11f51d85a9a81641b7b382bab62d27b84adf7f80261a5bc08b1a25dc486
|
|
7
|
+
data.tar.gz: 7a277ddeb59eb6e320fae0ec34f65a86fde92ce690667bba32dd2b03f456da9d26a688037043e9dca72bdd74aca626aa1e139e0761c4203a3bf053668ce0744f
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
runs-on: 'ubuntu-latest'
|
|
16
16
|
strategy:
|
|
17
17
|
matrix:
|
|
18
|
-
ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
|
|
18
|
+
ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
|
|
19
19
|
channel: ['stable']
|
|
20
20
|
|
|
21
21
|
include:
|
data/Gemfile.lock
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
sablon (0.4.
|
|
4
|
+
sablon (0.4.3)
|
|
5
5
|
nokogiri (>= 1.8.5)
|
|
6
6
|
rubyzip (>= 1.3.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
minitest (5.
|
|
12
|
-
|
|
11
|
+
minitest (5.25.5)
|
|
12
|
+
mutex_m (0.3.0)
|
|
13
|
+
nokogiri (1.18.9-arm64-darwin)
|
|
13
14
|
racc (~> 1.4)
|
|
14
|
-
ostruct (0.6.
|
|
15
|
-
racc (1.8.
|
|
16
|
-
rake (13.
|
|
17
|
-
rexml (3.
|
|
18
|
-
rubyzip (
|
|
15
|
+
ostruct (0.6.3)
|
|
16
|
+
racc (1.8.1)
|
|
17
|
+
rake (13.3.0)
|
|
18
|
+
rexml (3.4.1)
|
|
19
|
+
rubyzip (3.0.1)
|
|
19
20
|
xml-simple (1.1.9)
|
|
20
21
|
rexml
|
|
21
22
|
|
|
@@ -25,6 +26,7 @@ PLATFORMS
|
|
|
25
26
|
DEPENDENCIES
|
|
26
27
|
bundler (>= 1.6)
|
|
27
28
|
minitest (~> 5.4)
|
|
29
|
+
mutex_m
|
|
28
30
|
ostruct
|
|
29
31
|
rake (~> 13.0)
|
|
30
32
|
sablon!
|
data/lib/sablon/template.rb
CHANGED
|
@@ -53,7 +53,13 @@ module Sablon
|
|
|
53
53
|
|
|
54
54
|
def render(context, properties = {})
|
|
55
55
|
# initialize environment
|
|
56
|
-
@document = Sablon::DOM::Model.new(
|
|
56
|
+
@document = Sablon::DOM::Model.new(
|
|
57
|
+
if defined?(Zip::VERSION) && Gem::Version.new(Zip::VERSION) >= Gem::Version.new('3.0.0')
|
|
58
|
+
Zip::File.open(@path, create: !File.exist?(@path))
|
|
59
|
+
else
|
|
60
|
+
Zip::File.open(@path, !File.exist?(@path))
|
|
61
|
+
end
|
|
62
|
+
)
|
|
57
63
|
env = Sablon::Environment.new(self, context)
|
|
58
64
|
env.section_properties = properties
|
|
59
65
|
#
|
data/lib/sablon/version.rb
CHANGED
data/sablon.gemspec
CHANGED
data/test/content_test.rb
CHANGED
|
@@ -252,7 +252,10 @@ class ContentImageTest < Sablon::TestCase
|
|
|
252
252
|
#
|
|
253
253
|
# set some rid's and retest
|
|
254
254
|
@expected.rid_by_file['word/test.xml'] = 'rId1'
|
|
255
|
-
|
|
255
|
+
assert_includes [
|
|
256
|
+
'#<Image r2d2.jpg:{"word/test.xml"=>"rId1"}>',
|
|
257
|
+
'#<Image r2d2.jpg:{"word/test.xml" => "rId1"}>'
|
|
258
|
+
], @expected.inspect
|
|
256
259
|
end
|
|
257
260
|
|
|
258
261
|
def test_wraps_image_from_string_path
|
|
@@ -24,7 +24,6 @@ class HTMLConverterASTBuilderTest < Sablon::TestCase
|
|
|
24
24
|
|
|
25
25
|
def test_validate_structure
|
|
26
26
|
@builder = new_builder
|
|
27
|
-
root = Sablon::Configuration.instance.permitted_html_tags['#document-fragment'.to_sym]
|
|
28
27
|
div = Sablon::Configuration.instance.permitted_html_tags[:div]
|
|
29
28
|
span = Sablon::Configuration.instance.permitted_html_tags[:span]
|
|
30
29
|
# test valid relationship
|
|
@@ -35,14 +35,20 @@ class NodePropertiesTest < Sablon::TestCase
|
|
|
35
35
|
def test_node_property_with_hash_value_converison
|
|
36
36
|
props = { 'shd' => { color: 'clear', fill: '123456', test: nil } }
|
|
37
37
|
props = Sablon::HTMLConverter::NodeProperties.new('w:rPr', props, @inc_props.new)
|
|
38
|
-
|
|
38
|
+
assert_includes [
|
|
39
|
+
'shd={:color=>"clear", :fill=>"123456", :test=>nil}',
|
|
40
|
+
'shd={color: "clear", fill: "123456", test: nil}'
|
|
41
|
+
], props.inspect
|
|
39
42
|
assert_equal props.to_docx, '<w:rPr><w:shd w:color="clear" w:fill="123456" /></w:rPr>'
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
def test_node_property_with_array_value_converison
|
|
43
46
|
props = { 'numPr' => [{ 'ilvl' => 1 }, { 'numId' => 34 }] }
|
|
44
47
|
props = Sablon::HTMLConverter::NodeProperties.new('w:pPr', props, @inc_props.new)
|
|
45
|
-
|
|
48
|
+
assert_includes [
|
|
49
|
+
'numPr=[{"ilvl"=>1}, {"numId"=>34}]',
|
|
50
|
+
'numPr=[{"ilvl" => 1}, {"numId" => 34}]'
|
|
51
|
+
], props.inspect
|
|
46
52
|
assert_equal props.to_docx, '<w:pPr><w:numPr><w:ilvl w:val="1" /><w:numId w:val="34" /></w:numPr></w:pPr>'
|
|
47
53
|
end
|
|
48
54
|
|
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.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yves Senn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -108,6 +108,20 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: mutex_m
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
111
125
|
description: Sablon is a document template processor. At this time it works only with
|
|
112
126
|
docx and MailMerge fields.
|
|
113
127
|
email:
|