js-doc-parse icon indicating copy to clipboard operation
js-doc-parse copied to clipboard

support for classes in module return values

Open wkeese opened this issue 13 years ago • 11 comments

IIUC the plan was that for modules that return a hash containing classes, that all of each class' data will be be shoved into the description of that attribute.

So for example dojox/gfx/shape.js has:

var shape = g.shape = {
    // summary:
    //      This module contains the core graphics Shape API.
    //      Different graphics renderer implementation modules (svg, canvas, vml, silverlight, etc.) extend this
    //      basic api to provide renderer-specific implementations for each shape.
};
...
shape.Rect = declare(shape.Shape, {
    // summary:
    //      a generic rectangle
    constructor: function(rawNode){
        // rawNode: Node
        //      The underlying graphics system object (typically a DOM Node)
        this.shape = g.getDefault("Rect");
        this.rawNode = rawNode;
    },
    getBoundingBox: function(){
        // summary:
        //      returns the bounding box (its shape in this case)
        return this.shape;  // dojox.gfx.Rectangle
    }
});

But there's no real info about Rect in the output file:

<method name="Rect" scope="normal" type="constructor" from="dojox/gfx/shape">
<parameters/>
<return-types/>
</method>

cc @cjolif

wkeese avatar Jun 06 '12 08:06 wkeese

There is similar but slightly different issue in dojox/color/Palette. That modules define the Palette class. On this Palette class it mix-ins a generators property which itself contains several functions: analogous, monochromatic etc... These functions used to be documented in a sub-object of Palette named generators. They are not output in the XML anymore.

cjolif avatar Jun 07 '12 11:06 cjolif

cc @pruzand

pruzand avatar Jun 08 '12 06:06 pruzand

Is there any code in the dojo/dijit namespaces that exhibits this sort of behaviour?

csnover avatar Jun 09 '12 07:06 csnover

Yes, for example dijit/Tree embeds TreeNode.

wkeese avatar Jun 09 '12 10:06 wkeese

Maybe we should just output the info for dijit/Tree.TreeNode as though it were a module (named dijit/Tree.TreeNode). Then it would display nicely in the viewer.

wkeese avatar Jun 22 '12 09:06 wkeese

That's a reasonable workaround for me. @pruzand would it "fix" the gfx issue as well? I guess yes?

cjolif avatar Jun 22 '12 09:06 cjolif

That's a reasonable workaround for me. @pruzand would it "fix" the gfx issue as well? I guess yes?

I guess so...

Patrick

pruzand avatar Jun 22 '12 09:06 pruzand

@csnover do you think you can make that one for 1.8? Because otherwise gfx doc is pretty much broken. @wkeese did you adopt another strategy for TreeNode?

cjolif avatar Jul 05 '12 16:07 cjolif

I didn't do anything for TreeNode, although it would be easy to split off to a separate file in the tree/ directory.

I still like my previous idea, to treat dijit/Tree.TreeNode as a pseudo-module, although (note to self) that would require updating the hyperlinking code so that dijit/Tree.TreeNode maps to page api/1.8/dijit/Tree.TreeNode rather than api/1.8/dijit/Tree#TreeNode.

wkeese avatar Jul 05 '12 22:07 wkeese

I fixed this with #60, just needs to be merged.

wkeese avatar Jul 10 '12 04:07 wkeese

thanks a lot @wkeese

cjolif avatar Jul 10 '12 07:07 cjolif