xhtml_report_generator 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,7 +18,7 @@ Here an example for version >= 2 of this gem is provided.
18
18
 
19
19
  Basically starting from version 2 the syntax for each method of custom.rb is unified. It accepts an hash of html attributes as argument, and the actual contents as block argument.
20
20
 
21
- def method({"attribute" => "value", "attribute" => "value"}) {contents}
21
+ def method({"attribute" => "value", "attribute2" => "value2"}) {contents}
22
22
 
23
23
  in addition the method naming convention was changed from camelCase to underscore to comply more with ruby conventions.
24
24
 
@@ -30,8 +30,8 @@ gen1.create_layout("Title")
30
30
  gen1.heading("h1", {"class" => "bothtoc"}) {"titel"}
31
31
  gen1.heading("h2") {"subtitel"}
32
32
  gen1.heading("h3") {"section"}
33
- gen1.content() {"content function: Hallo welt <br /> html test <span class=\"r\" >red span test</span>", {"class"=>"bold"}}
34
- gen1.html("<p class="italic">html function: Hallo welt <br /> html test <span class=\"r\" >red span test</span></p>")
33
+ gen1.content({"class"=>"bold"}) {"content function: Hallo welt &lt;br /> html test &lt;span class=\"r\" >red span test&lt;/span>"}
34
+ gen1.html("&lt;p class=\"italic\">html function: Hallo welt &lt;br /> html test &lt;span class=\"r\" >red span test&lt;/span>&lt;/p>")
35
35
  gen1.highlight(/Ha.*lt/)
36
36
 
37
37
  </pre>
@@ -69,7 +69,7 @@ content -> content(attrs={}, &block)
69
69
 
70
70
  heading -> heading(tag_type="h1", attrs={}, &block)
71
71
 
72
- headingTop -> heading_top(tag_type="h1", attrs={}, &block)
72
+ headingTop -> heading\_top(tag_type="h1", attrs={}, &block)
73
73
 
74
74
  </pre>
75
75
 
@@ -265,8 +265,16 @@ module Custom
265
265
  def heading_top(tag_type="h1", attrs={}, &block)
266
266
  temp = REXML::Element.new(tag_type)
267
267
  temp.add_attributes(attrs)
268
- # insert before the first child of div middle
269
- @div_middle.insert_before("//div[@class='middle']/*[1]", temp)
268
+
269
+ # check if there are any child elements
270
+ if @div_middle.has_elements?()
271
+ # insert before the first child of div middle
272
+ @div_middle.insert_before("//div[@class='middle']/*[1]", temp)
273
+ else
274
+ # middle is empty, just insert the heading
275
+ @div_middle.insert_after(@current, temp)
276
+ end
277
+
270
278
  @current = temp
271
279
  raise "Block argument is mandatory" unless block_given?
272
280
  text = block.call()
@@ -1,5 +1,5 @@
1
1
  module XhtmlReportGenerator
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
4
4
 
5
5
  # puts XhtmlReportGenerator::VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xhtml_report_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,12 +15,12 @@ description: ! "The generator can be used to create xhtml files. It comes with s
15
15
  default utility functions.\n== Here is an example usage\n gen1 = XhtmlReportGenerator::Generator.new\n
16
16
  \ gen1.create_layout(\"Title\")\n gen1.heading(\"h1\", {\"class\" => \"bothtoc\"})
17
17
  {\"titel\"}\n gen1.heading(\"h2\") {\"subtitel\"}\n gen1.heading(\"h3\") {\"section\"}\n
18
- \ gen1.content() {\"content function: Hallo welt <br /> html test <span class=\"r\"
19
- >red span test</span>\", {\"class\"=>\"bold\"}}\n gen1.html(\"<p class=\"italic\">html
20
- function: Hallo welt <br /> html test <span class=\"r\" >red span test</span></p>\")\n
21
- \ gen1.highlight(/Ha.*lt/)\n \nThe javascript to render the table of contents,
22
- the custom generator functions and style sheet all can be\nsupplied by your own,
23
- if necessary. \n"
18
+ \ gen1.content({\"class\"=>\"bold\"}) {\"content function: Hallo welt &lt;br />
19
+ html test &lt;span class=\"r\" >red span test&lt;/span>\"}\n gen1.html(\"&lt;p
20
+ class=\"italic\">html function: Hallo welt &lt;br /> html test &lt;span class=\"r\"
21
+ >red span test&lt;/span>&lt;/p>\")\n gen1.highlight(/Ha.*lt/)\n \nThe javascript
22
+ to render the table of contents, the custom generator functions and style sheet
23
+ all can be\nsupplied by your own, if necessary. \n"
24
24
  email: m-widmer@gmx.ch
25
25
  executables: []
26
26
  extensions: []