odf-report 0.7.2 → 0.7.3

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: c8d30a8580192ffaf7fa4908a5b674e69ecef19a5c3fe054baeaf1e72c3770ad
4
- data.tar.gz: e402b3a61216a3070cdfcc0799930038ed9cd37687c7a844eaf76ead2b55a704
3
+ metadata.gz: 1ff3d6495c26d851b5497d740ce9443d69957efa8b6f11e99c9287e68c339147
4
+ data.tar.gz: 3ffaee2475b15b556c8bdf7f1e15697442c9603e2c8dc09643887c0170effb2c
5
5
  SHA512:
6
- metadata.gz: 72e8c9581c0f655dd1ba4ef5dcfd11706f36a2e69d810261fb7f233d72f0cb982a298da7f24055d7561551f3ac737abf018809ea982d495661e0386895ee75bf
7
- data.tar.gz: 9113f76a643655aa46227a0390c425cca828ba2c05835eb33d3894c7cb2219253bda16c109bf885148e63736671be3389abe804782a196ca860fb958b786ecf5
6
+ metadata.gz: 6eff87a548135805364a1a214687e3b949975184b71bd0ea1796351110e4e142e02e6fda65a45bd039a4825e7bd58f435e2267a040a7ee69c1f8983a956331ce
7
+ data.tar.gz: 6638443f8259b7b2c8b1fcbee7efa83c935febacbf28141e2392dc2de4a1b67d31caea6726070fe85dfb7eeb1eefb23c39ee57527a8621694252b3a31130ced2
data/.github/stale.yml ADDED
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 90
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 21
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
data/CHANGELOG.md CHANGED
@@ -18,6 +18,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
18
18
 
19
19
  - None
20
20
 
21
+ ## 0.7.3
22
+
23
+ ### Fixed
24
+ - newer versions (> 1.3.0) of Nokogiri where presenting "Nokogiri::CSS::SyntaxError: unexpected '|'" #120
25
+ - prevent unnecessary memory expensive operations with missing placeholders #117
26
+
21
27
  ## 0.7.2
22
28
 
23
29
  ### Fixed
data/README.md CHANGED
@@ -218,3 +218,19 @@ report = ODFReport::Report.new(io: @template.attachment.read) do |r|
218
218
  **rubyzip**: manipulating the contents of the odt file, since it's actually a zip file.
219
219
  **nokogiri**: parsing and manipulating the document xml files.
220
220
  **mime-types**: identify images mime types
221
+
222
+ #### TROUBLESHOOTING
223
+
224
+ ##### Placeholder not replaced
225
+
226
+ If your placeholder is not being replaced, the problem might come from OpenOffice/LibreOffice which, when a placeholder is edited, add some markup that prevents odf-report from identifying the placeholder.
227
+
228
+ The golden rule is: NEVER edit the placeholders. If you want to change one, delete it an write again, including the []
229
+ Example: if you have, say, [USER] in your template and you want to change to [USERNAME], you should not edit and type NAME.
230
+ Delete the PLACEHOLDER [USER] and type [USERNAME].
231
+
232
+ ##### Word found unreadable content
233
+
234
+ - Symptom: You prepare your template file in eg. LibreOffice, and when you open the template in Word it says "Word found unreadable content"
235
+ - Solution: Open your template in LibreOffice, save as `.docx`, quit LibreOffice. Open the `.docx` in LibreOffice, save as `.odt`.
236
+ - Hypothesis: Word does not support all ODT features. Saving as `.docx` removes those features of the document.
@@ -17,9 +17,9 @@ module ODFReport
17
17
 
18
18
  txt = content.inner_html
19
19
 
20
- txt.gsub!(to_placeholder, sanitize(@data_source.value))
21
-
22
- content.inner_html = txt
20
+ if txt.gsub!(to_placeholder, sanitize(@data_source.value))
21
+ content.inner_html = txt
22
+ end
23
23
 
24
24
  end
25
25
 
@@ -26,11 +26,11 @@ module ODFReport
26
26
  private
27
27
 
28
28
  def find_section_node(doc)
29
- @section_node = doc.at_css("text|section[@text|name='#{@name}']")
29
+ @section_node = doc.at_xpath("//text:section[@text:name='#{@name}']")
30
30
  end
31
31
 
32
32
  def deep_clone(node)
33
- Nokogiri::XML(wrap_with_ns(node)).at("text|section")
33
+ Nokogiri::XML(wrap_with_ns(node)).at_xpath("//text:section")
34
34
  .tap { |n| n.attribute('name').content = SecureRandom.uuid }
35
35
 
36
36
  end
@@ -60,7 +60,6 @@ module ODFReport
60
60
  end
61
61
 
62
62
  return deep_clone(ret)
63
- # return ret.dup
64
63
  end
65
64
 
66
65
  def get_start_node
@@ -72,11 +71,11 @@ module ODFReport
72
71
  end
73
72
 
74
73
  def find_table_node(doc)
75
- doc.at_css("table|table[@table|name='#{@name}']")
74
+ doc.at_xpath("//table:table[@table:name='#{@name}']")
76
75
  end
77
76
 
78
77
  def deep_clone(node)
79
- Nokogiri::XML(wrap_with_ns(node)).at("table|table-row")
78
+ Nokogiri::XML(wrap_with_ns(node)).at_xpath("//table:table-row")
80
79
  end
81
80
 
82
81
  end
@@ -1,3 +1,3 @@
1
1
  module ODFReport
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
data/spec/images_spec.rb CHANGED
@@ -116,8 +116,8 @@ RSpec.describe "Images" do
116
116
  end
117
117
 
118
118
  it "removes nil images in report" do
119
- expect(@data.xml.at_css("draw|frame[@draw|name='IMAGE_01']")).to be
120
- expect(@data.xml.at_css("draw|frame[@draw|name='IMAGE_02']")).to be_nil
119
+ expect(@data.xml.at_xpath(".//draw:frame[@draw:name='IMAGE_01']")).to be
120
+ expect(@data.xml.at_xpath(".//draw:frame[@draw:name='IMAGE_02']")).to be_nil
121
121
  end
122
122
 
123
123
  it "removes nil images in tables" do
@@ -38,12 +38,12 @@ RSpec.describe "Sections" do
38
38
  end
39
39
 
40
40
  it "should remove section with empty collection" do
41
- section = @data.xml.at_css("text|section[@text|name='SECTION_02']")
41
+ section = @data.xml.at_xpath("//text:section[@text:name='SECTION_02']")
42
42
  expect(section).to be_nil
43
43
  end
44
44
 
45
45
  it "should remove section with nil collection" do
46
- section = @data.xml.at_css("text|section[@text|name='SECTION_03']")
46
+ section = @data.xml.at_xpath("//text:section[@text:name='SECTION_03']")
47
47
  expect(section).to be_nil
48
48
  end
49
49
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odf-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Duarte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-02 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,6 +130,7 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
+ - ".github/stale.yml"
133
134
  - ".github/workflows/gem-push.yml"
134
135
  - ".gitignore"
135
136
  - ".rspec"
@@ -210,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
211
  - !ruby/object:Gem::Version
211
212
  version: '0'
212
213
  requirements: []
213
- rubygems_version: 3.0.3
214
+ rubygems_version: 3.2.32
214
215
  signing_key:
215
216
  specification_version: 4
216
217
  summary: Generates ODF files, given a template (.odt) and data, replacing tags