omarkhan/coffeedoc

Sphinx integration

grncdr opened this issue · 2 comments

Hey this is really cool. I recently created a (hacky and incomplete) Sphinx extension that parses the output of the nodes_to_json.coffee script I snagged from github.com/showell/CoffeeCoffee to add a "coffee" domain to Sphinx with an automodule directive. You can see an example of the result (documenting this sourcecode). As you can see, it doesn't properly support Sphinx indexing yet, that was going to be my next step before I came across coffeedoc.

Would you be interested in some patches to enable a --json output mode to the coffeedoc script? With that I could then re-write my Sphinx extension to depend on that output in favour of the AST traversals I'm already doing (which are probably just duplicates of yours). I think Sphinx support would be awesome for a few reasons:

  • document multi-language web-apps in one documentation system.
  • all the power of restructured text for doc comments.
  • ability to use intersphinx to link back and forth between multiple coffeescript (and non-coffeescript) projects.

To be clear: I'm not asking you to do this, just wanted to see if it's something you are interested in collaborating on.

Hey this sounds great. That sphinx documentation looks very nice!

I don't think I'll have time to contribute much for a while but I'll gladly accept new code. I like the idea. It should be easy enough to implement, just serialize the output of documentModule and print to stdout. You may need to tweak docgen.coffee to deal with multiple modules, or perhaps only allow it to document one module at a time with the --json flag.

Let me know if you get stuck, I'll be happy to help.

Just thought I'd add that I have an initial version of this available on PyPI. To use:

pip install sphinxcontrib-coffee

and follow the instructions at http://pypi.python.org/pypi/sphinxcontrib-coffee/0.1.0