What I neglected to mention is that I am actually "inheriting" functions=20
from the "superclass"
which is very handy since it effectively allows me to override only selecte=
d=20
functions.
Example =3D Class.create();
Example.prototype =3D Object.extend( new ExampleSuperClass(), {
/**
This comment isn't found
*/
initialize: function()
{
}
}
JSDoc is such a nice documentation tool -- if there is a way to add support=
=20
for this, even with manual @ tags, I'll take it. I don't know PERL so I=20
haven't had luck playing with your regex's.
As far as a general way of tagging this type of thing -- would it be=20
possible to provide a sort of "ignore the structure" tag that says this=20
thing here is a function no matter what surrounds it?
like (thinking that this could be put anywhere in the code?):
/**
This is my weird function construct
@forceDocumentation
@functionName myFunction
@className MyClass
*/
This would be useful with prototype.js in two ways:
1. for the Object.extend() method
2. to allow documentation of the constructor that is buried by Class.create
()
Is something like this possible?
Thanks,
Cathy
On 9/16/05, Gabriel Reid <gab...@gm...> wrote:
>=20
> On Thu, Sep 15, 2005 at 06:01:07PM -0700, EventListener wrote:
> > I am using the prototype.js library to extend Objects.
> > Any suggestions on how to get methods declared like this to show up in=
=20
> the
> > documentation?
> >
> > Here is an example of what I'm doing:
> >
> > Example =3D Class.create();
> > Example.prototype =3D Object.extend( new Example(), {
> >
> > /**
> > This comment isn't found
> > */
> > initialize: function()
> > {
> >
> > }
> > }
>=20
> At the moment, there isn't a way of getting JSDoc to recognize this kind
> of construct (at least, as far as I'm aware). JSDoc can't "understand"
> what's going on here, because it's actually just an anonymous definition
> where the initialize function is declared.
>=20
> I've just looked at the prototype.js code, and noticed that the
> Object.extend method simply copies all properties from the second
> argument into the first argument. As a result, the above code could be
> written as follows, with (I believe) the same result:
>=20
>=20
> Example =3D Class.create();
> Example.prototype =3D {
>=20
> /**
> This comment is found
> */
> initialize: function()
> {
>=20
> }
> };
>=20
> The above code will be correctly recognized by JSDoc.
>=20
> Unfortunately, support for things as dynamic as what you originally
> posted just isn't available right now. If it were to be supported, it
> would have to be done purely with '@' tags. If you've got some
> suggestions on how this could be done in a general manner (from the
> point of view of the actual documentation in the JavaScript code),
> please let me know.
>=20
> Regards,
>=20
> Gabriel
>
|