Documenting objects over multiple files

904 views
Skip to first unread message

Tim Statler

unread,
Sep 14, 2011, 11:14:05 AM9/14/11
to JSDoc Users
Hi,

This might be asking a bit much of JSDoc, but in my current project there are extensions to the same native objects over different files. For example, in file A.js I document Object.someFakeProperty:

/**
    @external Object
*/

/**
    Document me...
    @property external:Object#someFakeProperty
*/

And in file B.js I document Object.dispatchEvent:

/**
    @external Object
*/

/**
    Document me too
    @property external:Object#dispatchEvent
*/ 

Obviously, I'd like JSDoc to magically consolidate these extensions into a single page of output. Which is sort of what happens, but with duplicate info, e.g.:

Object
-- source: A.js
Properties:
- dispatchEvent
-- source: B.js
- someFakeProperty
-- source: A.js
----------------------------------- </hr>
Object
-- source: B.js
Properties
- dispatchEvent
-- source: B.js
- someFakeProperty
-- source: A.js

In a perfect world, the output would be something like this: 

Object
Properties:
- dispatchEvent
-- source: B.js
- someFakeProperty
-- source: A.js

What part of the JSDoc process would I need to modify to achieve this kind of result?

thanks!

Tim



Michael Mathews

unread,
Sep 14, 2011, 12:09:54 PM9/14/11
to tim.s...@gmail.com, JSDoc Users
Hi Tim,

Can you specify which version of JSDoc you are using? (based on the tags you are using I'm guessing JSDoc 3)

But in general JSDoc does not care about file boundaries or order, so if it isn't already working the problem must be elsewhere. Possibly the problem is that you are documenting two `@external Objects`. You should only document this once.

The following works for me (I get exactly the output you want)...

---- a.js ----
/**
@external Object
*/

/**
Document me...
@property external:Object#someFakeProperty
*/

---- b.js ----


/**
Document me too
@property external:Object#dispatchEvent
*/

--------

with this either of these commands:
$ jsdoc scripts/a.js scripts/b.js
$ jsdoc scripts/b.js scripts/a.js

Michael Mathews
mic...@gmail.com

> --
> You received this message because you are subscribed to the Google Groups "JSDoc Users" group.
> To post to this group, send email to jsdoc...@googlegroups.com.
> To unsubscribe from this group, send email to jsdoc-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jsdoc-users?hl=en.

Reply all
Reply to author
Forward
0 new messages