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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/lm_docstache/hide_custom_tags.rb +1 -1
- data/lib/lm_docstache/version.rb +1 -1
- data/spec/example_input/docx-no-rpr.docx +0 -0
- data/spec/hide_custom_tags_spec.rb +19 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f57ee42bd7804fc41051ca123be801e909acfee0b0406a5eac91e8f562827f11
|
4
|
+
data.tar.gz: 21ab27cac4e621eb3d3c391b71945a9f29dac1343d790ccb4026a191dbee62ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 642af591848de049083886277afa1fcd082cf150785d7610ebc15ff328ddc53527bc373e4ab18f910eabffe16b747d8f2191332a968b9e5716a52b4a2e5b2a62
|
7
|
+
data.tar.gz: e5d7b66bdb616221ccb789841ce6d84eb7ce76b44c2319ebf522c0f8cd4fb53069fbe93df745724c34ec450884b7b462932624dc2bc10a85216dd1c655bf00d5
|
data/CHANGELOG.md
CHANGED
@@ -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
|
67
|
+
run_node.prepend_child("<w:rPr><w:color w:val=\"#{font_color}\"/></w:rPr>")
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
data/lib/lm_docstache/version.rb
CHANGED
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
|
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.
|
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-
|
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
|