lm_docstache 2.1.1 → 2.1.2

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: 6065b961f3d05db1773c70c088a67909755b633a3f412eec7f73cc76992a6a19
4
- data.tar.gz: 808ce002e3bd777efc705851f610a1a26df183e81784e51cb28915a375f7f4cd
3
+ metadata.gz: f57ee42bd7804fc41051ca123be801e909acfee0b0406a5eac91e8f562827f11
4
+ data.tar.gz: 21ab27cac4e621eb3d3c391b71945a9f29dac1343d790ccb4026a191dbee62ae
5
5
  SHA512:
6
- metadata.gz: 41a377be982d11259c4a6a7f362d01e23a800e23203d3114a81b064ee158527a40f2a9a0ad6883923583c661c7e7d712945e894f68ba1e72afd0299b1bc10ed8
7
- data.tar.gz: b8a49a51ab46335fac6c862f1a26b2a23f557d6e007a741cf7f3093891a8e1d696514b55597eee08c3734d2117fe98dd76030827f9a4c02a9af04cb7818dea76
6
+ metadata.gz: 642af591848de049083886277afa1fcd082cf150785d7610ebc15ff328ddc53527bc373e4ab18f910eabffe16b747d8f2191332a968b9e5716a52b4a2e5b2a62
7
+ data.tar.gz: e5d7b66bdb616221ccb789841ce6d84eb7ce76b44c2319ebf522c0f8cd4fb53069fbe93df745724c34ec450884b7b462932624dc2bc10a85216dd1c655bf00d5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.2
4
+
5
+ ### Bugfix
6
+
7
+ * Giving a document there is no *rPr* tag we should add new *rPr* tag before
8
+ *t* tag.
9
+
3
10
  ## 2.1.1
4
11
 
5
12
  ### Improvements
@@ -64,7 +64,7 @@ module LMDocstache
64
64
  w_color.unlink if w_color
65
65
  style << "<w:color w:val=\"#{font_color}\"/>"
66
66
  else
67
- run_node << "<w:rPr><w:color w:val=\"#{font_color}\"/></w:rPr>"
67
+ run_node.prepend_child("<w:rPr><w:color w:val=\"#{font_color}\"/></w:rPr>")
68
68
  end
69
69
  end
70
70
 
@@ -1,3 +1,3 @@
1
1
  module LMDocstache
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
Binary file
@@ -25,13 +25,14 @@ describe LMDocstache::HideCustomTags do
25
25
  context "giving a document with blue background" do
26
26
  let(:input_file) { "#{base_path}/sample-signature-blue.docx" }
27
27
 
28
- it 'expect to have a blue color on all hide custom tags matching' do
28
+ it 'expect to have a white color on all hide custom tags matching and have first child node equal rPr tag' do
29
29
  hide_custom_tags.hide_custom_tags!
30
30
  d = hide_custom_tags.document
31
31
  run_nodes = d.css('w|p w|r')
32
32
  while run_node = run_nodes.shift
33
33
  if run_node.text =~ regexp_tag
34
34
  expect(run_node.at_css('w|rPr w|color').first[1]).to eq('4472C4')
35
+ expect(run_node.children.first.name).to eq('rPr')
35
36
  end
36
37
  end
37
38
  end
@@ -40,13 +41,29 @@ describe LMDocstache::HideCustomTags do
40
41
  context 'giving a document with white background' do
41
42
  let(:input_file) { "#{base_path}/sample-signature.docx" }
42
43
 
43
- it 'expect to have a white color on all hide custom tags matching' do
44
+ it 'expect to have a white color on all hide custom tags matching and have first child node equal rPr tag' do
44
45
  hide_custom_tags.hide_custom_tags!
45
46
  d = hide_custom_tags.document
46
47
  run_nodes = d.css('w|p w|r')
47
48
  while run_node = run_nodes.shift
48
49
  if run_node.text =~ regexp_tag
49
50
  expect(run_node.at_css('w|rPr w|color').first[1]).to eq('FFFFFF')
51
+ expect(run_node.children.first.name).to eq('rPr')
52
+ end
53
+ end
54
+ end
55
+ end
56
+ context 'giving a document without rpr' do
57
+ let(:input_file) { "#{base_path}/docx-no-rpr.docx" }
58
+
59
+ it 'expect to have a white color on all hide custom tags matching and have first child node equal rPr tag' do
60
+ hide_custom_tags.hide_custom_tags!
61
+ d = hide_custom_tags.document
62
+ run_nodes = d.css('w|p w|r')
63
+ while run_node = run_nodes.shift
64
+ if run_node.text =~ regexp_tag
65
+ expect(run_node.at_css('w|rPr w|color').first[1]).to eq('FFFFFF')
66
+ expect(run_node.children.first.name).to eq('rPr')
50
67
  end
51
68
  end
52
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lm_docstache
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roey Chasman
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2021-03-18 00:00:00.000000000 Z
15
+ date: 2021-03-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: nokogiri
@@ -121,6 +121,7 @@ files:
121
121
  - spec/conditional_block_spec.rb
122
122
  - spec/example_input/ExampleTemplate.docx
123
123
  - spec/example_input/blank.docx
124
+ - spec/example_input/docx-no-rpr.docx
124
125
  - spec/example_input/sample-signature-blue.docx
125
126
  - spec/example_input/sample-signature.docx
126
127
  - spec/hide_custom_tags_spec.rb
@@ -154,6 +155,7 @@ test_files:
154
155
  - spec/conditional_block_spec.rb
155
156
  - spec/example_input/ExampleTemplate.docx
156
157
  - spec/example_input/blank.docx
158
+ - spec/example_input/docx-no-rpr.docx
157
159
  - spec/example_input/sample-signature-blue.docx
158
160
  - spec/example_input/sample-signature.docx
159
161
  - spec/hide_custom_tags_spec.rb