#121 Functions in JavaScript prototype don't get blockquote box

open
nobody
None
5
2015-01-19
2011-03-24
Lawrence Davis
No

For JavaScript objects such as:

var SomeClass = function(arg1, arg2) {}

when declaring a function as part of the object's prototype:

SomeClass.prototype.someFunction = function(arg1, arg1) {}

SomeClass.someFunction does not get the blockquote/Prototype table treatment in the generated docs that functions declared as properties of the object do:

SomeClass.someOtherFunction = function(arg1, arg2) {}

See attached file for test case and screenshot.

Version: NaturalDocs 1.51
Flags used: ./NaturalDocs -p ~/docs/ -i ~/src/ -o HTML ~/docs/

Discussion

  • Lawrence Davis
    Lawrence Davis
    2011-03-24

    Test case and screenshot for this bug -- run the JS through NaturalDocs to see the problem

     
  • Lawrence Davis
    Lawrence Davis
    2011-03-24

    Screenshot of Functions section of generated documentation

     
  • Lawrence Davis
    Lawrence Davis
    2011-03-24

    Test case -- run through NaturalDocs to see the problem

     
  • Greg Valure
    Greg Valure
    2011-04-20

    This is because it's trying to match the name in the comment "SomeClass.someFunction", with the name in the prototype, "SomeClass.prototype.someFunction", and failing. Since you documented the class you actually don't need the qualifier, they're already seen as part of its scope, so you can just write "Function: someFunction" and it will work.

    I'm leaving this bug open until I deal with the underlying issue, but that should allow you to work around it.

     
  • Lawrence Davis
    Lawrence Davis
    2011-04-22

    Thanks Greg, the workaround you provided does the trick and is actually a preferable of writing the comments.