GithubHelp home page GithubHelp logo

Comments (5)

omarkhan avatar omarkhan commented on September 24, 2024

For now coffeedoc only documents top-level functions and classes in a file, at least when the commonjs parser is used. The reasoning is that nested functions and classes do not generally form part of the API, and do not need to be documented in the same way. Of course if you nest everything in a top-level function it won't work.

This should be easy to fix though, just write a custom Parser class that knows where to look in the coffeescript AST. Have a look at how the requirejs parser is written, it does something similar. Shout if you get stuck

from coffeedoc.

nitm avatar nitm commented on September 24, 2024

I'm with @Cybolic.

We too use namespacing for our api, and we're doing it like this (using underscore.js):
_.extend nsName, varOne: "a value" methodOne: -> ...

I understand that this can be manually done by extending the BaseParser ourselves, but that requires to get to know your code, and since it's reasonable to put your api into a namespace, maybe it's worth to add this as a feature as well?

from coffeedoc.

omarkhan avatar omarkhan commented on September 24, 2024

I appreciate that lots of people use namespacing as a way to write modular code, but it would be quite tricky to write a generic parser that could handle all namespacing techniques. Some people put everything in a top-level object, other people attach public properties to a named wrapper function using this, @nitm uses underscore... the possibilities are endless. How does coffeedoc know where to look in the general case?

If someone can hack something together I'm happy to merge it in, but it seems like a lot of work, especially when you can just use commonjs/requirejs and have everything just work.

from coffeedoc.

Cybolic avatar Cybolic commented on September 24, 2024

I was actually looking at doing that before posting here, by simply copying the require class and replace all the "require" strings with "namespace", but that didn't work and I didn't have the time to look into it further.

I'm guessing the problem of where to look can be solved by having a --namespace argument that takes a parameter which is the name of the function to look for?

from coffeedoc.

nitm avatar nitm commented on September 24, 2024

I already forked the project, and will hopefully have enough time to make it work for what I need, then I'll try to tackle the generic issue.

Thanks for the great project.

from coffeedoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.