coffeedoc / codo

CoffeeScript API documentation generator. It's like YARD but for CoffeeScript!
Other
625 stars 92 forks source link

Variables Summary for files doesn't work properly #174

Closed timaschew closed 8 years ago

timaschew commented 10 years ago

I found out that everything that is defined in the root context of a file and what is exported via module.exports generates an entry in the doc. But it depends on the syntax, for instance this works: foo = require('foo').bar but this doesn't: foo = require('foo') The short version {foo} = require('foo') doesn't work as well.

Is this behavior desired?

timaschew commented 10 years ago

furthermode this: module.exports = hello = "foobar" produce just a local hello variable, module.exports will be ignored.

I also find out, that for method names, the module.exports is cropped. So variables and methods have no uniform formatting. This line https://github.com/coffeedoc/codo/blob/006fad5b28994d2cff953bc12633acfe0c60c6b0/lib/entities/file.coffee#L28-L30 is doing it and I don't understand why, because it doesn't consider the exports assignment and replace it with a local assignment.

I'm currently working on some changes to support better non class documentation and you maybe interested in a pull request?

My thoughts for the module.exports syntax:

distinguish between local and exported variables (regardless of the type: function, object, string, ...) so the files template shows only local things in one part, and exported things in the other part

inossidabile commented 8 years ago

Yes, I'm interested in PR. I never had any use-cases that would involve documenting variables. In fact this part of Codo is just a BC thing that came from version 1 and original author.