From d9d3e87a522ce180768aef2fcb32c236c68b07f2 Mon Sep 17 00:00:00 2001 From: drbrain Date: Mon, 7 Jan 2008 02:52:15 +0000 Subject: [PATCH] Merge documentation from the same class on ri generation. Fixes bug where documentation could disappear. Fix typo in lib/rdoc/options.rb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ lib/rdoc/generators/ri_generator.rb | 24 +++++++++++++++--------- lib/rdoc/options.rb | 2 +- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index cecb8e953d..feae1513e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Jan 7 11:51:49 2008 Eric Hodel + + * lib/rdoc/generators/ri_generator.rb: Merge documentation from the + same class on output. Fixes bug where documentation could + disappear. + + * lib/rdoc/options.rb: Fix typo. + + * lib/rdoc/generators/*: Clean up some namespacing and make RDoc + consistent. + Mon Jan 7 11:44:45 2008 Tanaka Akira * encoding.c (rb_enc_internal_get_index): extracted from diff --git a/lib/rdoc/generators/ri_generator.rb b/lib/rdoc/generators/ri_generator.rb index b248909fa9..edca9938a5 100644 --- a/lib/rdoc/generators/ri_generator.rb +++ b/lib/rdoc/generators/ri_generator.rb @@ -28,6 +28,8 @@ class Generators::RIGenerator @ri_writer = RI::RiWriter.new(".") @markup = SM::SimpleMarkup.new @to_flow = SM::ToFlow.new + + @generated = {} end ## @@ -205,17 +207,21 @@ class Generators::RIGenerator end end - if old_cls.nil? - # no merge: simply overwrite - @ri_writer.remove_class(cls_desc) - @ri_writer.add_class(cls_desc) - else - # existing class: merge in - old_desc = rdr.get_class(old_cls) + prev_cls = @generated[cls_desc.full_name] - old_desc.merge_in(cls_desc) - @ri_writer.add_class(old_desc) + if old_cls and not prev_cls then + old_desc = rdr.get_class old_cls + cls_desc.merge_in old_desc end + + if prev_cls then + cls_desc.merge_in prev_cls + end + + @generated[cls_desc.full_name] = cls_desc + + @ri_writer.remove_class cls_desc + @ri_writer.add_class cls_desc end end diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 259fef487b..0b12efe9be 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -352,7 +352,7 @@ class Options @op_name = nil @show_all = false @main_page = nil - @marge = false + @merge = false @exclude = [] @quiet = false @generator_name = 'html'