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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b414a4508c323651394880630f25af46409778dfc205ebc5621d72e07a6e69a3
4
- data.tar.gz: 896ce5a0ef359f2b3a77646a631b66ef74a67fb6f5d8fa2ac218a3d346b8f0f8
3
+ metadata.gz: b340972dc8dbd8f4f0e2bbdd8b385468d626d9f5f4ea3d9090cd3c96cba5ab05
4
+ data.tar.gz: f901539b68bff0bf5bb736aaa3c4636ade982fe23adfe7ae70ba41a926186c9a
5
5
  SHA512:
6
- metadata.gz: e14266f143047c25ee683b6544ddca31648ac83b51a7a72756f3f01dfa1800353f684d3c1a82e878f523a29ef829389f99c7e4f60b0c6d5c46708eccffc5c36c
7
- data.tar.gz: 0f5ee3910f3a77519fec6ee1db604954c49f3ecc5b0e12af4bcc4d7844b0f10bc9ee410070291381fbd90cce25f974c246a8bca6a107b8d63021b8e38ed3cef9
6
+ metadata.gz: 49273e8a8c7133cbf4ef02f0c6bb66b64c19408e75a010cbce313557bcf22407b493efe57e66d760bf9327d68b32a2008981937780d2ce0cb2c047ec0a1c9fae
7
+ data.tar.gz: bf8a47eea31424c0f2a20c35063c73fd93353d9fd315f028b18591bb1cd3f4d3d52c83ae668713bc74d4618fd95dcc33006523aefb4fc54a1430dfaf38017621
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.9
4
+
5
+ #### Bug fixes
6
+
7
+ * Text nodes merged in paragraphs with problems through `fix_errors` private
8
+ method have now the "xml:space" attribute preserved from now on.
9
+
3
10
  ## 3.0.8
4
11
 
5
12
  #### Bug fixes
@@ -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
@@ -1,3 +1,3 @@
1
1
  module LMDocstache
2
- VERSION = "3.0.8"
2
+ VERSION = "3.0.9"
3
3
  end
@@ -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(7).to(1)
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(34)
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.8
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-06-25 00:00:00.000000000 Z
15
+ date: 2021-07-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: nokogiri