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 +4 -4
- data/.github/stale.yml +17 -0
- data/CHANGELOG.md +6 -0
- data/README.md +16 -0
- data/lib/odf-report/field.rb +3 -3
- data/lib/odf-report/section.rb +2 -2
- data/lib/odf-report/table.rb +2 -3
- data/lib/odf-report/version.rb +1 -1
- data/spec/images_spec.rb +2 -2
- data/spec/sections_spec.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff3d6495c26d851b5497d740ce9443d69957efa8b6f11e99c9287e68c339147
|
4
|
+
data.tar.gz: 3ffaee2475b15b556c8bdf7f1e15697442c9603e2c8dc09643887c0170effb2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/odf-report/field.rb
CHANGED
data/lib/odf-report/section.rb
CHANGED
@@ -26,11 +26,11 @@ module ODFReport
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def find_section_node(doc)
|
29
|
-
@section_node = doc.
|
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)).
|
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
|
data/lib/odf-report/table.rb
CHANGED
@@ -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.
|
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)).
|
78
|
+
Nokogiri::XML(wrap_with_ns(node)).at_xpath("//table:table-row")
|
80
79
|
end
|
81
80
|
|
82
81
|
end
|
data/lib/odf-report/version.rb
CHANGED
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.
|
120
|
-
expect(@data.xml.
|
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
|
data/spec/sections_spec.rb
CHANGED
@@ -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.
|
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.
|
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.
|
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:
|
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.
|
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
|