Namespace RDoc::DOT. Clean up formatting of RDoc::Diagrams.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-01-07 07:06:59 +00:00
parent 4b93d732e4
commit 9ad5f854e7
3 changed files with 83 additions and 74 deletions

View File

@ -1,3 +1,9 @@
Mon Jan 7 16:06:09 2008
* lib/rdoc/dot.rb: Namespace under RDoc.
* lib/rdoc/diagram.rb: Clean up formatting.
Mon Jan 7 15:51:35 2008 Eric Hodel <drbrain@segment7.net>
* lib/rdoc/options.rb: Convert to OptionParser, clean up -h output,

View File

@ -30,8 +30,9 @@ module RDoc
DOT_PATH = "dot"
# Pass in the set of top level objects. The method also creates
# the subdirectory to hold the images
##
# Pass in the set of top level objects. The method also creates the
# subdirectory to hold the images
def initialize(info, options)
@info = info
@ -41,9 +42,10 @@ module RDoc
@diagram_cache = {}
end
# Draw the diagrams. We traverse the files, drawing a diagram for
# each. We also traverse each top-level class and module in that
# file drawing a diagram for these too.
##
# Draw the diagrams. We traverse the files, drawing a diagram for each. We
# also traverse each top-level class and module in that file drawing a
# diagram for these too.
def draw
unless @options.quiet
@ -100,9 +102,7 @@ module RDoc
$stderr.puts unless @options.quiet
end
#######
private
#######
def find_names(mod)
return [mod.full_name] + mod.classes.collect{|cl| cl.full_name} +
@ -181,6 +181,7 @@ module RDoc
'height' => '0.01',
'shape' => 'plaintext')
end
container.classes.each_with_index do |cl, cl_index|
last_file = cl.in_files[-1].file_relative_name
@ -261,8 +262,7 @@ module RDoc
unless @local_names.include?(sclass_full_name) or @global_names.include?(sclass_full_name)
path = sclass_full_name.split("::")
url = File.join('classes', *path) + ".html"
@global_graph << DOT::Node.new(
'name' => "#{sclass_full_name.gsub( /:/, '_' )}",
@global_graph << DOT::Node.new('name' => "#{sclass_full_name.gsub( /:/, '_' )}",
'label' => sclass_full_name,
'URL' => %{"#{url}"})
@global_names << sclass_full_name
@ -305,10 +305,10 @@ module RDoc
return ret
end
# Extract the client-side image map from dot, and use it
# to generate the imagemap proper. Return the whole
# <map>..<img> combination, suitable for inclusion on
# the page
##
# Extract the client-side image map from dot, and use it to generate the
# imagemap proper. Return the whole <map>..<img> combination, suitable for
# inclusion on the page
def wrap_in_image_map(src, dot)
res = %{<map id="map" name="map">\n}
@ -331,6 +331,7 @@ module RDoc
res << %{<img src="#{dot}" usemap="#map" border="0" alt="#{dot}">}
return res
end
end
end

View File

@ -1,4 +1,6 @@
module DOT
module RDoc; end
module RDoc::DOT
TAB = ' '
TAB2 = TAB * 2