From a1d3a8e8619b82fbff71ae7dd264926983be829a Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 12 Jan 2004 03:11:25 +0000 Subject: Add explicit line breaks in method signatures for ri. Fixup some comments in object.c. Support changes comments for "in xxx.c" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/parsers/parse_c.rb | 8 +++----- lib/rdoc/ri/ri_display.rb | 5 ++++- lib/rdoc/ri/ri_formatter.rb | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'lib/rdoc') diff --git a/lib/rdoc/parsers/parse_c.rb b/lib/rdoc/parsers/parse_c.rb index 904aeb9417..b1b752222b 100644 --- a/lib/rdoc/parsers/parse_c.rb +++ b/lib/rdoc/parsers/parse_c.rb @@ -261,11 +261,10 @@ module RDoc \s*"([^"]+)", \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?, \s*(-?\w+)\s*\) - (?:;\s*//\s+in\s+(\w+?\.[cy]))? + (?:;\s*/[*/]\s+in\s+(\w+?\.[cy]))? }xm) do |type, var_name, meth_name, meth_body, param_count, source_file| #" - next if meth_name == "initialize_copy" # Ignore top-object and weird struct.c dynamic stuff next if var_name == "ruby_top_self" @@ -282,10 +281,9 @@ module RDoc \s*"([^"]+)", \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?, \s*(-?\w+)\s*\) - (?:;\s*//\s+in\s+(\w+?\.[cy]))? + (?:;\s*/[*/]\s+in\s+(\w+?\.[cy]))? }xm) do #" |meth_name, meth_body, param_count, source_file| - handle_method("method", "rb_mKernel", meth_name, meth_body, param_count, source_file) end @@ -346,7 +344,7 @@ module RDoc # Find the C code corresponding to a Ruby method def find_body(meth_name, meth_obj, body) - if body =~ %r{((?>/\*.*?\*/\s+))(static\s+)?VALUE\s+#{meth_name} + if body =~ %r{((?>/\*.*?\*/\s*))(static\s+)?VALUE\s+#{meth_name} \s*(\(.*?\)).*?^}xm comment, params = $1, $3 body_text = $& diff --git a/lib/rdoc/ri/ri_display.rb b/lib/rdoc/ri/ri_display.rb index 6899fe165a..8533aba822 100644 --- a/lib/rdoc/ri/ri_display.rb +++ b/lib/rdoc/ri/ri_display.rb @@ -237,7 +237,10 @@ class DefaultDisplay params = method.name + params end end - params.split(/\n/).each {|p| @formatter.wrap(p) } + params.split(/\n/).each do |p| + @formatter.wrap(p) + @formatter.break_to_newline + end end ###################################################################### diff --git a/lib/rdoc/ri/ri_formatter.rb b/lib/rdoc/ri/ri_formatter.rb index f4ea7cb049..07439b93f7 100644 --- a/lib/rdoc/ri/ri_formatter.rb +++ b/lib/rdoc/ri/ri_formatter.rb @@ -68,6 +68,15 @@ module RI ###################################################################### + # called when we want to ensure a nbew 'wrap' starts on a newline + # Only needed for HtmlFormatter, because the rest do their + # own line breaking + + def break_to_newline + end + + ###################################################################### + def bold_print(txt) print txt end @@ -459,14 +468,13 @@ module RI print(escape(achar.char)) end update_attributes(curr_attr, 0) unless curr_attr.zero? - puts end def draw_line(label=nil) if label != nil bold_print(label) end - puts("

") + puts("


") end def bold_print(txt) @@ -477,6 +485,10 @@ module RI puts("

") end + def break_to_newline + puts("
") + end + def display_heading(text, level, indent) level = 4 if level > 4 tag("h#{level}") { text } -- cgit v1.2.3