rtomayko / rocco

Rocco is Docco in Ruby
MIT License
404 stars 80 forks source link

Rocco ignores JS code/comments #77

Open jm3 opened 12 years ago

jm3 commented 12 years ago

Is Javascript not one of the languages Rocco will generate docs for? Test run with two trivial example files:

$ cat javascript.js  
/* something */
function f() {
  // a comment
  alert( "hi" );
}   

$ cat ruby.rb 
module SpanishHarlem
  # purple drank
  def meth_od(code)
    puts "sup"
  end 

  # stuff
  puts "yo"
end 

$ bundle exec rocco ruby.rb javascript.js  
WARNING: Pygments not found. Using webservice.
pygmentize not in PATH; using pygments.appspot.com instead
rocco: ruby.rb -> ruby.html
rocco: javascript.js -> javascript.html

$ open ruby.html javascript.html

RESULT: generated HTML for ruby file looks fine, generated HTML for js file = no code / comments

ruby works, js doesn't

rtomayko commented 12 years ago

It should work with anything supported by pygments. Perhaps it's something with the webservice. Mind installing pygments locally and giving that shot?

jm3 commented 12 years ago

Ah, ok, will get a local pygmentization going.

Any recommended way for me to simply test the web service for parsing JS, first?

yumitsu commented 12 years ago

@jm3 Rocco doesn't detect input file language without pygments installed locally:

  def detect_language
    @_language ||=
      if pygmentize?
        %x[pygmentize -N #{@file}].strip.split('+').first
      else
        "text"
      end
  end

I suggest (forgotten-labors/rocco@13b7975626dbc06e3d018e1535499b3a66566a08) a basic language detection, since some of defined code styles has keys similar to file extensions.

jm3 commented 12 years ago

It did indeed work with a local pygments install [1]. If there's anything I can do here to help test / verify / document the above, please let me know!

[1] http://jm3.github.com/thunderous-configs/en.wikipedia.org.html

yumitsu commented 12 years ago

@jm3 You still can generate documentation without pygments installed locally. Just pass the --language option to rocco:

$ bundle exec rocco --language=js javascript.js

or

$ bundle exec rocco -l js javascript.js