RFR: JDK-8289332: Auto-generate ids for user-defined headings
Hannes Wallnöfer
hannesw at openjdk.org
Wed Aug 17 14:28:36 UTC 2022
On Mon, 25 Jul 2022 15:10:36 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> This is a simple change to automatically generate `id` attributes for HTML headers in documentation comments.
>
> I decided to leave the functionality in `HtmlDocletWriter` rather than moving it to `HtmlIds` because it uses the same helper methods as`commentTagsToContent`.
>
> The value of the `id` attribute id derived from the content of the header tag with spaces and other non-word characters replaced by `-`. A `-hdr` suffix is appended to avoid collisions with other ids. If there are duplicate values an int counter is appended to make them unique.
Thanks for the review, I think I addressed all your feedback in the incremental commit.
As a corner case I removed the emptiness check for the heading text, so an empty heading will now get an `id="-heading[idx]"` attribute which is useless but also harmless.
-------------
PR: https://git.openjdk.org/jdk/pull/9627
More information about the javadoc-dev
mailing list