문제

When using the Darkfish RDoc generator to generate RDoc documentation, next to methods there is a Click to toggle source button next to each method. It isn't working for me when I generate my documentation, so how do you get that feature to work, do you have to add a keyword into your RDoc source or something? alt text

도움이 되었습니까?

해결책

I had the same problems and found the missing files at http://rack.rubyforge.org/doc/js . I copied them manually in a doc/app/js dir and now Click to toggle source works. This is at least a quick fix.

다른 팁

It seems to be enabled by default. I just tried a quick test with rdoc v2.5.11 :-

$ mkdir temp
$ cd temp
$ cat temp.rb

class MyClass
  def my_method; end
end

$ rdoc
Parsing sources...
100% [ 1/ 1]  temp.rb                                                           

Generating Darkfish...

Files:         1
Classes:       1 (    1 undocumented)
Constants:     0 (    0 undocumented)
Modules:       0 (    0 undocumented)
Methods:       1 (    1 undocumented)
  0.00% documented

Elapsed: 0.1s
$ open doc/index.html

When I click on the link for #my_method and I hover over the description of the method, I see the "click to toggle source" link and it works when I click it.

You will need javascript enabled in your browser to make this work.

I am having the same problem with my Rails3 code. Its pretty generic and I don't remember playing with the RDoc setup, but my click to toggle source doesn't work either. I know that JS is turned on and their haven't been any errors when I run rake doc:app so I'm not quite sure whats going on.

The only thing I can think of is that I'm running Ruby 1.9.2 / Rails 3.0.0 under RVM. Does that make a difference?

UPDATE: I noticed that its trying to load non-existent Javascript files from a js directory. Is RDoc supposed to insert the JS files or are you supposed to do it manually?

That's a problem in an old versions of rdoc that are working together with rvm. I had same problem with 2.5.8 version. The path to the templates directory contains .rvm, so the images and js directories don't get copied into generated documentation. As fix, you can change this line of code in lib/rdoc/generator/darkfish.rb file

next if path =~ /#{File::SEPARATOR}\./

to

next if path =~ /#{@template_dir}.*#{File::SEPARATOR}\./

Thanks to Jeremy Bopp (for discovered the source of this issue - http://rubyforge.org/tracker/index.php?func=detail&aid=28482&group_id=627&atid=2472) and Gordon Thiesfeld (for giving solution - http://rubyforge.org/tracker/?func=detail&atid=2472&aid=26923&group_id=627) from Rubyforge.com

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top