xhtml_report_generator 3.0.2 → 3.0.3
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/lib/xhtml_report_generator/custom.rb +22 -4
- data/lib/xhtml_report_generator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b6c79e8a4be4c2bd9c2b5a824550c47ccc02b3
|
4
|
+
data.tar.gz: a96047a216f7a553d6de6f9f48fca64c4d7790b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94f0ece8702ec1534ccec2c13670f937c0ed41a389164bcf36e36ac9fc40cafc29777ec5b2fe167798161dc998d1d0a756f0c35e2530706d63fd36a545ae14a6
|
7
|
+
data.tar.gz: ea980d45095e57bcda650ff70bf4a1b87628b441ce48bdba7a63ee46bb885dacf6eac1f67b1c7b78feddb143be870acb3555c9cf973d7f4732c4be8f6f2e0c0e
|
@@ -79,6 +79,24 @@ module Custom
|
|
79
79
|
def get_current()
|
80
80
|
return @current
|
81
81
|
end
|
82
|
+
|
83
|
+
# returns the plain text without any xml tags of the specified element and all its children
|
84
|
+
# @param el [REXML::Element] The element from which to fetch the text children. Defaults to @current
|
85
|
+
# @param recursive [Boolean] whether or not to recurse into the children of the given "el"
|
86
|
+
# @return [String] text contents of xml node
|
87
|
+
def get_element_text(el = @current, recursive = true)
|
88
|
+
out = ""
|
89
|
+
el.to_a.each { |child|
|
90
|
+
if child.is_a?(REXML::Text)
|
91
|
+
out << child.value()
|
92
|
+
else
|
93
|
+
if recursive
|
94
|
+
out << get_element_text(child, true)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
}
|
98
|
+
return out
|
99
|
+
end
|
82
100
|
|
83
101
|
# Appends a <pre> node after the @current node
|
84
102
|
# @param attrs [Hash] attributes for the <pre> element
|
@@ -176,10 +194,10 @@ module Custom
|
|
176
194
|
# get all children of the current node
|
177
195
|
arr = el.to_a()
|
178
196
|
num_matches = 0
|
197
|
+
# first we have to detach all children from parent, otherwise we can cause ordering issues
|
198
|
+
arr.each {|i| i.remove() }
|
179
199
|
# depth first recursion into grand-children
|
180
200
|
for i in arr do
|
181
|
-
# detach from current
|
182
|
-
i.parent = nil
|
183
201
|
if i.is_a?(REXML::Text)
|
184
202
|
# in general a text looks as follows:
|
185
203
|
# .*(matchstring|.*)*
|
@@ -221,10 +239,10 @@ module Custom
|
|
221
239
|
arr = el.to_a()
|
222
240
|
num_matches = 0
|
223
241
|
#puts arr.inspect
|
242
|
+
# first we have to detach all children from parent, otherwise we can cause ordering issues
|
243
|
+
arr.each {|i| i.remove() }
|
224
244
|
# depth first recursion into grand-children
|
225
245
|
for i in arr do
|
226
|
-
# detach from current
|
227
|
-
i.parent = nil
|
228
246
|
#puts i.class.to_s()
|
229
247
|
if i.is_a?(REXML::Text)
|
230
248
|
# in general a text looks as follows:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xhtml_report_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Widmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "The generator can be used to create html or xhtml files. It comes with
|
14
14
|
many utility functions.\n \nThe javascript to render the table of contents, the
|