Docstring parsing isn't compatible with requireJS define() #4

Closed
dmartinzar opened this Issue Aug 1, 2011 · 4 comments

2 participants

@dmartinzar

Consider the following file format:

###
# My Module #

Some module comments
###

define ['import1', 'import2', ...], (import1, import2) ->

    moduleObject =
        ### object docstring ###

        func1: (arg1, arg2, ...) ->
            ### func1 docstring ###

        func2: (arg1, arg2, ...) ->
            ### func2 docstring ###

    return moduleObject

This currently isn't parsed correctly for 2 reasons:

  • Only the top-level nodes of the AST are being parsed, so anything located underneath a define() function won't be reached
  • There currently is no getObjects() equivalent to the getClasses() function.
@omarkhan
Owner

You're right. At present the whole thing is designed for CommonJS and node. It would be great to extend it for different module loaders, perhaps by separating out the parsing code into individual modules? So you'd have:

src/
    parsers/
        commonjs.coffee
        requirejs.coffee
        ...
    coffeedoc.coffee
    docgen.coffee

What do you think? If I set this up can you contribute the requirejs code?

@dmartinzar

Sure, sounds like a plan.

@omarkhan
Owner

OK, I'll push what we have to npm and get started on this in a branch

@ddlsmurf ddlsmurf added a commit to ddlsmurf/coffeedoc that referenced this issue Nov 9, 2011
@ddlsmurf ddlsmurf Reimported code (by @omarkhan and @frostedcheerios) for requirejs on …
…top of master, #4 .
028759f
@ddlsmurf ddlsmurf referenced this issue Nov 9, 2011
Merged

requirejs support #9

@omarkhan
Owner

Sorted (thanks @frostedcheerios and @ddlsmurf).

I'm not using requirejs, so if anyone runs into problems please let me know, or better still make a pull request!

@omarkhan omarkhan closed this Nov 10, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment