views:

453

answers:

4

This question concerns using ASDoc to create documentation from AS3. I'm not doing this from Flex or anything, just using the command line, and though everything works fine and ASDoc doesn't return any errors, some of the links in the resulting documentation are broken.

Specifically, in all the places where there are links to properties or methods in other parts of the documentation (including in the same class), the link winds up doubling the folder corresponding to the package.

For example, say I'm documenting myPackage.MyClass. If MyClass has a property called MyProperty, and somewhere in my docs I include a line like this:

@see #MyProperty

then the docs are parsed correctly and the "See also:" link is correctly created, but it winds up pointing to

.../output_directory/myPackage/myPackage/MyClass.html#MyProperty

where of course, in the actual file system there is only one myPackage folder.

The relevant part of my ASDoc command looks like this:

asdoc
 -source-path .
 -doc-sources myPackage
 -output D:\dev\repository\docs\myPackage_docs
 -external-library-path "C:\Progra~1\Adobe\flex_sdk_3\frameworks\libs\player\10\playerglobal.swc"

Am I perhaps missing some ASDoc argument that would specify the base URL for links, or something along those lines? If this was a plain bug it would be apparent to many, but I can't find any google results for the problem, so my working hypothesis is that it doesn't happen to people running ASDoc from Flex, perhaps because of some setting I've omitted.

Thanks for any help!


On the suggestion of TypeOneError, I tried different kinds of @see links. I found that these work fine:

  • @see some.package
  • @see ClassName
  • @see ClassName#property

while these do not work:

  • @see #property
  • @see full.package.ClassName
  • @see full.package.ClassName#property

What's a bit worse is, although all the navigational links work, the same doubled path occurs in automatically generated type links. For example, where it shows each method's signature, when the method returns a class that's in the documentation, that link is broken.

I also had a look at the HTML, and found that the problem doesn't appear to be with the page's base URL or anything, it's just inconsistent links. So in a row of consecutive @see links, some of them link to ClassName.html and some link to package/ClassName.html, by the rules shown above. All of this, by the way, is true regardless of whether the pages are viewed in frames or not.

More info if I figure anything out, but ideas for workarounds are most welcome.


Update: A few more details: I'm not sure of my exact SDK version, except that it accompanied Flex 3, but if I run ASDoc without arguments, it reports: Adobe ASDoc Version 3.3.0 build 4852. I'm running this all on Windows XP, from a batch file placed in the classpath directory.


Partial solution: all but one of my issues were resolved by upgrading to the 4.0.0.7219 beta release of the Flex 4 SDK (and using the ASDoc distributed therein). Now, all my @see tags work as expected. The only remaining problem is that, wherever I have a method that returns a class that is part of my documentation, ASDoc simply mangles the link. For example, if I have a method whose signature is ClassA#getB():ClassB, then where that is shown in the docs, the text "ClassB" links to "packageName:ClassB.html" instead of "packageName/ClassB.html". This would appear to be a simple bug. Bleh.

A: 

I'd guess the problem is your line

-doc-sources myPackage

Specifying '.' there instead of 'myPackage' should get it fixed (so make it identical to your source path)

Simon Groenewolt
Afraid not, this just makes it try to document all the other source in that folder in addition to the one I'm trying to document. If I move all the other source elsewhere, ASDoc completes without error as before, and the bug is unchanged.
fenomas
Hmm, I would not know what to suggest otherwise. The use of a packagename in -doc-sources definitely feels wrong to me.
Simon Groenewolt
I tried removing the -doc-sources line entirely, and including classes via -doc-classes instead... as in, "-doc-classes packageName.ClassName". It didn't seem to have any effect on the bug though. Would that be a more normal way to be calling asdoc?
fenomas
+1  A: 

ASDoc is frustrating to no end. Have you tried explicitly adding the full package/class name to the @see, i.e:

@see myPackage.myClass#MyProperty

To see if that makes a difference?

Edit

I ran a few tests based on your findings and the internal property marker is working for me. i.e.

@see #_dispatcher

Links directly to that property on the page (no double sub-folder). I think maybe you need to rethink how you're running the command. For instance, my codebase is set up thusly:

/src
    /com
        /bkwld
            /fetch

I typically run asdoc inside "src":

asdoc -source-path . -doc-classes com/bkwld/fetch/Fetch

I tried all of these in Fetch.as and they all worked as expected:

*  @see FetchItem
*  @see com.bkwld.utils.Logger
*  @see #_dispatcher

First took me to the FetchItem page, second took me to the Logger page in a different package, and third jumped up the page to the protected methods of Fetch.

Just out of curiosity...what version of the sdk are you using?

Typeoneerror
Hmm, it did make a difference... I'll update with the results.
fenomas
Added a test, FYI
Typeoneerror
Thanks VERY much for the testing mate, this sounds solveable. I'm calling ASDoc similarly to you - I keep the batch file in my classpath directory, at the same level as my topmost package ("com" in your example). I'll add a few version details to my question as well. You're not using FlexBuilder or Eclipse to run ASDoc, right?
fenomas
Nope, just command line. I'm currently running the version bundled with 4.0.0.4021
Typeoneerror
I tried the newer 4.0.0.7219 beta version, and all of my issues but one were resolved. This last one, I don't think can be anything but an ASDoc bug, so I think this has all been nothing but an edge case. I'll update the question with details.
fenomas
Edge case, eh? Sounds like a call for another SO Question ;) Glad to hear it's working better now. I'm still trying to asdoc my codebase into submission. Heh.
Typeoneerror
A: 

I have written a simple Python script that fixes the paths incorrectly generated by asdoc in the case mentioned mentioned above. Namely, if there is a method myMethod(v:MyClass,...) asdoc incorrectly generates the link href="../mypackage:Myclass" The script will fix this replacing the : by a /

I should notice that the docs I am generating have a pretty "flat" structure, that is, a single package with a bunch of classes. I have no idea if the fix works with more complex documentation structures.

Anyway, if anyone wants to try the script, I'll be glad to send it.

A: 

I find asdoc extremely frustrating, I experience the same problem when I referrer to a method in the same package. Another annoying thing is the @example tag where the outline of your code can be a mess sometimes, but there it does not end. I have spend more time on writing the javadoc in my code than writing the actual code, and then it somehow ignores all my private variables and private functions, despite the fact I do not use the @private keyword, it's probably me something missing here, but very logical it does not seem to me.

If I would have written my documentation by hand using notepad I would be finished 3 times already, and I would not have to search between the comments for code in my as files, since single line comments are ignored as well.

So, at least I got rid of my frustration now and my blood pressure got back to a normal level. Time to give it another try. :-p

Dave Bleeker