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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5e1eb2032c1dabea9541897a7c808ac60f231f05433b692e5065f03f170ce9b
4
- data.tar.gz: 1b81c62aff7f9a1a3993fb73e6d25b8b0e6723914d8470c014c49116df25aaad
3
+ metadata.gz: 8542b9e6de57f1ae3ce2a4b22f7af5abea8250bd2a8df10522ba176375e5aa9c
4
+ data.tar.gz: 2e3a1310ff7b01071b76849f5099ff5c1772e934a8ff35a6298fb1d45d8ba9e7
5
5
  SHA512:
6
- metadata.gz: 6117e358ac595e371761bb2d66bae3e874cb59ddae8626bc440940b926e7e247c372d1cf16ee7e77c8de7bfed4e94d7015c2c7cdeab616f90f2d126446a784b8
7
- data.tar.gz: 23db1f9f4f9b7d393cd12eaae8b84545119fe85e1b107069e9edfd6e0e375bed82a53eb5ca4df9e4f3f44bbba51c089578ba5d515197d551407e6cff4cfe744a
6
+ metadata.gz: 148a63fd1cd0afff2fbc07e6e8106caf45a13ba69b2f652e42a54bc0101add2afdd3d11f51d85a9a81641b7b382bab62d27b84adf7f80261a5bc08b1a25dc486
7
+ data.tar.gz: 7a277ddeb59eb6e320fae0ec34f65a86fde92ce690667bba32dd2b03f456da9d26a688037043e9dca72bdd74aca626aa1e139e0761c4203a3bf053668ce0744f
@@ -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.2)
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.20.0)
12
- nokogiri (1.18.8-arm64-darwin)
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.0)
15
- racc (1.8.0)
16
- rake (13.1.0)
17
- rexml (3.2.6)
18
- rubyzip (2.3.2)
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!
@@ -86,7 +86,7 @@ module Sablon
86
86
  @ast_class = value
87
87
  return
88
88
  else
89
- value = value.to_s
89
+ value = value.to_s.dup
90
90
  end
91
91
  # camel case the word and get class, similar logic to
92
92
  # ActiveSupport::Inflector.constantize but refactored to be specific
@@ -53,7 +53,13 @@ module Sablon
53
53
 
54
54
  def render(context, properties = {})
55
55
  # initialize environment
56
- @document = Sablon::DOM::Model.new(Zip::File.open(@path, !File.exist?(@path)))
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
  #
@@ -1,3 +1,3 @@
1
1
  module Sablon
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
data/sablon.gemspec CHANGED
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "minitest", "~> 5.4"
32
32
  spec.add_development_dependency "xml-simple"
33
33
  spec.add_development_dependency "ostruct"
34
+ spec.add_development_dependency "mutex_m"
34
35
  end
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
- assert_equal '#<Image r2d2.jpg:{"word/test.xml"=>"rId1"}>', @expected.inspect
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
- assert_equal props.inspect, 'shd={:color=>"clear", :fill=>"123456", :test=>nil}'
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
- assert_equal props.inspect, 'numPr=[{"ilvl"=>1}, {"numId"=>34}]'
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.2
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-07-18 00:00:00.000000000 Z
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: