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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8be9f999ed4d1ead1cef830e239d46b804d90637
4
- data.tar.gz: 4cc7489305ec224f61475e3df988ec3b5e51edb0
3
+ metadata.gz: 78b6c79e8a4be4c2bd9c2b5a824550c47ccc02b3
4
+ data.tar.gz: a96047a216f7a553d6de6f9f48fca64c4d7790b6
5
5
  SHA512:
6
- metadata.gz: 2c0ab9f13b5419145b8aefaf88691f913e5740d81ac19e6a23cf094298fe169b47215a8586846ede0cefbed5ad9940a00b96ab18f34ff9f602d4fa9906d39de4
7
- data.tar.gz: 002c248c1732f2c5a43010a44b14c96f56758544272d946d281f27180485c232bbf41e2d944537ea5010bbabffc9fabe618030bb2ed91651cccd7bfa39cdb81f
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:
@@ -1,5 +1,5 @@
1
1
  module XhtmlReportGenerator
2
- VERSION = '3.0.2'
2
+ VERSION = '3.0.3'
3
3
  end
4
4
 
5
5
  # puts XhtmlReportGenerator::VERSION
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.2
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-08-29 00:00:00.000000000 Z
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