1
1
#!ruby
2
- #
3
- # Darkfish RDoc HTML Generator
4
- # $Id: darkfish.rb 35 2008-09-22 15:14:43Z deveiant $
5
- #
6
- # Author: Michael Granger <[email protected] >
7
- #
8
- # == License
9
- #
10
- # Copyright (c) 2007, 2008, The FaerieMUD Consortium
11
- # All rights reserved.
12
- #
13
- # Permission is hereby granted, free of charge, to any person obtaining a copy
14
- # of this software and associated documentation files (the "Software"), to deal
15
- # in the Software without restriction, including without limitation the rights
16
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- # copies of the Software, and to permit persons to whom the Software is
18
- # furnished to do so, subject to the following conditions:
19
- #
20
- # The above copyright notice and this permission notice shall be included in
21
- # all copies or substantial portions of the Software.
22
- #
23
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
- # THE SOFTWARE.
30
- #
31
2
32
3
require 'rubygems'
33
- gem 'rdoc' , '>= 2.0.0 '
4
+ gem 'rdoc' , '>= 2.3 '
34
5
35
6
require 'pp'
36
7
require 'pathname'
42
13
require 'rdoc/generator/xml'
43
14
require 'rdoc/generator/html'
44
15
45
- ### A erb-based RDoc HTML generator
16
+ #
17
+ # Darkfish RDoc HTML Generator
18
+ #
19
+ # $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
20
+ #
21
+ # == Author/s
22
+ # * Michael Granger ([email protected] )
23
+ #
24
+ # == Contributors
25
+ # * Mahlon E. Smith ([email protected] )
26
+ # * Eric Hodel ([email protected] )
27
+ #
28
+ # == License
29
+ #
30
+ # Copyright (c) 2007, 2008, Michael Granger. All rights reserved.
31
+ #
32
+ # Redistribution and use in source and binary forms, with or without
33
+ # modification, are permitted provided that the following conditions are met:
34
+ #
35
+ # * Redistributions of source code must retain the above copyright notice,
36
+ # this list of conditions and the following disclaimer.
37
+ #
38
+ # * Redistributions in binary form must reproduce the above copyright notice,
39
+ # this list of conditions and the following disclaimer in the documentation
40
+ # and/or other materials provided with the distribution.
41
+ #
42
+ # * Neither the name of the author/s, nor the names of the project's
43
+ # contributors may be used to endorse or promote products derived from this
44
+ # software without specific prior written permission.
45
+ #
46
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
49
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
50
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
52
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
53
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
+ #
46
57
class RDoc ::Generator ::Darkfish < RDoc ::Generator ::XML
47
58
48
- RDoc ::RDoc . add_generator self
59
+ RDoc ::RDoc . add_generator ( self )
49
60
50
61
include ERB ::Util
51
62
52
63
# Subversion rev
53
- SVNRev = %$Rev: 35 $
64
+ SVNRev = %$Rev: 52 $
54
65
55
66
# Subversion ID
56
- SVNId = %$Id: darkfish.rb 35 2008-09-22 15:14:43Z deveiant $
67
+ SVNId = %$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
57
68
58
69
# Path to this file's parent directory. Used to find templates and other
59
70
# resources.
60
71
GENERATOR_DIR = Pathname . new ( __FILE__ ) . expand_path . dirname
61
72
62
73
# Release Version
63
- VERSION = '1.1.5'
74
+ VERSION = '1.1.6'
75
+
76
+ # Directory where generated classes live relative to the root
77
+ CLASS_DIR = nil
78
+
79
+ # Directory where generated files live relative to the root
80
+ FILE_DIR = nil
64
81
65
82
66
83
#################################################################
@@ -78,7 +95,7 @@ def self::for( options )
78
95
#################################################################
79
96
80
97
### Initialize a few instance variables before we start
81
- def initialize ( options )
98
+ def initialize ( options )
82
99
@template = nil
83
100
@template_dir = GENERATOR_DIR + 'template/darkfish'
84
101
@@ -170,8 +187,7 @@ def generate_xhtml( options, files, classes )
170
187
# Make a hash of file info keyed by path
171
188
files_by_path = files . inject ( { } ) { |hash , fileinfo |
172
189
hash [ fileinfo [ :full_path ] ] = fileinfo
173
- hash [ fileinfo [ :full_path ] ] [ :outfile ] =
174
- fileinfo [ :full_path ] + '.html'
190
+ hash [ fileinfo [ :full_path ] ] [ :outfile ] = fileinfo [ :full_path ] + '.html'
175
191
hash
176
192
}
177
193
@@ -261,6 +277,7 @@ def generate_class_files( options, files, classes )
261
277
rel_prefix = outputdir . relative_path_from ( outfile . dirname )
262
278
svninfo = self . get_svninfo ( classinfo )
263
279
280
+ debug_msg " rendering #{ outfile } "
264
281
self . render_template ( templatefile , binding ( ) , outfile )
265
282
end
266
283
end
@@ -272,13 +289,15 @@ def generate_file_files( options, files, classes )
272
289
debug_msg "Generating file documentation in #@outputdir "
273
290
templatefile = @template_dir + 'filepage.rhtml'
274
291
292
+ modsort = self . get_sorted_module_list ( classes )
293
+
275
294
files . sort_by { |k , v | k } . each do |path , fileinfo |
276
295
outfile = @outputdir + fileinfo [ :outfile ]
277
296
debug_msg " working on %s (%s)" % [ path , outfile ]
278
297
rel_prefix = @outputdir . relative_path_from ( outfile . dirname )
279
298
context = binding ( )
280
299
281
- debug_msg " rending #{ outfile } "
300
+ debug_msg " rendering #{ outfile } "
282
301
self . render_template ( templatefile , binding ( ) , outfile )
283
302
end
284
303
end
@@ -301,7 +320,7 @@ def time_delta_string( seconds )
301
320
end
302
321
303
322
304
- # %q$Id: darkfish.rb 35 2008-09-22 15:14:43Z deveiant $"
323
+ # %q$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $"
305
324
SVNID_PATTERN = /
306
325
\$ Id:\s
307
326
(\S +)\s # filename
0 commit comments