ibm-js / jsdoc-amddcl

An effort to create a JSDoc template that works well with AMD and C3MRO-based multiple class inheritance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@event: multiple entries in TOC

AdrianVasiliu opened this issue · comments

When documenting events using the syntax specified at http://usejsdoc.org/tags-event.html - say, @event module:mymodule#my-event -, the TOC of the generated doc potentially includes mutliple entries for the same event: one for each subclass of the class which declares the event. This has the following drawbacks:

  • For projects with many direct and indirect subclasses of the classes which emit events, the TOC gets overhelmed by the number of TOC entries for the same event (which only differ by their pointed URL).
  • The links for events in the TOC correctly point to the event in the doc of the class which emits them, however for all occurrences of the event corresponding to subclasses of the class which actually emits the event, the link opens the doc of the superclass in its default "Hide inherited" mode, thus the Event section is not visible.

How to reproduce:
Use the modified test cases in PR #42 to reproduce the issue => in the TOC, event-foo appears twice (it would appear 10 times if there would be 9 subclasses of the class which declares the event):

image

The issue actually affects the doc of https://github.com/ibm-js/delite.

This issue seems to be the same as jsdoc/jsdoc#488 .

Remark: the workaround suggested here: jsdoc/jsdoc#488 (comment), that is using @event module:mymodule.my-event instead of @event module:mymodule#my-event does the trick for avoiding the duplicated entries. But it has the unnecceptable drawback that they are no longer inherited by subclasses of the class which emits (and declares) them.

jsdoc/jsdoc#488 (comment) says it will be fixed (no ETA). Not sure if jsdoc-amddcl could fix on its side.

I've added in #42 the introduction of a config flag allowing a project to opt-out from the inclusion of an Events section in the TOC of the doc.

@asudoh, @wkeese, @cjolif, please tell if you think we should go this way for avoiding the duplicated entries in the TOC of delite.

@asudoh gave me the green light offline. Hence I merged my PR (via 52f1683).