lib/taskjuggler/RichText/TOCEntry.rb in taskjuggler-3.0.0 vs lib/taskjuggler/RichText/TOCEntry.rb in taskjuggler-3.1.0
- old
+ new
@@ -1,11 +1,11 @@
#!/usr/bin/env ruby -w
# encoding: UTF-8
#
# = TOCEntry.rb -- The TaskJuggler III Project Management Software
#
-# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011
+# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012
# by Chris Schlaeger <chris@linux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
@@ -46,16 +46,25 @@
html << (tr = XMLElement.new('tr'))
tr << (td = XMLElement.new('td'))
td << XMLElement.new('div', 'style' => 'height:10px')
end
- fontSizes = [ 20, 17, 15 ]
+ # Use a different font size depending on the element level.
+ fontSizes = [ 20, 17, 15, 14, 14 ]
+
tr = XMLElement.new('tr', 'style' => "font-size:#{fontSizes[level]}px;")
- tr << (td = XMLElement.new('td',
- 'style' => "padding-left:#{10 * level}px"))
- td << XMLText.new(@number)
- tr << (td = XMLElement.new('td',
- 'style' => "padding-left:#{5 + 20 * level}px"))
+ tr << (td = XMLElement.new('td', 'style' => "width:30px;"))
+ # Top-level headings have their number in the left column.
+ td << XMLText.new(@number) if level == 0
+
+ tr << (td = XMLElement.new('td'))
+ if level > 0
+ # Lower level headings have their number in the right column with the
+ # heading text.
+ td << XMLElement.new('span', 'style' => 'padding-right:15px') do
+ XMLText.new(@number)
+ end
+ end
tag = @tag ? "##{@tag}" : ''
td << (a = XMLElement.new('a', 'href' => "#{@file}.html#{tag}"))
a << XMLText.new(@title)
html << tr