lm_docstache 3.0.8 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/lm_docstache/document.rb +5 -0
- data/lib/lm_docstache/version.rb +1 -1
- data/spec/example_input/ExampleTemplate.docx +0 -0
- data/spec/integration_spec.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b340972dc8dbd8f4f0e2bbdd8b385468d626d9f5f4ea3d9090cd3c96cba5ab05
|
4
|
+
data.tar.gz: f901539b68bff0bf5bb736aaa3c4636ade982fe23adfe7ae70ba41a926186c9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49273e8a8c7133cbf4ef02f0c6bb66b64c19408e75a010cbce313557bcf22407b493efe57e66d760bf9327d68b32a2008981937780d2ce0cb2c047ec0a1c9fae
|
7
|
+
data.tar.gz: bf8a47eea31424c0f2a20c35063c73fd93353d9fd315f028b18591bb1cd3f4d3d52c83ae668713bc74d4618fd95dcc33006523aefb4fc54a1430dfaf38017621
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,8 @@ module LMDocstache
|
|
6
6
|
BLOCK_CHILDREN_ELEMENTS = 'w|r,w|hyperlink,w|ins,w|del'
|
7
7
|
RUN_LIKE_ELEMENTS = 'w|r,w|ins'
|
8
8
|
|
9
|
+
attr_reader :document
|
10
|
+
|
9
11
|
def initialize(*paths)
|
10
12
|
raise ArgumentError if paths.empty?
|
11
13
|
|
@@ -172,11 +174,14 @@ module LMDocstache
|
|
172
174
|
previous_style_html = previous_style_node ? previous_style_node.inner_html : ''
|
173
175
|
previous_text_node = previous_node.at_css('w|t')
|
174
176
|
current_text_node = node.at_css('w|t')
|
177
|
+
whitespace_attr = current_text_node['xml:space']
|
175
178
|
|
176
179
|
next if style_html != previous_style_html
|
177
180
|
next if current_text_node.nil? || previous_text_node.nil?
|
178
181
|
|
182
|
+
previous_text_node['xml:space'] = whitespace_attr if whitespace_attr
|
179
183
|
previous_text_node.content = previous_text_node.text + current_text_node.text
|
184
|
+
|
180
185
|
node.unlink
|
181
186
|
end
|
182
187
|
end
|
data/lib/lm_docstache/version.rb
CHANGED
Binary file
|
data/spec/integration_spec.rb
CHANGED
@@ -62,7 +62,7 @@ describe 'integration test', integration: true do
|
|
62
62
|
it 'fixes nested xml errors breaking tags' do
|
63
63
|
expect { document.fix_errors }.to change {
|
64
64
|
document.send(:problem_paragraphs).size
|
65
|
-
}.from(
|
65
|
+
}.from(10).to(1)
|
66
66
|
|
67
67
|
expect(document.send(:problem_paragraphs).first.text).to eq(
|
68
68
|
'{{TAG123-\\-//WITH WE👻IRD CHARS}}'
|
@@ -72,7 +72,16 @@ describe 'integration test', integration: true do
|
|
72
72
|
it 'has the expected amount of usable tags' do
|
73
73
|
expect { document.fix_errors }.to change {
|
74
74
|
document.usable_tags.count
|
75
|
-
}.from(29).to(
|
75
|
+
}.from(29).to(37)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'keeps "xml:space" attribute when fixing errors' do
|
79
|
+
document.fix_errors
|
80
|
+
|
81
|
+
text_node = document.document.css('w|p').last
|
82
|
+
.css('w|t').find { |node| node.text.include?('that occurred on') }
|
83
|
+
|
84
|
+
expect(text_node['xml:space']).to eq('preserve')
|
76
85
|
end
|
77
86
|
|
78
87
|
it 'has the expected amount of usable roles tags' do
|
@@ -88,6 +97,7 @@ describe 'integration test', integration: true do
|
|
88
97
|
document.render_file(output_file, data)
|
89
98
|
end
|
90
99
|
end
|
100
|
+
|
91
101
|
context "testing hide custom tags" do
|
92
102
|
before do
|
93
103
|
FileUtils.rm_rf(output_dir) if File.exist?(output_dir)
|
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: 3.0.
|
4
|
+
version: 3.0.9
|
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-
|
15
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: nokogiri
|